summaryrefslogtreecommitdiff
path: root/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-08-02 21:49:31 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-08-02 21:49:31 +0000
commit688d58f51120786b099509ea3785a8057ae36265 (patch)
tree6714c3deab486ff9c7d2bf6b8d60072d7b8c83c0 /poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
parente62dfb1a310aff5efa285e8bde018314e6f70b50 (diff)
download2012-php-weave-688d58f51120786b099509ea3785a8057ae36265.tar.gz
2012-php-weave-688d58f51120786b099509ea3785a8057ae36265.tar.bz2
2012-php-weave-688d58f51120786b099509ea3785a8057ae36265.zip
Implémentation pour Cake : étape 1 sur 124684 réalisée :
Fonction detectFramework() implementée. Parse le app/webroot/index.php pour récurérer tous les define() et les évalue statiquement et ça marche ! git-svn-id: file:///var/svn/2012-php-weave/trunk@10 d972a294-176a-4cf9-8ea1-fcd5b0c30f5c
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.php16
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) {