当前位置: 首页>>代码示例>>PHP>>正文


PHP Phing::startup方法代码示例

本文整理汇总了PHP中Phing::startup方法的典型用法代码示例。如果您正苦于以下问题:PHP Phing::startup方法的具体用法?PHP Phing::startup怎么用?PHP Phing::startup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phing的用法示例。


在下文中一共展示了Phing::startup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: call_phing

 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();
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:28,代码来源:pakePhingTask.class.php

示例2: call_phing

 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();
 }
开发者ID:DBezemer,项目名称:server,代码行数:26,代码来源:pakePhingTask.class.php

示例3: setUp

 public function setUp()
 {
     Phing::startup();
     $this->project = $this->getMockBuilder('Project')->setMethods(array('getBasedir'))->getMock();
     $this->task = new GuessExtensionKeyTask();
     $this->task->setProject($this->project);
 }
开发者ID:dreadlabs,项目名称:typo3-cms-phing-helper,代码行数:7,代码来源:GuessExtensionKeyTaskTest.php

示例4: setUp

 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();
 }
开发者ID:zenith6,项目名称:eccube-zeclib,代码行数:9,代码来源:TaskTestBase.php

示例5: setUp

 public function setUp()
 {
     Phing::startup();
     $this->base = $this->getMockBuilder('PhingFile')->setConstructorArgs(array(dirname(__FILE__) . '/../Fixtures/BaseLocalConfiguration.php'))->setMethods(NULL)->getMock();
     $this->update = $this->getMockBuilder('PhingFile')->setConstructorArgs(array(dirname(__FILE__) . '/../Fixtures/UpdateLocalConfiguration.php'))->setMethods(NULL)->getMock();
     $_tempTargetFile = tempnam('/tmp', 'tmp');
     $tempTargetFile = $this->getMockBuilder('PhingFile')->setConstructorArgs(array($_tempTargetFile))->setMethods(NULL)->getMock();
     $this->fileWriter = $this->getMockBuilder('FileWriter')->setConstructorArgs(array($tempTargetFile))->getMock();
     $this->task = new MergeLocalConfigurationTask();
 }
开发者ID:dreadlabs,项目名称:typo3-cms-phing-helper,代码行数:10,代码来源:MergeLocalConfigurationTaskTest.php

示例6: __construct

 public function __construct()
 {
     // @todo These should have an auto-loader
     require_once 'phing/Phing.php';
     require_once 'phing/Project.php';
     require_once 'phing/types/FileSet.php';
     require_once 'phing/system/io/PhingFile.php';
     require_once 'phing/system/util/Properties.php';
     // Needs calling quite early (e.g. PhingFile won't work without it)
     Phing::startup();
 }
开发者ID:halfer,项目名称:Meshing,代码行数:11,代码来源:Task.php

示例7: setUp

 public function setUp()
 {
     Phing::startup();
     $this->project = $this->getMockBuilder('Project')->setMethods(NULL)->getMock(NULL);
     $tempTargetFile = tempnam('/tmp', 'tmp');
     $this->file = $this->getMockBuilder('PhingFile')->setConstructorArgs(array($tempTargetFile))->setMethods(NULL)->getMock();
     $propertyTask = $this->getMockBuilder('PropertyTask')->setMethods(NULL)->getMock();
     $propertyTask->setProject($this->project);
     $propertyTask->setFile(dirname(__FILE__) . '/../Fixtures/LocalConfiguration.properties');
     $propertyTask->setPrefix('LocalConfiguration.');
     $propertyTask->main();
     $this->task = new GenerateLocalConfigurationTask();
     $this->task->setProject($this->project);
 }
开发者ID:dreadlabs,项目名称:typo3-cms-phing-helper,代码行数:14,代码来源:GenerateLocalConfigurationTaskTest.php

示例8: execute

 /**
  * {@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);
     }
 }
开发者ID:rhapsody-project,项目名称:phing-bundle,代码行数:25,代码来源:PhingCommand.php

示例9: define

// ---------------------------
/* set classpath */
if (getenv('PHP_CLASSPATH')) {
    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);
