コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $args = $this->preparePhingArgs($input, $output);
         $phingClasspath = $this->getContainer()->getParameter('rhapsody_phing.phing_classpath');
         $phingHome = $this->getContainer()->getParameter('rhapsody_phing.phing_home');
         if ($output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE) {
             $commandline = 'phing ' . implode(' ', $args);
             $output->writeln('Executing Phing with: ' . $commandline);
         }
         //require_once('phing/Phing.php');
         \Phing::startup();
         \Phing::setProperty('rhapsody_phing.home', $phingHome);
         \Phing::fire($args);
         \Phing::shutdown();
     } catch (ConfigurationException $x) {
         Phing::printMessage($x);
         exit(-1);
     } catch (Exception $x) {
         exit(1);
     }
 }
コード例 #2
0
ファイル: phing.php プロジェクト: umesecke/phing
    ini_set('include_path', PHP_CLASSPATH);
} else {
    if (!defined('PHP_CLASSPATH')) {
        define('PHP_CLASSPATH', get_include_path());
    }
}
require_once 'phing/Phing.php';
try {
    /* Setup Phing environment */
    Phing::startup();
    // Set phing.home property to the value from environment
    // (this may be NULL, but that's not a big problem.)
    Phing::setProperty('phing.home', getenv('PHING_HOME'));
    // Grab and clean up the CLI arguments
    $args = isset($argv) ? $argv : $_SERVER['argv'];
    // $_SERVER['argv'] seems to not work (sometimes?) when argv is registered
    array_shift($args);
    // 1st arg is script name, so drop it
    // Invoke the commandline entry point
    Phing::fire($args);
    // Invoke any shutdown routines.
    Phing::shutdown();
} catch (ConfigurationException $x) {
    Phing::printMessage($x);
    exit(-1);
    // This was convention previously for configuration errors.
} catch (Exception $x) {
    // Assume the message was already printed as part of the build and
    // exit with non-0 error code.
    exit(1);
}
コード例 #3
0
 /**
  * Run propel phing commands
  *
  * @param string $cmd	phing target
  * @param array $argv arguments
  * @return string
  */
 public static function propelGen($cmd = '', $argv = array())
 {
     $autoloader = App::getInstance()->autoloader;
     $generatorBase = dirname(dirname(dirname($autoloader->findFile('AbstractPropelDataModelTask'))));
     $buildXml = $generatorBase . '/build.xml';
     $projectPath = \Curry\App::getInstance()['projectPath'] . '/propel';
     $argv[] = '-logger';
     $argv[] = 'phing.listener.AnsiColorLogger';
     $argv[] = '-f';
     $argv[] = $buildXml;
     $argv[] = '-Dproject.dir=' . $projectPath;
     if ($cmd) {
         $argv[] = $cmd;
     }
     $cwd = getcwd();
     $stream = fopen("php://temp", 'r+');
     $outputStream = new OutputStream($stream);
     Phing::setOutputStream($outputStream);
     Phing::setErrorStream($outputStream);
     Phing::startup();
     Phing::fire($argv);
     rewind($stream);
     $content = stream_get_contents($stream);
     Phing::shutdown();
     chdir($cwd);
     if (extension_loaded('apc')) {
         @apc_clear_cache();
     }
     return $content;
 }