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 * wrapper arroudn packer...
66 function pack($files, $output) {
68 $o = HTML_FlexyFramework::get()->Pman_Core;
70 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
71 throw new Exception("no jstoolkit path set [Pman_Core][jspacker] to the
72 introspection documentation directory where pack.js is located.");
75 require_once 'System.php';
76 $seed= System::which('seed');
78 throw new Exception(" no seed installed");
91 * @param {String} $proj name of Pman component to build
92 * runs pack.js -m {proj} -a $src/*.js
99 echo "Building $proj\n";
102 $this->err = "no project";
103 if ($this->cli) echo $this->err;
106 // first item in path is always the app start directory..
107 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman/'. $proj;
111 //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
114 require_once 'System.php';
115 $seed= System::which('seed');
117 $this->err ="no seed installed";
118 if ($this->cli) echo $this->err;
122 $o = HTML_FlexyFramework::get()->Pman_Core;
124 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
125 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the
126 introspection documentation directory where pack.js is located.";
127 if ($this->cli) echo $this->err;
131 // should we be more specirfic!??!?!?
133 $cmd = "$seed {$o['jspacker']}/pack.js -m $proj -a $src/*.js";
136 // technically we should trash old compiled files..
137 // or we move towards a 'cache in session directory model..'
142 $ret = $tmp . '/'. $proj . '.js';
144 echo "BUILT: $ret \n";
151 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
153 function install($proj)
156 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
160 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
161 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
163 echo "SKIP : no js file $proj\n";
166 if (!file_exists("$base/_compiled_")) {
167 mkdir ("$base/_compiled_", 0755, true);
169 $target = "$base/_compiled_/".$proj .'.js';
170 print_R(array($src,$target));
171 if (file_exists($target)) {
172 return; // already installed.
175 symlink($src, $target);
180 function gatherProjects() {
181 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman';
184 foreach(scandir($src) as $f) {
185 if (!strlen($f) || $f[0] == '.') {
193 if ($f == 'templates') {