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


PHP Phing::getProperty方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     if (version_compare(PHP_VERSION, '5.3.2') < 0) {
         $this->markTestSkipped('Need at least PHP version 5.3.2 to run this unit test');
     }
     $this->oldFsType = Phing::getProperty('host.fstype');
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:7,代码来源:FileSystemTest.php

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

示例3: listLibraries

 /**
  * return the list of files existing in PHING_HOME/vendor
  *
  * @param string $type
  *
  * @return array the list of jar files existing in ant.home/lib or
  *               <tt>null</tt> if an error occurs.
  */
 public static function listLibraries($type)
 {
     $home = Phing::getProperty(Phing::PHING_HOME);
     if ($home == null) {
         return null;
     }
     $currentWorkingDir = getcwd();
     chdir($home);
     exec('composer show --' . $type, $packages, $code);
     chdir($currentWorkingDir);
     return $packages;
 }
开发者ID:Ingewikkeld,项目名称:phing,代码行数:20,代码来源:Diagnostics.php

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

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

示例6: isApplicable

 /**
  * Checks whether the command shall be executed
  *
  * @return boolean False if the exec command shall not be run
  */
 protected function isApplicable()
 {
     if ($this->os === null) {
         return true;
     }
     $myos = Phing::getProperty('os.name');
     $this->log('Myos = ' . $myos, Project::MSG_VERBOSE);
     if (strpos($this->os, $myos) !== false) {
         // this command will be executed only on the specified OS
         // OS matches
         return true;
     }
     $this->log(sprintf('Operating system %s not found in %s', $myos, $this->os), Project::MSG_VERBOSE);
     return false;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:20,代码来源:ExecTask.php

示例7: _getUserPath

 function _getUserPath()
 {
     //For both compatibility and security, we must look this up every time
     return (string) $this->normalize(Phing::getProperty("user.dir"));
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:5,代码来源:Win32FileSystem.php

示例8: restrict

 /**
  * Restrict the given set of files to those that are newer than
  * their corresponding target files.
  *
  * @param array          $files   the original set of files
  * @param PhingFile      $srcDir  all files are relative to this directory
  * @param PhingFile      $destDir target files live here. if null file names
  *                                returned by the mapper are assumed to be absolute.
  * @param FilenameMapper $mapper  knows how to construct a target file names from
  *                                source file names.
  * @param bool           $force   Boolean that determines if the files should be
  *                                forced to be copied.
  *
  * @return array
  */
 public function restrict(&$files, $srcDir, $destDir, $mapper, $force = false)
 {
     $now = time();
     $targetList = "";
     /*
       If we're on Windows, we have to munge the time up to 2 secs to
       be able to check file modification times.
       (Windows has a max resolution of two secs for modification times)
     */
     $osname = strtolower(Phing::getProperty('os.name'));
     // indexOf()
     $index = ($res = strpos($osname, 'win')) === false ? -1 : $res;
     if ($index >= 0) {
         $now += 2000;
     }
     $v = array();
     for ($i = 0, $size = count($files); $i < $size; $i++) {
         $targets = $mapper->main($files[$i]);
         if (empty($targets)) {
             $this->task->log($files[$i] . " skipped - don't know how to handle it", Project::MSG_VERBOSE);
             continue;
         }
         $src = null;
         try {
             if ($srcDir === null) {
                 $src = new PhingFile($files[$i]);
             } else {
                 $src = $this->fileUtils->resolveFile($srcDir, $files[$i]);
             }
             if ($src->lastModified() > $now) {
                 $this->task->log("Warning: " . $files[$i] . " modified in the future (" . $src->lastModified() . " > " . $now . ")", Project::MSG_WARN);
             }
         } catch (IOException $ioe) {
             $this->task->log("Unable to read file " . $files[$i] . " (skipping): " . $ioe->getMessage());
             continue;
         }
         $added = false;
         $targetList = "";
         for ($j = 0, $_j = count($targets); !$added && $j < $_j; $j++) {
             $dest = null;
             if ($destDir === null) {
                 $dest = new PhingFile($targets[$j]);
             } else {
                 $dest = $this->fileUtils->resolveFile($destDir, $targets[$j]);
             }
             if (!$dest->exists()) {
                 $this->task->log($files[$i] . " added as " . $dest->__toString() . " doesn't exist.", Project::MSG_VERBOSE);
                 $v[] = $files[$i];
                 $added = true;
             } elseif ($src->lastModified() > $dest->lastModified()) {
                 $this->task->log($files[$i] . " added as " . $dest->__toString() . " is outdated.", Project::MSG_VERBOSE);
                 $v[] = $files[$i];
                 $added = true;
             } elseif ($force === true) {
                 $this->task->log($files[$i] . " added as " . $dest->__toString() . " is forced to be overwritten.", Project::MSG_VERBOSE);
                 $v[] = $files[$i];
                 $added = true;
             } else {
                 if (strlen($targetList) > 0) {
                     $targetList .= ", ";
                 }
                 $targetList .= $dest->getAbsolutePath();
             }
         }
         if (!$added) {
             $this->task->log($files[$i] . " omitted as " . $targetList . " " . (count($targets) === 1 ? " is " : " are ") . "up to date.", Project::MSG_VERBOSE);
         }
     }
     $result = array();
     $result = $v;
     return $result;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:87,代码来源:SourceFileScanner.php

示例9: checkAccess

 /**
  * Check whether the file or directory denoted by the given abstract
  * pathname may be accessed by this process.  If the second argument is
  * false, then a check for read access is made; if the second
  * argument is true, then a check for write (not read-write)
  * access is made.  Return false if access is denied or an I/O error
  * occurs.
  */
 function checkAccess(PhingFile $f, $write = false)
 {
     // we clear stat cache, its expensive to look up from scratch,
     // but we need to be sure
     @clearstatcache();
     // Shouldn't this be $f->GetAbsolutePath() ?
     // And why doesn't GetAbsolutePath() work?
     $strPath = (string) $f->getPath();
     // FIXME
     // if file object does denote a file that yet not existst
     // path rights are checked
     if (!@file_exists($strPath) && !is_dir($strPath)) {
         $strPath = $f->getParent();
         if ($strPath === null || !is_dir($strPath)) {
             $strPath = Phing::getProperty("user.dir");
         }
         //$strPath = dirname($strPath);
     }
     if (!$write) {
         return (bool) @is_readable($strPath);
     } else {
         return (bool) @is_writable($strPath);
     }
 }
开发者ID:nhemsley,项目名称:phing,代码行数:32,代码来源:FileSystem.php

示例10: __construct

 /**
  *  Construct a new default logger.
  */
 public function __construct()
 {
     $this->lSep = Phing::getProperty("line.separator");
 }
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:7,代码来源:DefaultLogger.php

示例11: execute

 /**
  * Executes a program and returns the return code.
  * Output from command is logged at INFO level.
  * @return int Return code from execution.
  */
 public function execute()
 {
     // 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());
         }
     }
     $this->command = 'svn info -r HEAD ' . $this->dir;
     if ($this->error !== null) {
         $this->command .= ' 2> ' . $this->error->getPath();
         $this->log("Writing error output to: " . $this->error->getPath());
     }
     if ($this->output !== null) {
         $this->command .= ' 1> ' . $this->output->getPath();
         $this->log("Writing standard output to: " . $this->output->getPath());
     } elseif ($this->spawn) {
         $this->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) {
         $this->command .= ' 2>&1';
     }
     // we ignore the spawn boolean for windows
     if ($this->spawn) {
         $this->command .= ' &';
     }
     $this->log("Getting \"svn info -r HEAD\" on " . $this->dir);
     $output = array();
     $return = null;
     exec($this->command, $output, $return);
     if ($this->dir !== null) {
         @chdir($currdir);
     }
     foreach ($output as $line) {
         $this->log($line, $this->passthru ? Project::MSG_INFO : Project::MSG_VERBOSE);
     }
     $str = implode("\n", $output);
     $matches = array();
     if (preg_match('/Rev:[\\s]+([\\d]+)/', $str, $matches) && $this->revisionProperty) {
         $this->project->setProperty($this->revisionProperty, $matches[1]);
         $this->log("HEAD revision on " . $this->dir . " should be " . $matches[1]);
     }
     if ($this->returnProperty) {
         $this->project->setProperty($this->returnProperty, $return);
     }
     if ($return != 0 && $this->checkreturn) {
         throw new BuildException("Task exited with code {$return}");
     }
     return $return;
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:69,代码来源:HeadRevisionTask.php

示例12: describeArguments

 /**
  * Returns a String that describes the arguments suitable for
  * verbose output before a call to
  * <code>Runtime.exec(String[])<code>
  * @param $args arguments to use (default is to use current class args)
  * @param $offset ignore entries before this index
  * @return string
  */
 protected function describeArguments($args = null, $offset = 0)
 {
     if ($args === null) {
         $args = $this->getArguments();
     }
     if ($args === null || count($args) <= $offset) {
         return "";
     }
     $buf = "argument";
     if (count($args) > $offset) {
         $buf .= "s";
     }
     $buf .= ":" . Phing::getProperty("line.separator");
     for ($i = $offset, $alen = count($args); $i < $alen; $i++) {
         $buf .= "'" . $args[$i] . "'" . Phing::getProperty("line.separator");
     }
     $buf .= self::DISCLAIMER;
     return $buf;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:27,代码来源:Commandline.php

示例13: _delete

 private function _delete(SimpleXMLElement $lib, &$items, $keepOldVersions)
 {
     $res = array();
     $libName = strval($lib->getName());
     $tmp = is_array($items[$libName]) ? $items[$libName] : array();
     $tmp = array_slice($tmp, $keepOldVersions);
     $deleteHelper = new ExecTask();
     $deleteHelper->setProject($this->_project);
     $deleteHelper->setLogoutput = true;
     $deleteHelper->setCheckreturn = true;
     foreach ($tmp as $deletedItem) {
         $dst = $deletedItem['dst'];
         $tag = $deletedItem['tag'];
         if ($dst != $lib->deploy->dst) {
             if (strpos(Phing::getProperty('host.fstype'), 'WIN') === 0) {
                 $deleteHelper->setCommand('rmdir /S /Q ' . escapeshellarg($dst));
             } else {
                 $deleteHelper->setCommand('rm -rf ' . escapeshellarg($dst));
             }
             $deleteHelper->main();
             unset($items[$libName][$tag]);
             $res[] = $dst;
         }
     }
     unset($deleteHelper);
     return $res;
 }
开发者ID:sergeytsivin,项目名称:haru,代码行数:27,代码来源:ReleaseHistory.php

示例14: execute

 /**
  * Executes a program and returns the return code.
  * Output from command is logged at INFO level.
  * @return int Return code from execution.
  */
 public function execute()
 {
     // 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) {
         // expand any symbolic links first
         if ($this->dir->getCanonicalFile()->isDirectory()) {
             $currdir = getcwd();
             @chdir($this->dir->getPath());
         } else {
             throw new BuildException("'" . (string) $this->dir . "' is not a valid directory");
         }
     }
     if ($this->escape == true) {
         // FIXME - figure out whether this is correct behavior
         $this->command = escapeshellcmd($this->command);
     }
     if ($this->error !== null) {
         $this->command .= ' 2> ' . $this->error->getPath();
         $this->log("Writing error output to: " . $this->error->getPath(), $this->logLevel);
     }
     if ($this->output !== null) {
         $this->command .= ' 1> ' . $this->output->getPath();
         $this->log("Writing standard output to: " . $this->output->getPath(), $this->logLevel);
     } elseif ($this->spawn) {
         $this->command .= ' 1>/dev/null';
         $this->log("Sending ouptut to /dev/null", $this->logLevel);
     }
     // 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) {
         $this->command .= ' 2>&1';
     }
     // we ignore the spawn boolean for windows
     if ($this->spawn) {
         $this->command .= ' &';
     }
     $this->log("Executing command: " . $this->command, $this->logLevel);
     $output = array();
     $return = null;
     if ($this->passthru) {
         passthru($this->command, $return);
     } else {
         exec($this->command, $output, $return);
     }
     if ($this->dir !== null) {
         @chdir($currdir);
     }
     foreach ($output as $line) {
         $this->log($line, $this->logOutput ? Project::MSG_INFO : Project::MSG_VERBOSE);
     }
     if ($this->returnProperty) {
         $this->project->setProperty($this->returnProperty, $return);
     }
     if ($this->outputProperty) {
         $this->project->setProperty($this->outputProperty, implode("\n", $output));
     }
     if ($return != 0 && $this->checkreturn) {
         throw new BuildException("Task exited with code {$return}");
     }
     return $return;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:74,代码来源:ExecTask.php

示例15: setColors

 /**
  * Set the colors to use from a property file specified by the
  * special ant property ant.logger.defaults
  */
 private final function setColors()
 {
     $userColorFile = Phing::getProperty("phing.logger.defaults");
     $systemColorFile = new PhingFile(Phing::getResourcePath("phing/listener/defaults.properties"));
     $in = null;
     try {
         $prop = new Properties();
         if ($userColorFile !== null) {
             $prop->load($userColorFile);
         } else {
             $prop->load($systemColorFile);
         }
         $err = $prop->getProperty("AnsiColorLogger.ERROR_COLOR");
         $warn = $prop->getProperty("AnsiColorLogger.WARNING_COLOR");
         $info = $prop->getProperty("AnsiColorLogger.INFO_COLOR");
         $verbose = $prop->getProperty("AnsiColorLogger.VERBOSE_COLOR");
         $debug = $prop->getProperty("AnsiColorLogger.DEBUG_COLOR");
         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:andrew-ejov,项目名称:start-template,代码行数:40,代码来源:AnsiColorLogger.php


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