require_once 'Pman.php';
-class Pman_Core_JsCompiler extends Pman
+class Pman_Core_JsCompile extends Pman
{
var $cli = false;
function getAuth()
if (empty($args[1])) {
$ar = $this->gatherProjects();
- } else {
- echo "SELECT Component to build\n";
+ echo "SELECT Component to build\n";
print_r($ar);
exit;
+ } else {
+ $ar = array($args[1]);
//$ar = $args;
//array_shift($ar);
}
if ($this->cli) echo $this->err;
return;
}
- $src = realpath(dirname(__FILE__).'/../'. $proj);
- if (!file_exists(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj)) {
- mkdir(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj, 0755, true);
- }
+ // first item in path is always the app start directory..
+ $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman/'. $proj;
+
+
+
+ //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
+
-
- $tmp = realpath(dirname(__FILE__).'/../../_compiled_tmp_');
- //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
require_once 'System.php';
- $roolite = System::which('roolite');
- $svn = System::which('svn');
- if (!$roolite) {
- $this->err ="no roolite";
+ $seed= System::which('seed');
+ if (!$seed) {
+ $this->err ="no seed installed";
if ($this->cli) echo $this->err;
return false;
}
- $o = PEAR::getStaticProperty('Pman_Builder','options');
- if (empty($o['jstoolkit'])) {
- $this->err ="no jstoolkit path";
+
+ $o = PEAR::getStaticProperty('Pman_Core','options');
+ if (empty($o['jspacker']) || !file_exists($o['jspacker'].'/pack.js')) {
+ $this->err ="no jstoolkit path set [Pman_Core][jspacker] to the introspection documentation directory where pack.js is located.";
if ($this->cli) echo $this->err;
return false;
}
// should we be more specirfic!??!?!?
-
- $buildjs = realpath(dirname(__FILE__) .'/jsbuilder/build.js');
- $cmd = "$roolite $buildjs -L{$o['jstoolkit']} -- ".
- escapeshellarg( $src) . " " . escapeshellarg($tmp);
-
+
+ $cmd = "$seed {$o['jspacker']}/pack.js -m $proj -a $src/*.js";
+ echo "$cmd\n";
passthru($cmd);
-
- // copy into the revision controlled area.
-
- $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'.js');
- if (!$src) {
- return;
- }
- $pdir = realpath(dirname(__FILE__).'/../'. $proj);
- if (!file_exists($pdir.'/compiled')) {
- mkdir($pdir.'/compiled', 0755, true);
-
- }
- copy($src , $pdir.'/compiled/'. $proj .'.js');
-
- // copy the translation strings.
- $src = realpath(dirname(__FILE__).'/../../_compiled_tmp_/'.$proj .'/build/_translation_.js');
- // var_dump($src);
-
- $pdir = realpath(dirname(__FILE__).'/../'. $proj);
-
- copy($src , $pdir.'/compiled/_translation_.js');
-
- if ($svn) {
- $base = getcwd();
- chdir($pdir);
- $cmd = "$svn add compiled";
- `$cmd`;
- $cmd = "$svn add ". escapeshellarg('compiled/'.$proj .'.js');
- $cmd = "$svn add ". escapeshellarg('compiled/_translation_.js');
-
- `$cmd`;
- `$svn commit -m 'update compiled version'`;
- chdir($base);
- }
-
+ // technically we should trash old compiled files..
+ // or we move towards a 'cache in session directory model..'
/*
}
function gatherProjects() {
- $src = realpath(dirname(__FILE__).'/../');
+ $src= array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) .'/Pman';
+
$ret = array();
foreach(scandir($src) as $f) {
if (!strlen($f) || $f[0] == '.') {