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 directoyr..
71 $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman/'. $proj;
77 $tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
80 require_once 'System.php';
81 $seed= System::which('seed');
83 $this->err ="no seed installed";
84 if ($this->cli) echo $this->err;
88 $o = PEAR::getStaticProperty('Pman_Core','options');
89 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
90 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the introspection documentation directory where pack.js is located.";
91 if ($this->cli) echo $this->err;
95 // should we be more specirfic!??!?!?
98 $cmd = "$seed {$o['jspacker']}/pack.js -m$proj -a $src/*.js -o $tmp";
104 // copy into the revision controlled area.
112 $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'.js');
116 $pdir = realpath(dirname(__FILE__).'/../'. $proj);
117 if (!file_exists($pdir.'/compiled')) {
118 mkdir($pdir.'/compiled', 0755, true);
121 copy($src , $pdir.'/compiled/'. $proj .'.js');
123 // copy the translation strings.
124 $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'/build/_translation_.js');
127 $pdir = realpath(dirname(__FILE__).'/../'. $proj);
129 copy($src , $pdir.'/compiled/_translation_.js');
134 $cmd = "$svn add compiled";
136 $cmd = "$svn add ". escapeshellarg('compiled/'.$proj .'.js');
137 $cmd = "$svn add ". escapeshellarg('compiled/_translation_.js');
140 `$svn commit -m 'update compiled version'`;
148 $ret = $tmp . '/'. $proj . '.js';
150 echo "BUILT: $ret \n";
157 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
159 function install($proj)
162 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
166 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
167 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
169 echo "SKIP : no js file $proj\n";
172 if (!file_exists("$base/_compiled_")) {
173 mkdir ("$base/_compiled_", 0755, true);
175 $target = "$base/_compiled_/".$proj .'.js';
176 print_R(array($src,$target));
177 if (file_exists($target)) {
178 return; // already installed.
181 symlink($src, $target);
186 function gatherProjects() {
187 $src = realpath(dirname(__FILE__).'/../');
189 foreach(scandir($src) as $f) {
190 if (!strlen($f) || $f[0] == '.') {
198 if ($f == 'templates') {