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'); }
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; }
/** * 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; }
/** * 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: "******"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); } }
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; }
/** * 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; }
function _getUserPath() { //For both compatibility and security, we must look this up every time return (string) $this->normalize(Phing::getProperty("user.dir")); }
/** * 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; }
/** * 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); } }
/** * Construct a new default logger. */ public function __construct() { $this->lSep = Phing::getProperty("line.separator"); }
/** * 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; }
/** * 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; }
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; }
/** * 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; }
/** * 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. } }
/** * Initializes the task operations, i.e. * - Required information validation * - Working directory * * @param none * * @return void */ private function initialize() { // Log $this->log('Initializing started ', $this->loglevel); ///// Validating the required parameters ///// // Executable if ($this->commandline->getExecutable() === null) { return $this->throwBuildException('Please provide "executable" information'); } // Retrieving the current working directory $this->currentdirectory = getcwd(); // Directory (in which the command should be executed) if ($this->dir !== null) { // Try expanding (any) symbolic links if (!$this->dir->getCanonicalFile()->isDirectory()) { return $this->throwBuildException("'" . $this->dir . "' is not a valid directory"); } // Change working directory $dirchangestatus = @chdir($this->dir->getPath()); // Log $this->log('Working directory change ' . ($dirchangestatus ? 'successful' : 'failed') . ' to ' . $this->dir->getPath(), $this->loglevel); } ///// Preparing the task environment ///// // Getting current operationg system $this->currentos = Phing::getProperty('os.name'); // Log $this->log('Operating System identified : ' . $this->currentos, $this->loglevel); // Getting the O.S. type identifier // Validating the 'filesystem' for determining the OS type [UNIX, WINNT and WIN32] // (Another usage could be with 'os.name' for determination) if ('WIN' == strtoupper(substr(Phing::getProperty('host.fstype'), 0, 3))) { $this->osvariant = 'WIN'; // Probable Windows flavour } else { $this->osvariant = 'LIN'; // Probable GNU/Linux flavour } // Log $this->log('Operating System variant identified : ' . $this->osvariant, $this->loglevel); // Log $this->log('Initializing completed ', $this->loglevel); return; }
/** * print any results in the statement. * @throw SQLException */ protected function printResults($out = null) { $lSep = Phing::getProperty('line.separator'); $rs = null; do { $rs = $this->statement->getResultSet(); if ($rs !== null) { $this->log("Processing new result set.", PROJECT_MSG_VERBOSE); $line = ""; $colsprinted = false; while ($rs->next()) { $fields = $rs->getRow(); if (!$colsprinted && $this->showheaders) { $first = true; foreach ($fields as $fieldName => $ignore) { if ($first) { $first = false; } else { $line .= ","; } $line .= $fieldName; } if ($out !== null) { $out->write($line); $out->newLine(); } else { print $line . $lSep; } $line = ""; $colsprinted = true; } // if show headers $first = true; foreach ($fields as $columnValue) { if ($columnValue != null) { $columnValue = trim($columnValue); } if ($first) { $first = false; } else { $line .= ","; } $line .= $columnValue; } if ($out !== null) { $out->write($line); $out->newLine(); } else { print $line . $lSep; } $line = ""; } // while rs->next() } } while ($this->statement->getMoreResults()); print $lSep; if ($out !== null) { $out->newLine(); } }
/** {@inheritDoc}. */ public function targetStarted(BuildEvent $event) { $this->log(">> TARGET STARTED -- " . $event->getTarget()->getName(), Project::MSG_DEBUG); $this->log(Phing::getProperty('line.separator') . $event->getTarget()->getName() . ":", Project::MSG_INFO); $this->targetStartTime = Phing::currentTimeMillis(); }
/** * Sets up the environment for toExecute and then runs it. * @param Commandline $toExecute * @throws BuildException */ protected function runCommand(Commandline $toExecute) { // We are putting variables into the script's environment // and not removing them (!) This should be fine, but is // worth remembering and testing. if ($this->port > 0) { putenv("CVS_CLIENT_PORT=" . $this->port); } // Need a better cross platform integration with <cvspass>, so // use the same filename. if ($this->passFile === null) { $defaultPassFile = new PhingFile(Phing::getProperty("cygwin.user.home", Phing::getProperty("user.home")) . DIRECTORY_SEPARATOR . ".cvspass"); if ($defaultPassFile->exists()) { $this->setPassfile($defaultPassFile); } } if ($this->passFile !== null) { if ($this->passFile->isFile() && $this->passFile->canRead()) { putenv("CVS_PASSFILE=" . $this->passFile->__toString()); $this->log("Using cvs passfile: " . $this->passFile->__toString(), Project::MSG_INFO); } elseif (!$this->passFile->canRead()) { $this->log("cvs passfile: " . $this->passFile->__toString() . " ignored as it is not readable", Project::MSG_WARN); } else { $this->log("cvs passfile: " . $this->passFile->__toString() . " ignored as it is not a file", Project::MSG_WARN); } } if ($this->cvsRsh !== null) { putenv("CVS_RSH=" . $this->cvsRsh); } // Use the ExecTask to handle execution of the command $exe = new ExecTask($this->project); $exe->setProject($this->project); //exe.setAntRun(project); if ($this->dest === null) { $this->dest = $this->project->getBaseDir(); } if (!$this->dest->exists()) { $this->dest->mkdirs(); } if ($this->output !== null) { $exe->setOutput($this->output); } if ($this->error !== null) { $exe->setError($this->error); } $exe->setDir($this->dest); if (is_object($toExecute)) { $toExecuteStr = $toExecute->__toString(); // unfortunately no more automagic for initial 5.0.0 release :( } $exe->setCommand($toExecuteStr); try { $actualCommandLine = $toExecuteStr; // we converted to string above $this->log($actualCommandLine, Project::MSG_INFO); $retCode = $exe->execute(); $this->log("retCode=" . $retCode, Project::MSG_DEBUG); /*Throw an exception if cvs exited with error. (Iulian)*/ if ($this->failOnError && $retCode !== 0) { throw new BuildException("cvs exited with error code " . $retCode . PHP_EOL . "Command line was [" . $toExecute->describeCommand() . "]", $this->getLocation()); } } catch (IOException $e) { if ($this->failOnError) { throw new BuildException($e, $this->getLocation()); } else { $this->log("Caught exception: " . $e, Project::MSG_WARN); } } catch (BuildException $e) { if ($this->failOnError) { throw $e; } else { $t = $e->getCause(); if ($t === null) { $t = $e; } $this->log("Caught exception: " . $t, Project::MSG_WARN); } } catch (Exception $e) { if ($this->failOnError) { throw new BuildException($e, $this->getLocation()); } else { $this->log("Caught exception: " . $e, Project::MSG_WARN); } } }
/** * the file resolver */ function resolveFile(PhingFile $f) { // resolve if parent is a file oject only if ($this->isAbsolute($f)) { return $f->getPath(); } else { return $this->resolve(Phing::getProperty("user.dir"), $f->getPath()); } }
public function newLine() { $this->write(Phing::getProperty('line.separator')); }
/** * Create a CVS task using the default cvspass file location. */ public function __construct() { $this->passFile = new PhingFile(Phing::getProperty("cygwin.user.home", Phing::getProperty("user.home")) . DIRECTORY_SEPARATOR . ".cvspass"); }
/** * Stores current properties to specified file. * * @param PhingFile $file File to create/overwrite with properties. * @param string $header Header text that will be placed (within comments) at the top of properties file. * @return void * @throws IOException - on error writing properties file. */ function store(PhingFile $file, $header = null) { // stores the properties in this object in the file denoted // if file is not given and the properties were loaded from a // file prior, this method stores them in the file used by load() try { $fw = new FileWriter($file); $fw->open(); if ($header !== null) { $fw->write("# " . $header . Phing::getProperty("line.separator")); } $fw->write($this->toString()); $fw->close(); } catch (IOException $e) { throw new IOException("Error writing property file: " . $e->getMessage()); } }
/** * Returns the path to the temp directory. * @return string */ public static function getTempDir() { return Phing::getProperty('php.tmpdir'); }
private function logStart(BuildEvent $event, $start, $name) { $msg = Phing::getProperty("line.separator") . $name . ": started " . date(self::$dateFormat, $start); $this->printMessage($msg, $this->out, $event->getPriority()); }
/** * Initialize the interpreter with the Phing property */ public function __construct() { $this->setInterpreter(Phing::getProperty('php.interpreter')); }
throw $be; } $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);