开发者ID:umesecke,项目名称:phing,代码行数:31,代码来源:phing.php

示例10: getModels

 protected function getModels($databaseManager, $verbose = false)
 {
     Phing::startup();
     // required to locate behavior classes...
     $schemas = sfFinder::type('file')->name('*schema.xml')->follow_link()->in(sfConfig::get('sf_config_dir'));
     if (!$schemas) {
         throw new sfCommandException('You must create a schema.yml or schema.xml file.');
     }
     $ads = array();
     foreach ($schemas as $schema) {
         if ($verbose) {
             $this->logSection('schema', sprintf('  Parsing schema "%s"', $schema), null, 'COMMENT');
         }
         $dom = new DomDocument('1.0', 'UTF-8');
         $dom->load($schema);
         //$this->includeExternalSchemas($dom, sfConfig::get('sf_config_dir'));
         $xmlParser = new XmlToAppData(new DefaultPlatform(), '');
         $generatorConfig = $this->getGeneratorConfig();
         $generatorConfig->setBuildConnections($this->getConnections($databaseManager));
         $xmlParser->setGeneratorConfig($generatorConfig);
         $ad = $xmlParser->parseString($dom->saveXML(), $schema);
         $ads[] = $ad;
         $nbTables = $ad->getDatabase(null, false)->countTables();
         if ($verbose) {
             $this->logSection('schema', sprintf('  %d tables processed successfully', $nbTables), null, 'COMMENT');
         }
     }
     if (count($ads) > 1) {
         $ad = array_shift($ads);
         $ad->joinAppDatas($ads);
         //$ad = $this->joinDataModels($ads);
         //$this->dataModels = array($ad);
     } else {
         $ad = $ads[0];
     }
     $ad->doFinalInitialization();
     return $ad;
 }
开发者ID:rafix,项目名称:gesCorreo,代码行数:38,代码来源:sfPropelBaseTask.class.php

示例11: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connections = $this->getConnections($databaseManager);
     //$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $i = new afsDbInfo();
     $this->logSection('propel', 'Reading databases structure...');
     $ad = new AppData();
     $totalNbTables = 0;
     foreach ($connections as $name => $params) {
         $pdo = $databaseManager->getDatabase($name)->getConnection();
         $database = new Database($name);
         $platform = $this->getPlatform($databaseManager, $name);
         $database->setPlatform($platform);
         $database->setDefaultIdMethod(IDMethod::NATIVE);
         $parser = $this->getParser($databaseManager, $name, $pdo);
         //$parser->setMigrationTable($options['migration-table']);
         $parser->setPlatform($platform);
         $nbTables = $parser->parse($database);
         $ad->addDatabase($database);
         $totalNbTables += $nbTables;
         $this->logSection('propel', sprintf('  %d tables imported from database "%s"', $nbTables, $name), null, 'COMMENT');
     }
     if ($totalNbTables) {
         $this->logSection('propel', sprintf('%d tables imported from databases.', $totalNbTables));
     } else {
         $this->logSection('propel', 'Database is empty');
     }
     $this->logSection('propel', 'Loading XML schema files...');
     Phing::startup();
     // required to locate behavior classes...
     $this->schemaToXML(self::DO_NOT_CHECK_SCHEMA, 'generated-');
     $this->copyXmlSchemaFromPlugins('generated-');
     $appData = $this->getModels($databaseManager, true);
     $this->logSection('propel', sprintf('%d tables defined in the schema files.', $appData->countTables()));
     $this->cleanup(true);
     $this->logSection('sql-diff', 'Comparing databases and schemas...');
     $manager = new PropelMigrationManager();
     $manager->setConnections($connections);
     foreach ($ad->getDatabases() as $database) {
         $name = $database->getName();
         $filenameDiff = sfConfig::get('sf_data_dir') . "/sql/{$name}." . time() . ".diff.sql";
         $this->logSection('sql-diff', sprintf('  Comparing database "%s"', $name), null, 'COMMENT');
         if (!$appData->hasDatabase($name)) {
             // FIXME: tables present in database but not in XML
             continue;
         }
         $databaseDiff = PropelDatabaseComparator::computeDiff($database, $appData->getDatabase($name));
         if (!$databaseDiff) {
             //no diff
         }
         $this->logSection('sql-diff', sprintf('Structure of database was modified in datasource "%s": %s', $name, $databaseDiff->getDescription()));
         $platform = $this->getPlatform($databaseManager, $name);
         //up sql
         $upDiff = $platform->getModifyDatabaseDDL($databaseDiff);
         //down sql
         $downDiff = $platform->getModifyDatabaseDDL($databaseDiff->getReverseDiff());
         if ($databaseDiff) {
             $this->logSection('sql-diff', "Writing file {$filenameDiff}");
             afStudioUtil::writeFile($filenameDiff, $upDiff);
             if ($options['insert'] === true || $options['insert'] === 'true') {
                 $this->logSection('sql-diff', "Inserting sql diff");
                 $i->executeSql($upDiff, Propel::getConnection($name));
             }
             if ($options['build'] === true || $options['build'] === 'true') {
                 $this->logSection('sql-diff', 'Creating models from current schema');
                 $this->createTask('propel:build-model')->run();
                 $this->logSection('sql-diff', 'Creating forms from current schema');
                 $this->createTask('propel:build-forms')->run();
                 $this->logSection('sql-diff', 'Setting AppFlower project permissions');
                 $this->createTask('afs:fix-perms')->run();
                 $this->logSection('sql-diff', 'Creating AppFlower validator cache');
                 $this->createTask('appflower:validator-cache')->run(array('frontend', 'cache', 'yes'));
                 $this->logSection('sql-diff', 'Clearing Symfony cache');
                 $this->createTask('cc')->run();
             }
         }
     }
 }
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:82,代码来源:afsSqlDiffTask.class.php

