예제 #1
0
Benchmark::mark("precached {$appPath}");
$exportResult = Emergence_FS::exportTree($appPath, $appTmpPath);
Benchmark::mark("exported {$appPath} to {$appTmpPath}: " . http_build_query($exportResult));
// write any libraries from classpath
$classPaths = explode(',', $App->getBuildCfg('app.classpath'));
foreach ($classPaths as $classPath) {
    if (substr($classPath, 0, 2) == 'x/') {
        $classPathSource = 'ext-library' . substr($classPath, 1);
        $cachedFiles = Emergence_FS::cacheTree($classPathSource);
        Benchmark::mark("precached {$cachedFiles} files from {$classPathSource}");
        $exportResult = Emergence_FS::exportTree($classPathSource, "{$appTmpPath}/{$classPath}");
        Benchmark::mark("exported {$classPathSource} to {$appTmpPath}/{$classPath}: " . http_build_query($exportResult));
    }
}
// change into app's directory
chdir($appTmpPath);
Benchmark::mark("chdir to: {$appTmpPath}");
// prepare and run upgrade command
$upgradeCmd = Sencha::buildCmd($cmdVersion, 'app upgrade --noframework');
Benchmark::mark("running upgrade CMD: {$upgradeCmd}");
passthru($upgradeCmd, $upgradeCmdStatus);
Benchmark::mark("Upgrade CMD finished: exitCode={$upgradeCmdStatus}");
// import results
Benchmark::mark("importing {$appTmpPath}");
$importResults = Emergence_FS::importTree($appTmpPath, $appPath, array('exclude' => array("#^/x(/|\$)#", "#/\\.sass-cache(/|\$)#", "#/\\.sencha-backup(/|\$)#", "#/\\.emergence(/|\$)#")));
Benchmark::mark("imported files: " . http_build_query($importResults));
// clean up
if (empty($_GET['leaveWorkspace'])) {
    exec("rm -R {$tmpPath}");
    Benchmark::mark("erased {$tmpPath}");
}
예제 #2
0
    }
}
// write archive
if (!empty($_GET['archive'])) {
    try {
        $exportResult = Emergence_FS::exportTree($archivePath, $archiveTmpPath);
        Benchmark::mark("exported {$archivePath} to {$archiveTmpPath}: " . http_build_query($exportResult));
    } catch (Exception $e) {
        Benchmark::mark("failed to export {$archivePath}, continueing");
    }
}
// change into app's directory
chdir($appTmpPath);
Benchmark::mark("chdir to: {$appTmpPath}");
// prepare cmd
$cmd = Sencha::buildCmd($cmdVersion, 'ant', "-Dbuild.dir={$buildTmpPath}", 'sass');
Benchmark::mark("running CMD: {$cmd}");
// execute CMD
passthru("{$cmd} 2>&1", $cmdStatus);
Benchmark::mark("CMD finished: exitCode={$cmdStatus}");
// import resources directory
if ($cmdStatus == 0) {
    Benchmark::mark("importing {$buildTmpPath}/resources to {$buildPath}/resources");
    $importResults = Emergence_FS::importTree("{$buildTmpPath}/resources", "{$buildPath}/resources", array('exclude' => $defaultExclude));
    Benchmark::mark("imported files: " . http_build_query($importResults));
}
// clean up
if (empty($_GET['leaveWorkspace'])) {
    exec("rm -R {$tmpPath}");
    Benchmark::mark("erased {$tmpPath}");
}
    die('Parameter framework required');
}
$framework = $_REQUEST['framework'];
Benchmark::mark("configured request: framework={$framework}");
// get temporary directory
$tmpPath = Emergence_FS::getTmpDir();
Benchmark::mark("created tmp: {$tmpPath}");
// write workspace
$workspacePath = 'sencha-workspace';
Benchmark::mark("precaching workspace: {$workspacePath}");
$cachedFiles = Emergence_FS::cacheTree($workspacePath);
Benchmark::mark("precaching finished: {$cachedFiles} files loaded/updated");
Benchmark::mark("exporting workspace: {$workspacePath} to {$tmpPath}");
$exportResult = Emergence_FS::exportTree($workspacePath, $tmpPath);
Benchmark::mark("exported finished: " . http_build_query($exportResult));
// begin cmd
set_time_limit(0);
$cmd = Sencha::buildCmd($framework, 'generate workspace', $tmpPath);
Benchmark::mark("running CMD: {$cmd}");
passthru($cmd, $cmdStatus);
Benchmark::mark("CMD finished: exitCode={$cmdStatus}");
// import app
if ($cmdStatus == 0) {
    $destPath = 'sencha-workspace';
    Benchmark::mark("importing to: {$destPath}");
    $filesImported = Emergence_FS::importTree($tmpPath, $destPath);
    Benchmark::mark("imported {$filesImported} files");
}
// clean up
exec("rm -R {$tmpPath}");
Benchmark::mark("erased {$tmpPath}");
예제 #4
0
    }
}
// write archive
if (!empty($_GET['archive'])) {
    try {
        $exportResult = Emergence_FS::exportTree($archivePath, $archiveTmpPath);
        Benchmark::mark("exported {$archivePath} to {$archiveTmpPath}: " . http_build_query($exportResult));
    } catch (Exception $e) {
        Benchmark::mark("failed to export {$archivePath}, continueing");
    }
}
// change into app's directory
chdir($appTmpPath);
Benchmark::mark("chdir to: {$appTmpPath}");
// prepare cmd
$cmd = Sencha::buildCmd($cmdVersion, 'ant', "-Dbuild.dir={$buildTmpPath}", "-Dapp.output.base={$buildTmpPath}", "-D{$framework}.dir={$frameworkTmpPath}", $buildType, 'build');
Benchmark::mark("running CMD: {$cmd}");
// optionally dump workspace and exit
if (!empty($_GET['dumpWorkspace']) && $_GET['dumpWorkspace'] != 'afterBuild') {
    header('Content-Type: application/x-bzip-compressed-tar');
    header('Content-Disposition: attachment; filename="' . $appName . '.' . date('Y-m-d') . '.tbz"');
    chdir($tmpPath);
    passthru("tar -cjf - ./");
    exec("rm -R {$tmpPath}");
    exit;
}
// execute CMD
//  - optionally dump workspace and exit
if (!empty($_GET['dumpWorkspace']) && $_GET['dumpWorkspace'] == 'afterBuild') {
    exec($cmd);
    header('Content-Type: application/x-bzip-compressed-tar');
예제 #5
0
$workspaceConfigPath = "{$workspacePath}/.sencha";
$workspaceFrameworkPath = "{$workspacePath}/{$framework}-{$frameworkVersion}";
// precache framework and workspace config
$cachedFiles = Emergence_FS::cacheTree($workspaceConfigPath);
Benchmark::mark("precached {$workspaceConfigPath}");
$cachedFiles = Emergence_FS::cacheTree($workspaceFrameworkPath);
Benchmark::mark("precached {$workspaceFrameworkPath}");
// write workspace to tmp
$exportResult = Emergence_FS::exportTree($workspaceConfigPath, $tmpConfigPath);
Benchmark::mark("exported {$workspaceConfigPath} to {$tmpConfigPath}: " . http_build_query($exportResult));
$exportResult = Emergence_FS::exportTree($workspaceFrameworkPath, $tmpFrameworkPath);
Benchmark::mark("exported {$workspaceFrameworkPath} to {$tmpFrameworkPath}: " . http_build_query($exportResult));
// begin cmd
$appPath = "{$workspacePath}/{$appName}";
$appTmpPath = "{$tmpPath}/{$appName}";
$cmd = Sencha::buildCmd(null, "-sdk {$tmpFrameworkPath}", 'generate app', $appName, $appTmpPath);
//config -prop templates.dir=/root/templates then
Benchmark::mark("running CMD: {$cmd}");
passthru("{$cmd} 2>&1", $cmdStatus);
Benchmark::mark("CMD finished: exitCode={$cmdStatus}");
// import app
if ($cmdStatus == 0) {
    Benchmark::mark("importing {$appTmpPath} to {$appPath}");
    $importResults = Emergence_FS::importTree($appTmpPath, $appPath, array('exclude' => array("#^/{$framework}/#")));
    Benchmark::mark("imported files: " . http_build_query($importResults));
}
// clean up
if (empty($_GET['leaveWorkspace'])) {
    exec("rm -R {$tmpPath}");
    Benchmark::mark("erased {$tmpPath}");
}
예제 #6
0
        $cachedFiles = Emergence_FS::cacheTree($classPathSource);
        Benchmark::mark("precached {$cachedFiles} files in {$classPathSource}");
        $sourceNode = Site::resolvePath($classPathSource);
        if (is_a($sourceNode, SiteFile)) {
            mkdir(dirname($classPath), 0777, true);
            copy($sourceNode->RealPath, $classPath);
            Benchmark::mark("copied file {$classPathSource} to {$classPath}");
        } else {
            $exportResult = Emergence_FS::exportTree($classPathSource, $classPath);
            Benchmark::mark("exported {$classPathSource} to {$classPath}: " . http_build_query($exportResult));
        }
    }
}
// prepare cmd
$classPaths[] = 'src';
$cmd = Sencha::buildCmd($cmdVersion, "-sdk ./{$framework}", 'compile', "-classpath=" . implode(',', array_unique($classPaths)), 'union -class Ext.Boot and concat -yui ./build/common.js', 'and union -recursive -class Site.Common', count($commonOverrides) ? ' and ' . implode(' and ', $commonOverrides) : '', 'and save common', count($pageLoadCommands) ? 'and ' . join(' and ', $pageLoadCommands) . ' and restore common' : '', count($pageNames) > 1 ? 'and intersect -min=2 -set ' . join(',', $pageNames) . ' and include -set common' . ' and exclude -namespace Site.page' . ' and save common' : 'and restore common', "and concat -yui -append ./build/common.js", count($pageBuildCommands) ? 'and ' . join(' and ', $pageBuildCommands) : '');
Benchmark::mark("running CMD: {$cmd}");
// optionally dump workspace and exit
if (!empty($_GET['dumpWorkspace']) && $_GET['dumpWorkspace'] != 'afterBuild') {
    header('Content-Type: application/x-bzip-compressed-tar');
    header('Content-Disposition: attachment; filename="' . $appName . '.' . date('Y-m-d') . '.tbz"');
    passthru("tar -cjf - ./");
    exec("rm -R {$tmpPath}");
    exit;
}
// execute CMD
//  - optionally dump workspace and exit
if (!empty($_GET['dumpWorkspace']) && $_GET['dumpWorkspace'] == 'afterBuild') {
    exec($cmd);
    header('Content-Type: application/x-bzip-compressed-tar');
    header('Content-Disposition: attachment; filename="' . $appName . '.' . date('Y-m-d') . '.tbz"');