4 * wrapper code around js builder...
6 * -- we will use this later to compile on the fly...
8 require_once 'Pman.php';
11 class Pman_Core_JsCompile extends Pman
16 // command line only ATM
17 $this->cli = HTML_FlexyFramework::get()->cli;
18 // var_dump($this->cli);
26 function get($proj, $args)
29 die("missing action : eg. build or install");
32 if (empty($args[1])) {
34 $ar = $this->gatherProjects();
35 echo "SELECT Component to build\n";
39 $ar = array($args[1]);
52 case 'install' : // needed for install on remote sites..
63 echo "Building $proj\n";
66 $this->err = "no project";
67 if ($this->cli) echo $this->err;
70 // first item in path is always the app start directory..
71 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman/'. $proj;
75 //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
78 require_once 'System.php';
79 $seed= System::which('seed');
81 $this->err ="no seed installed";
82 if ($this->cli) echo $this->err;
86 $o = PEAR::getStaticProperty('Pman_Core','options');
87 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
88 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the introspection documentation directory where pack.js is located.";
89 if ($this->cli) echo $this->err;
93 // should we be more specirfic!??!?!?
95 $cmd = "$seed {$o['jspacker']}/pack.js -m $proj -a $src/*.js";
98 // technically we should trash old compiled files..
99 // or we move towards a 'cache in session directory model..'
104 $ret = $tmp . '/'. $proj . '.js';
106 echo "BUILT: $ret \n";
113 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
115 function install($proj)
118 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
122 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
123 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
125 echo "SKIP : no js file $proj\n";
128 if (!file_exists("$base/_compiled_")) {
129 mkdir ("$base/_compiled_", 0755, true);
131 $target = "$base/_compiled_/".$proj .'.js';
132 print_R(array($src,$target));
133 if (file_exists($target)) {
134 return; // already installed.
137 symlink($src, $target);
142 function gatherProjects() {
143 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman';
146 foreach(scandir($src) as $f) {
147 if (!strlen($f) || $f[0] == '.') {
155 if ($f == 'templates') {