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;
72 $src = realpath(dirname(__FILE__).'/../'. $proj);
75 $tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
78 require_once 'System.php';
79 $seed= System::which('seed');
81 $this->err ="no seed installed";
82 if ($this->cli) echo $this->err;
86 $o = PEAR::getStaticProperty('Pman_Core','options');
87 if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
88 $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the introspection documentation directory where pack.js is located.";
89 if ($this->cli) echo $this->err;
93 // should we be more specirfic!??!?!?
96 $cmd = "$seed {$o['jspacker']}/pack.js -m$proj -a $src/*.js -o $tmp";
102 // copy into the revision controlled area.
110 $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'.js');
114 $pdir = realpath(dirname(__FILE__).'/../'. $proj);
115 if (!file_exists($pdir.'/compiled')) {
116 mkdir($pdir.'/compiled', 0755, true);
119 copy($src , $pdir.'/compiled/'. $proj .'.js');
121 // copy the translation strings.
122 $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'/build/_translation_.js');
125 $pdir = realpath(dirname(__FILE__).'/../'. $proj);
127 copy($src , $pdir.'/compiled/_translation_.js');
132 $cmd = "$svn add compiled";
134 $cmd = "$svn add ". escapeshellarg('compiled/'.$proj .'.js');
135 $cmd = "$svn add ". escapeshellarg('compiled/_translation_.js');
138 `$svn commit -m 'update compiled version'`;
146 $ret = $tmp . '/'. $proj . '.js';
148 echo "BUILT: $ret \n";
155 // link {PROJECT}/compiled/{PROJECT}.js to _compiled_ folder to make it live.
157 function install($proj)
160 $base = dirname(realpath($_SERVER["SCRIPT_FILENAME"]));
164 var_dump($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
165 $src = realpath($base .'/Pman/'. $proj.'/compiled/'.$proj .'.js');
167 echo "SKIP : no js file $proj\n";
170 if (!file_exists("$base/_compiled_")) {
171 mkdir ("$base/_compiled_", 0755, true);
173 $target = "$base/_compiled_/".$proj .'.js';
174 print_R(array($src,$target));
175 if (file_exists($target)) {
176 return; // already installed.
179 symlink($src, $target);
184 function gatherProjects() {
185 $src = realpath(dirname(__FILE__).'/../');
187 foreach(scandir($src) as $f) {
188 if (!strlen($f) || $f[0] == '.') {
196 if ($f == 'templates') {