diff options
Diffstat (limited to 'poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php')
-rw-r--r-- | poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php b/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php index cc25641..508e509 100644 --- a/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php +++ b/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php @@ -3,7 +3,23 @@ require_once 'abstract_weaver.class.php'; class CakePHPWeaver extends AbstractWeaver { public function detectFramework($sourcetree_rootpath) { + //FIXME : there is other cases to cover + $entrypoint_path=$sourcetree_rootpath.'/app/webroot/index.php'; + assert('is_readable($entrypoint_path)'); + $entrypoint_ast=$this->parseAndWalk($entrypoint_path, null); + //echo $this->nodeDumper->dump($entrypoint_ast); + + $magics=array('__FILE__' => $entrypoint_path); + $fw_props=$this->staticEvalDefine($entrypoint_ast, $magics); + if (!is_array($fw_props)) throw new Exception("No properties found in '$entrypoint_path'"); + + print_r($fw_props); + $required=array('ROOT','APP_DIR','CAKE_CORE_INCLUDE_PATH','WEBROOT_DIR', 'WWW_ROOT'); + $missing=array_diff($required, array_keys($fw_props)); + print_r($missing); + assert('count($missing)===0;'); + return array_merge(array('entrypoint_path' => $entrypoint_path), $fw_props); } public function parseFrameworkConfig($fw_props) { |