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.");
83 * @param {String} $proj name of Pman component to build
84 * runs pack.js -m {proj} -a $src/*.js
91 echo "Building $proj\n";
94 $this->err = "no project";
95 if ($this->cli) echo $this->err;
98 // first item in path is always the app start directory..
99 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman/'. $proj;
103 //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
106 require_once 'System.php';
107 $seed= System::which('seed');
109 $this->err ="no seed installed";
110 if ($this->cli) echo $this->err;
114 $o = HTML_FlexyFramework::get()->Pman_Core;
116 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
117 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the
118 introspection documentation directory where pack.js is located.";
119 if ($this->cli) echo $this->err;
123 // should we be more specirfic!??!?!?
125 $cmd = "$seed {$o['jspacker']}/pack.js -m $proj -a $src/*.js";
128 // technically we should trash old compiled files..
129 // or we move towards a 'cache in session directory model..'
134 $ret = $tmp . '/'. $proj . '.js';
136 echo "BUILT: $ret \n";
143 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
145 function install($proj)
148 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
152 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
153 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
155 echo "SKIP : no js file $proj\n";
158 if (!file_exists("$base/_compiled_")) {
159 mkdir ("$base/_compiled_", 0755, true);
161 $target = "$base/_compiled_/".$proj .'.js';
162 print_R(array($src,$target));
163 if (file_exists($target)) {
164 return; // already installed.
167 symlink($src, $target);
172 function gatherProjects() {
173 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman';
176 foreach(scandir($src) as $f) {
177 if (!strlen($f) || $f[0] == '.') {
185 if ($f == 'templates') {