incubator-zeta-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxime Thomas <maxime.t...@gmail.com>
Subject [zeta-dev] Autoloads and autoload file
Date Wed, 24 Nov 2010 08:44:33 GMT
Hi there,

I've got a small reflexion about the base mechanism of ezcBase that allows
us to add an outside repository of classes [1].
Actually, I manage manually my autoload file and as we discussed before with
James Pic [2], it could be a good point to have an extend to this mechanism
and get a real script that will get the whole mapping class/file for you.
I've checked in ez how is done the ezpautoloads script that does the job and
the strategy is the following : list all php files, tokenize it, extract
class names and make the file.
Is it the optimal solution ? Can we find a better way to link classes and
files ?

Max



[1]
http://ezcomponents.org/docs/tutorials/Base#adding-class-repositories-located-outside-ez-components-to-autoload-system

[2]
James Pic shared autoload script :

#!/bin/sh

scanPath="."
if [[ $1 != "" ]]; then
   scanPath=$1;
fi;

echo "<?php";
echo "return array(";
echo `find -L $scanPath -name "*php"  | xargs grep "^class " | sed -e
"s@\([^:]*\):class \([^ ]*\).*@    '\2' => '\1',\
@"`;
echo `find -L $scanPath -name "*php"  | xargs grep "^abstract class "
| sed -e "s@\([^:]*\):abstract class \([^ ]*\).*@    '\2' => '\1',\
@"`;
echo `find -L $scanPath -name "*php"  | xargs grep "^interface " | sed
-e "s@\([^:]*\):interface \([^ ]*\).*@    '\2' => '\1',\
@"`;
echo ");";
echo "?>";

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message