示例12: runPhing

 /**
  * 
  * @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:')) {
       }*/
 }
开发者ID:rk4an,项目名称:centreon,代码行数:33,代码来源:PropelMigration.php

示例13: buildProject

 /**
  * 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);
 }
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:13,代码来源:TlalokesPropelFactory.php

示例14: testPhingInstallation

 public function testPhingInstallation()
 {
     $tmpDir = sys_get_temp_dir();
     WadeLib::installPhingManually($tmpDir, $tmpDir . '/phing');
     # Start Phing with a test-buildfile
     $phingDir = $tmpDir . '/phing';
     $phingInclude = $phingDir . '/classes/';
     ini_set('include_path', $phingInclude);
     require $phingInclude . 'phing/Phing.php';
     Phing::startup();
     # Sets up the phing environment
     Phing::start(array('-buildfile', 'tests/build.xml'));
     # Check results of test-buildfile
     $resultFile = __DIR__ . '/wadelib_testbuild';
     $this->assertEquals(PHP_OS, file_get_contents($resultFile));
     # Delete local files:
     unlink($resultFile);
     # Remove extracted Phing library:
     FileSystemManager::rrmdir($phingDir);
 }
开发者ID:codeless,项目名称:wadelib,代码行数:20,代码来源:WadeLibTest.php

示例15: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connections = $this->getConnections($databaseManager);
     $this->logSection('propel', 'Reading databases structure...');
     $ad = new AppData();
     $totalNbTables = 0;
     foreach ($connections as $name => $params) {
         if ($options['verbose']) {
             $this->logSection('propel', sprintf('  Connecting to database "%s" using DSN "%s"', $name, $params['dsn']), null, 'COMMENT');
         }
         $pdo = $databaseManager->getDatabase($name)->getConnection();
         $database = new Database($name);
         $platform = $this->getPlatform($databaseManager, $name);
         $database->setPlatform($platform);
         $database->setDefaultIdMethod(IDMethod::NATIVE);
         $parser = $this->getParser($databaseManager, $name, $pdo);
         $parser->setMigrationTable($options['migration-table']);
         $parser->setPlatform($platform);
         $nbTables = $parser->parse($database);
         $ad->addDatabase($database);
         $totalNbTables += $nbTables;
         if ($options['verbose']) {
             $this->logSection('propel', sprintf('  %d tables imported from database "%s"', $nbTables, $name), null, 'COMMENT');
         }
     }
     if ($totalNbTables) {
         $this->logSection('propel', sprintf('%d tables imported from databases.', $totalNbTables));
     } else {
         $this->logSection('propel', 'Database is empty');
     }
     $this->logSection('propel', 'Loading XML schema files...');
     Phing::startup();
     // required to locate behavior classes...
     $this->schemaToXML(self::DO_NOT_CHECK_SCHEMA, 'generated-');
     $this->copyXmlSchemaFromPlugins('generated-');
     $appData = $this->getModels($databaseManager, $options['verbose']);
     $this->logSection('propel', sprintf('%d tables defined in the schema files.', $appData->countTables()));
     $this->cleanup($options['verbose']);
     $this->logSection('propel', 'Comparing databases and schemas...');
     $manager = new PropelMigrationManager();
     $manager->setConnections($connections);
     $migrationsUp = array();
     $migrationsDown = array();
     foreach ($ad->getDatabases() as $database) {
         $name = $database->getName();
         if ($options['verbose']) {
             $this->logSection('propel', sprintf('  Comparing database "%s"', $name), null, 'COMMENT');
         }
         if (!$appData->hasDatabase($name)) {
             // FIXME: tables present in database but not in XML
             continue;
         }
         $databaseDiff = PropelDatabaseComparator::computeDiff($database, $appData->getDatabase($name));
         if (!$databaseDiff) {
             if ($options['verbose']) {
                 $this->logSection('propel', sprintf('  Same XML and database structures for datasource "%s" - no diff to generate', $name), null, 'COMMENT');
             }
             continue;
         }
         $this->logSection('propel', sprintf('Structure of database was modified in datasource "%s": %s', $name, $databaseDiff->getDescription()));
         if ($options['verbose']) {
             $this->logBlock($databaseDiff, 'COMMENT');
         }
         $platform = $this->getPlatform($databaseManager, $name);
         $migrationsUp[$name] = $platform->getModifyDatabaseDDL($databaseDiff);
         $migrationsDown[$name] = $platform->getModifyDatabaseDDL($databaseDiff->getReverseDiff());
     }
     if (!$migrationsUp) {
         $this->logSection('propel', 'Same XML and database structures for all datasources - no diff to generate');
         return;
     }
     $timestamp = time();
     $migrationDirectory = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . $options['migration-dir'];
     $migrationFileName = $manager->getMigrationFileName($timestamp);
     $migrationFilePath = $migrationDirectory . DIRECTORY_SEPARATOR . $migrationFileName;
     if ($options['ask-confirmation'] && !$this->askConfirmation(array(sprintf('Migration class will be generated in %s', $migrationFilePath), 'Are you sure you want to proceed? (Y/n)'), 'QUESTION_LARGE', true)) {
         $this->logSection('propel', 'Task aborted.');
         return 1;
     }
     $this->getFilesystem()->mkdirs($migrationDirectory);
     $migrationClassBody = $manager->getMigrationClassBody($migrationsUp, $migrationsDown, $timestamp);
     file_put_contents($migrationFilePath, $migrationClassBody);
     $this->logSection('propel', sprintf('"%s" file successfully created in %s', $migrationFileName, $migrationDirectory));
     if ($editorCmd = $options['editor-cmd']) {
         $this->logSection('propel', sprintf('Using "%s" as text editor', $editorCmd));
         shell_exec($editorCmd . ' ' . escapeshellarg($migrationFilePath));
     } else {
         $this->logSection('propel', '  Please review the generated SQL statements, and add data migration code if necessary.');
         $this->logSection('propel', '  Once the migration class is valid, call the "propel:migrate" task to execute it.');
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:95,代码来源:sfPropelDiffTask.class.php


注:本文中的Phing::startup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。