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..
65 * @param {String} $proj name of Pman component to build
66 * runs pack.js -m {proj} -a $src/*.js
73 echo "Building $proj\n";
76 $this->err = "no project";
77 if ($this->cli) echo $this->err;
80 // first item in path is always the app start directory..
81 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman/'. $proj;
85 //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
88 require_once 'System.php';
89 $seed= System::which('seed');
91 $this->err ="no seed installed";
92 if ($this->cli) echo $this->err;
96 $o = HTML_FlexyFramework::get()->Pman_Core;
98 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
99 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the
100 introspection documentation directory where pack.js is located.";
101 if ($this->cli) echo $this->err;
105 // should we be more specirfic!??!?!?
107 $cmd = "$seed {$o['jspacker']}/pack.js -m $proj -a $src/*.js";
110 // technically we should trash old compiled files..
111 // or we move towards a 'cache in session directory model..'
116 $ret = $tmp . '/'. $proj . '.js';
118 echo "BUILT: $ret \n";
125 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
127 function install($proj)
130 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
134 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
135 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
137 echo "SKIP : no js file $proj\n";
140 if (!file_exists("$base/_compiled_")) {
141 mkdir ("$base/_compiled_", 0755, true);
143 $target = "$base/_compiled_/".$proj .'.js';
144 print_R(array($src,$target));
145 if (file_exists($target)) {
146 return; // already installed.
149 symlink($src, $target);
154 function gatherProjects() {
155 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman';
158 foreach(scandir($src) as $f) {
159 if (!strlen($f) || $f[0] == '.') {
167 if ($f == 'templates') {