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


PHP Phing类代码示例

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


在下文中一共展示了Phing类的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: 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

示例3: testGetFileSystemReturnsCorrect

 /**
  * @dataProvider fileSystemMappingsDataProvider
  */
 public function testGetFileSystemReturnsCorrect($expectedFileSystemClass, $fsTypeKey)
 {
     $this->_resetFileSystem();
     Phing::setProperty('host.fstype', $fsTypeKey);
     $system = FileSystem::getFileSystem();
     $this->assertInstanceOf($expectedFileSystemClass, $system);
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:10,代码来源:FileSystemTest.php

示例4: targetFinished

 function targetFinished(BuildEvent $event)
 {
     $msg .= PHP_EOL . "Target time: " . self::formatTime(Phing::currentTimeMillis() - $this->targetStartTime) . PHP_EOL;
     $event->setMessage($msg, Project::MSG_INFO);
     $this->messageLogged($event);
     $this->targetName = null;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:7,代码来源:TargetLogger.php

示例5: 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

示例6: setColors

 /**
  * Set the colors to use from a property file specified in the
  * special phing property file "phing/listener/defaults.properties".
  */
 private final function setColors()
 {
     $systemColorFile = new PhingFile(Phing::getResourcePath("phing/listener/defaults.properties"));
     try {
         $prop = new Properties();
         $prop->load($systemColorFile);
         $err = $prop->getProperty("HtmlColorLogger.ERROR_CLASS");
         $warn = $prop->getProperty("HtmlColorLogger.WARNING_CLASS");
         $info = $prop->getProperty("HtmlColorLogger.INFO_CLASS");
         $verbose = $prop->getProperty("HtmlColorLogger.VERBOSE_CLASS");
         $debug = $prop->getProperty("HtmlColorLogger.DEBUG_CLASS");
         if ($err !== null) {
             $this->errColor = self::PREFIX . $err . self::SUFFIX;
         }
         if ($warn !== null) {
             $this->warnColor = self::PREFIX . $warn . self::SUFFIX;
         }
         if ($info !== null) {
             $this->infoColor = self::PREFIX . $info . self::SUFFIX;
         }
         if ($verbose !== null) {
             $this->verboseColor = self::PREFIX . $verbose . self::SUFFIX;
         }
         if ($debug !== null) {
             $this->debugColor = self::PREFIX . $debug . self::SUFFIX;
         }
     } catch (IOException $ioe) {
         //Ignore exception - we will use the defaults.
     }
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:34,代码来源:HtmlColorLogger.php

示例7: callFunction

 /**
  * Calls function and returns results.
  * @return mixed
  */
 protected function callFunction()
 {
     if ($this->class !== null) {
         // import the classname & unqualify it, if necessary
         $this->class = Phing::import($this->class);
         $user_func = array($this->class, $this->function);
         $h_func = $this->class . '::' . $this->function;
         // human-readable (for log)
     } else {
         $user_func = $this->function;
         $h_func = $user_func;
         // human-readable (for log)
     }
     // put parameters into simple array
     $params = array();
     foreach ($this->params as $p) {
         $params[] = $p->getValue();
     }
     $this->log("Calling PHP function: " . $h_func . "()");
     foreach ($params as $p) {
         $this->log("  param: " . $p, PROJECT_MSG_VERBOSE);
     }
     $return = call_user_func_array($user_func, $params);
     return $return;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:29,代码来源:PhpEvalTask.php

示例8: execute

 public function execute($command)
 {
     // test if os match
     $myos = Phing::getProperty("os.name");
     $this->log("Myos = " . $myos, Project::MSG_VERBOSE);
     if ($this->os !== null && strpos($this->os, $myos) === false) {
         // this command will be executed only on the specified OS
         $this->log("Not found in " . $this->os, Project::MSG_VERBOSE);
         return 0;
     }
     if ($this->dir !== null) {
         if ($this->dir->isDirectory()) {
             $currdir = getcwd();
             @chdir($this->dir->getPath());
         } else {
             throw new BuildException("Can't chdir to:" . $this->dir->__toString());
         }
     }
     if ($this->escape == true) {
         // FIXME - figure out whether this is correct behavior
         $command = escapeshellcmd($command);
     }
     if ($this->error !== null) {
         $command .= ' 2> ' . $this->error->getPath();
         $this->log("Writing error output to: " . $this->error->getPath());
     }
     if ($this->output !== null) {
         $command .= ' 1> ' . $this->output->getPath();
         $this->log("Writing standard output to: " . $this->output->getPath());
     } elseif ($this->spawn) {
         $command .= ' 1>/dev/null';
         $this->log("Sending ouptut to /dev/null");
     }
     // If neither output nor error are being written to file
     // then we'll redirect error to stdout so that we can dump
     // it to screen below.
     if ($this->output === null && $this->error === null) {
         $command .= ' 2>&1';
     }
     // we ignore the spawn boolean for windows
     if ($this->spawn) {
         $command .= ' &';
     }
     $this->log("Executing command: " . $command);
     $return = null;
     if ($this->passthru) {
         passthru($command, $return);
     } else {
         $output = array();
         exec($command, $output, $return);
     }
     if ($this->dir !== null) {
         @chdir($currdir);
     }
     if ($return != 0 && $this->checkreturn) {
         throw new BuildException("Task exited with code {$return}");
     }
     return $return;
 }
开发者ID:hellogerard,项目名称:phing-things,代码行数:59,代码来源:ForkPhingTask.php

示例9: 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

示例10: 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

示例11: __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

示例12: runBuild

 /**
  * @see Phing
  */
 public function runBuild()
 {
     // workaround for included phing 2.3 which by default loads many tasks
     // that are not needed and incompatible (eg phing.tasks.ext.FtpDeployTask)
     // by placing current directory on the include path our defaults will be loaded
     // see ticket #5054
     $includePath = get_include_path();
     set_include_path(dirname(__FILE__) . PATH_SEPARATOR . $includePath);
     parent::runBuild();
     set_include_path($includePath);
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:14,代码来源:sfPhing.class.php

示例13: 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

示例14: main

 /**
  * Does the work.
  *
  * @throws BuildException if someting goes wrong with the build
  */
 public final function main()
 {
     if ($this->cvsRoot === null) {
         throw new BuildException("cvsroot is required");
     }
     if ($this->password === null) {
         throw new BuildException("password is required");
     }
     $this->log("cvsRoot: " . $this->cvsRoot, PROJECT_MSG_DEBUG);
     $this->log("password: " . $this->password, PROJECT_MSG_DEBUG);
     $this->log("passFile: " . $this->passFile->__toString(), PROJECT_MSG_DEBUG);
     $reader = null;
     $writer = null;
     try {
         $buf = "";
         if ($this->passFile->exists()) {
             $reader = new BufferedReader(new FileReader($this->passFile));
             $line = null;
             while (($line = $reader->readLine()) !== null) {
                 if (!StringHelper::startsWith($this->cvsRoot, $line)) {
                     $buf .= $line . Phing::getProperty("line.separator");
                 }
             }
         }
         $pwdfile = $buf . $this->cvsRoot . " A" . $this->mangle($this->password);
         $this->log("Writing -> " . $pwdfile, PROJECT_MSG_DEBUG);
         $writer = new BufferedWriter(new FileWriter($this->passFile));
         $writer->write($pwdfile);
         $writer->newLine();
         $writer->close();
         if ($reader) {
             $reader->close();
         }
     } catch (IOException $e) {
         if ($reader) {
             try {
                 $reader->close();
             } catch (Exception $e) {
             }
         }
         if ($writer) {
             try {
                 $writer->close();
             } catch (Exception $e) {
             }
         }
         throw new BuildException($e);
     }
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:54,代码来源:CvsPassTask.php

示例15: evaluate

 function evaluate()
 {
     $osName = strtolower(Phing::getProperty("os.name"));
     if ($this->family !== null) {
         if ($this->family === "windows") {
             return StringHelper::startsWith("win", $osName);
         } elseif ($this->family === "mac") {
             return strpos($osName, "mac") !== false || strpos($osName, "darwin") !== false;
         } elseif ($this->family === "unix") {
             return StringHelper::endsWith("ix", $osName) || StringHelper::endsWith("ux", $osName) || StringHelper::endsWith("bsd", $osName) || StringHelper::startsWith("sunos", $osName) || StringHelper::startsWith("darwin", $osName);
         }
         throw new BuildException("Don't know how to detect os family '" . $this->family . "'");
     }
     return false;
 }
开发者ID:vinnivinsachi,项目名称:Vincent-DR,代码行数:15,代码来源:OsCondition.php


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