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_JsCompiler 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();
36 echo "SELECT Component to build\n";
51 case 'install' : // needed for install on remote sites..
62 echo "Building $proj\n";
65 $this->err = "no project";
66 if ($this->cli) echo $this->err;
71 $src = realpath(dirname(__FILE__).'/../'. $proj);
74 $tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
77 require_once 'System.php';
78 $seed= System::which('seed');
80 $this->err ="no seed installed";
81 if ($this->cli) echo $this->err;
85 $o = PEAR::getStaticProperty('Pman_Core','options');
86 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
87 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the introspection documentation directory where pack.js is located.";
88 if ($this->cli) echo $this->err;
92 // should we be more specirfic!??!?!?
95 $cmd = "$seed {$o['jspacker']}/pack.js -m$proj -a $src/*.js -o $tmp";
101 // copy into the revision controlled area.
109 $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'.js');
113 $pdir = realpath(dirname(__FILE__).'/../'. $proj);
114 if (!file_exists($pdir.'/compiled')) {
115 mkdir($pdir.'/compiled', 0755, true);
118 copy($src , $pdir.'/compiled/'. $proj .'.js');
120 // copy the translation strings.
121 $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'/build/_translation_.js');
124 $pdir = realpath(dirname(__FILE__).'/../'. $proj);
126 copy($src , $pdir.'/compiled/_translation_.js');
131 $cmd = "$svn add compiled";
133 $cmd = "$svn add ". escapeshellarg('compiled/'.$proj .'.js');
134 $cmd = "$svn add ". escapeshellarg('compiled/_translation_.js');
137 `$svn commit -m 'update compiled version'`;
145 $ret = $tmp . '/'. $proj . '.js';
147 echo "BUILT: $ret \n";
154 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
156 function install($proj)
159 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
163 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
164 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
166 echo "SKIP : no js file $proj\n";
169 if (!file_exists("$base/_compiled_")) {
170 mkdir ("$base/_compiled_", 0755, true);
172 $target = "$base/_compiled_/".$proj .'.js';
173 print_R(array($src,$target));
174 if (file_exists($target)) {
175 return; // already installed.
178 symlink($src, $target);
183 function gatherProjects() {
184 $src = realpath(dirname(__FILE__).'/../');
186 foreach(scandir($src) as $f) {
187 if (!strlen($f) || $f[0] == '.') {
195 if ($f == 'templates') {