/** * @dataProvider fileSystemMappingsDataProvider */ public function testGetFileSystemReturnsCorrect($expectedFileSystemClass, $fsTypeKey) { $this->_resetFileSystem(); Phing::setProperty('host.fstype', $fsTypeKey); $system = FileSystem::getFileSystem(); $this->assertInstanceOf($expectedFileSystemClass, $system); }
public static function call_phing($task, $target, $build_file = '', $options = array()) { $args = array(); foreach ($options as $key => $value) { $args[] = "-D{$key}={$value}"; } if ($build_file) { $args[] = '-f'; $args[] = realpath($build_file); } if (!$task->is_verbose()) { $args[] = '-q'; } if (is_array($target)) { $args = array_merge($args, $target); } else { $args[] = $target; } if (DIRECTORY_SEPARATOR != '\\' && (function_exists('posix_isatty') && @posix_isatty(STDOUT))) { $args[] = '-logger'; $args[] = 'phing.listener.AnsiColorLogger'; } Phing::startup(); Phing::setProperty('phing.home', getenv('PHING_HOME')); $m = new pakePhing(); $m->execute($args); $m->runBuild(); }
public static function call_phing($task, $target, $build_file = '', $options = array()) { $args = array(); foreach ($options as $key => $value) { $args[] = "-D{$key}={$value}"; } if ($build_file) { $args[] = '-f'; $args[] = realpath($build_file); } if (!$task->is_verbose()) { $args[] = '-q'; } if (is_array($target)) { $args = array_merge($args, $target); } else { $args[] = $target; } Phing::startup(); Phing::setProperty('phing.home', getenv('PHING_HOME')); ob_start(array('pakePhingTask', 'colorize'), 2); $m = new pakePhing(); $m->execute($args); $m->runBuild(); ob_end_clean(); }
protected function setUp() { if (version_compare(PHP_VERSION, '5.3.2') < 0) { define('E_DEPRECATED', 8192); } chdir(dirname(__FILE__)); Phing::setProperty('phing.home', ZECLIB_TEST_VENDOR_DIR . '/phing'); Phing::startup(); }
/** * {@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); } }
protected function callPhing($taskName, $checkSchema, $properties = array()) { $schemas = sfFinder::type('file')->name('*schema.xml')->relative()->follow_link()->in(sfConfig::get('sf_config_dir')); if (self::CHECK_SCHEMA === $checkSchema && !$schemas) { throw new sfCommandException('You must create a schema.yml or schema.xml file.'); } // Call phing targets sfToolkit::addIncludePath(array(sfConfig::get('sf_symfony_lib_dir'), sfConfig::get('sf_propel_generator_path', realpath(dirname(__FILE__) . '/../vendor/propel-generator/classes')))); $args = array(); $bufferPhingOutput = null === $this->commandApplication || !$this->commandApplication->withTrace(); $properties = array_merge(array('build.properties' => 'propel.ini', 'project.dir' => sfConfig::get('sf_config_dir'), 'propel.output.dir' => sfConfig::get('sf_root_dir')), $properties); foreach ($properties as $key => $value) { $args[] = "-D{$key}={$value}"; } // Build file $args[] = '-f'; $args[] = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'propel-generator' . DIRECTORY_SEPARATOR . 'build.xml'); // Logger if (DIRECTORY_SEPARATOR != '\\' && (function_exists('posix_isatty') && @posix_isatty(STDOUT))) { $args[] = '-logger'; $args[] = 'phing.listener.AnsiColorLogger'; } // Add our listener to detect errors $args[] = '-listener'; $args[] = 'sfPhingListener'; // Add any arbitrary arguments last foreach ($this->additionalPhingArgs as $arg) { if (in_array($arg, array('verbose', 'debug'))) { $bufferPhingOutput = false; } $args[] = '-' . $arg; } $args[] = $taskName; // filter arguments through the event dispatcher $args = $this->dispatcher->filter(new sfEvent($this, 'propel.filter_phing_args'), $args)->getReturnValue(); require_once dirname(__FILE__) . '/sfPhing.class.php'; // enable output buffering Phing::setOutputStream(new OutputStream(fopen('php://output', 'w'))); Phing::startup(); Phing::setProperty('phing.home', getenv('PHING_HOME')); $this->logSection('propel', 'Running "' . $taskName . '" phing task'); if ($bufferPhingOutput) { ob_start(); } $m = new sfPhing(); $m->execute($args); $m->runBuild(); if ($bufferPhingOutput) { ob_end_clean(); } chdir(sfConfig::get('sf_root_dir')); // any errors? $ret = true; if (sfPhingListener::hasErrors()) { $messages = array('Some problems occurred when executing the task:'); foreach (sfPhingListener::getExceptions() as $exception) { $messages[] = ''; $messages[] = preg_replace('/^.*build\\-propel\\.xml/', 'build-propel.xml', $exception->getMessage()); $messages[] = ''; } if (count(sfPhingListener::getErrors())) { $messages[] = 'If the exception message is not clear enough, read the output of the task for'; $messages[] = 'more information'; } $this->logBlock($messages, 'ERROR_LARGE'); $ret = false; } return $ret; }
if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); } 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
/** * * @param string $taskName */ public function runPhing($taskName) { // Copy Files $this->mySchemaBuilder->loadXmlFiles(); // Create build.properties file $this->createBuildPropertiesFile($this->tmpDir . '/build.properties'); // Create buildtime-conf file $this->createBuildTimeConfFile($this->tmpDir . '/buildtime-conf.xml'); // $args = array(); $args = $this->getPhingArguments(); $args[] = $taskName; // Enable output buffering \Phing::setOutputStream(new \OutputStream(fopen('php://output', 'w'))); \Phing::setErrorStream(new \OutputStream(fopen('php://output', 'w'))); \Phing::startup(); \Phing::setProperty('phing.home', getenv('PHING_HOME')); // $myPhing = new \Phing(); //$returnStatus = true; $myPhing->execute($args); $myPhing->runBuild(); /*$this->buffer = ob_get_contents(); // Guess errors if (strstr($this->buffer, 'failed. Aborting.') || strstr($this->buffer, 'Failed to execute') || strstr($this->buffer, 'failed for the following reason:')) { }*/ }
/** * Calls Phing's methods to generate propel's objects * * @param string $libraries_path * @param array $arguments */ public static function buildProject($libraries_path, array &$arguments) { require_once 'phing/Phing.php'; Phing::startup(); Phing::setProperty('phing.home', $libraries_path . 'phing'); Phing::start($arguments); }
<?php defined('PHING_TEST_BASE') || define('PHING_TEST_BASE', dirname(__FILE__)); set_include_path(realpath(dirname(__FILE__) . '/../classes') . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/classes') . PATH_SEPARATOR . get_include_path()); require_once dirname(__FILE__) . '/classes/phing/BuildFileTest.php'; require_once 'phing/Phing.php'; Phing::setProperty('phing.home', realpath(dirname(__FILE__) . '/../')); Phing::startup(); error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT);
protected function callPhing($taskName, $checkSchema) { $schemas = sfFinder::type('file')->name('*schema.xml')->relative()->follow_link()->in('config'); if (self::CHECK_SCHEMA === $checkSchema && !$schemas) { throw new sfCommandException('You must create a schema.yml or schema.xml file.'); } // Call phing targets if (false === strpos('propel-generator', get_include_path())) { set_include_path(sfConfig::get('sf_symfony_lib_dir') . '/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes' . PATH_SEPARATOR . get_include_path()); } set_include_path(sfConfig::get('sf_root_dir') . PATH_SEPARATOR . get_include_path()); $args = array(); // Needed to include the right Propel builders set_include_path(sfConfig::get('sf_symfony_lib_dir') . PATH_SEPARATOR . get_include_path()); $options = array('project.dir' => sfConfig::get('sf_config_dir'), 'build.properties' => 'propel.ini', 'propel.output.dir' => sfConfig::get('sf_root_dir')); foreach ($options as $key => $value) { $args[] = "-D{$key}={$value}"; } // Build file $args[] = '-f'; $args[] = realpath(sfConfig::get('sf_symfony_lib_dir') . '/plugins/sfPropelPlugin/lib/vendor/propel-generator/build.xml'); if (is_null($this->commandApplication) || !$this->commandApplication->isVerbose()) { $args[] = '-q'; } if (!is_null($this->commandApplication) && $this->commandApplication->withTrace()) { $args[] = '-debug'; } // Logger if (DIRECTORY_SEPARATOR != '\\' && (function_exists('posix_isatty') && @posix_isatty(STDOUT))) { $args[] = '-logger'; $args[] = 'phing.listener.AnsiColorLogger'; } $args[] = $taskName; require_once dirname(__FILE__) . '/sfPhing.class.php'; Phing::startup(); Phing::setProperty('phing.home', getenv('PHING_HOME')); $m = new sfPhing(); $m->execute($args); $m->runBuild(); chdir(sfConfig::get('sf_root_dir')); }
} $project->fireBuildFinished(null); if ($project->getProperty('project.available')) { $GLOBALS['PROJECT_DIRECTORY'] = $project->getProperty('project.directory'); } } catch (Exception $e) { /* This failed. Can't figure out project directory. Forget it. */ } /* Switch to whichever project directory the script determined. */ $GLOBALS['PROPERTIES']['project.directory'] = $GLOBALS['PROJECT_DIRECTORY']; /* Execute Phing. */ try { $project = new Project(); // hax for Mac OS X 10.5 Leopard, where "dim" ANSI colors are broken... if (PHP_OS == 'Darwin' && (isset($_SERVER['TERM_PROGRAM']) && $_SERVER['TERM_PROGRAM'] == 'Apple_Terminal' || isset($_ENV['TERM_PROGRAM']) && $_ENV['TERM_PROGRAM'] == 'Apple_Terminal') && version_compare(preg_replace('/^ProductVersion:\\s*([0-9]+\\.[0-9]+)/ms', '$1', shell_exec('sw_vers')), '10.5', 'eq') && !Phing::getProperty('phing.logger.defaults')) { Phing::setProperty('phing.logger.defaults', new PhingFile(BUILD_DIRECTORY . '/agavi/phing/ansicolorlogger_osxleopard.properties')); } elseif (stripos(PHP_OS, 'Win') === 0) { $GLOBALS['LOGGER'] = 'phing.listener.DefaultLogger'; } $GLOBALS['LOGGER'] = Phing::import($GLOBALS['LOGGER']); $logger = new AgaviProxyBuildLogger(new $GLOBALS['LOGGER']()); $logger->setMessageOutputLevel($GLOBALS['VERBOSE'] ? Project::MSG_VERBOSE : Project::MSG_INFO); $logger->setOutputStream($GLOBALS['OUTPUT']); $logger->setErrorStream($GLOBALS['ERROR']); $project->addBuildListener($logger); $project->setInputHandler(new DefaultInputHandler()); $project->setUserProperty('phing.file', $GLOBALS['BUILD']->getAbsolutePath()); $project->setUserProperty('phing.version', Phing::getPhingVersion()); /* Phing f***s with the cwd. Really, brilliant. */ $project->setUserProperty('application.startdir', START_DIRECTORY); foreach ($GLOBALS['PROPERTIES'] as $name => $value) {