/**
  * Verify git version
  *
  * Verify hat the version of the installed GIT binary is at least 1.6. Will
  * throw an exception, if the binary is not available or too old.
  * 
  * @return void
  */
 protected static function checkVersion()
 {
     if (self::$checked === true) {
         return true;
     }
     $process = new pbsSystemProcess('git');
     $process->nonZeroExitCodeException = true;
     $process->argument('--version')->execute();
     if (!preg_match('(\\d+(?:\\.\\d+)+)', $process->stdoutOutput, $match)) {
         throw new vcsRuntimeException('Could not determine GIT version.');
     }
     if (version_compare($match[0], '1.6', '>=')) {
         return self::$checked = true;
     }
     throw new vcsRuntimeException('Git is required in a minimum version of 1.6.');
 }
 /**
  * Verify git version
  *
  * Verify hat the version of the installed GIT binary is at least 1.6. Will
  * throw an exception, if the binary is not available or too old.
  * 
  * @return void
  */
 protected static function checkVersion()
 {
     if (self::$checked === true) {
         return true;
     }
     $process = new pbsSystemProcess('env');
     $process->nonZeroExitCodeException = true;
     $process->argument('hg')->argument('--version')->execute();
     if (!preg_match('/\\(version (.*)\\)/', $process->stdoutOutput, $match)) {
         throw new vcsRuntimeException('Could not determine Mercurial version.');
     }
     if (version_compare($match[1], '1.3', '>=')) {
         return self::$checked = true;
     }
     throw new vcsRuntimeException('Mercurial is required in a minimum version of 1.3.');
 }
Beispiel #3
0
 /**
  * Lint file contents
  *
  * If issues with the passed file are found the function will return an 
  * array with the found issues, and an empty array otherwise.
  * 
  * @param string $file 
  * @param string $contents 
  * @return array
  */
 public function lint($file, $contents)
 {
     $check = new pbsSystemProcess('/usr/bin/env');
     $check->argument('sievec');
     // Write contents into temporary file, since sievec is not able to read
     // from STDIN
     $tempFileName = tempnam(sys_get_temp_dir(), 'sieve');
     file_put_contents($tempFileName, stream_get_contents($contents));
     $check->argument($tempFileName);
     $check->execute();
     unlink($tempFileName);
     if ($check->stderrOutput !== '') {
         $message = str_replace(array($tempFileName, basename($tempFileName)), array($file, $file), $check->stderrOutput);
         return array(new pchIssue(E_ERROR, $file, null, $message));
     }
     return array();
 }
Beispiel #4
0
 /**
  * Lint file contents
  *
  * If issues with the passed file are found the function will return an 
  * array with the found issues, and an empty array otherwise.
  * 
  * @param string $file 
  * @param string $contents 
  * @return array
  */
 public function lint($file, $contents)
 {
     $check = new pbsSystemProcess('/usr/bin/env');
     $check->argument('php')->argument('-l');
     // Run process asynchronously to pipe file contents into it
     $pipes = $check->execute(true);
     fwrite($pipes[0], stream_get_contents($contents));
     fclose($pipes[0]);
     $output = stream_get_contents($pipes[1]);
     $errors = stream_get_contents($pipes[2]);
     if ($check->close()) {
         // An error occured, transform return contents except for the last
         // line into an issue object
         $message = implode("\n", array_slice(preg_split('(\\r\\n|\\r|\\n)', trim($output)), 0, -1));
         return array(new pchIssue(E_ERROR, $file, null, $message));
     }
     return array();
 }
 /**
  * Verify bzr version
  *
  * Verify that the version of the installed bzr binary is at least 1.1. Will
  * throw an exception, if the binary is not available or too old.
  * 
  * @return void
  */
 protected static function checkVersion()
 {
     if (self::$checked === true) {
         return true;
     }
     $process = new pbsSystemProcess('bzr');
     $process->nonZeroExitCodeException = true;
     $process->argument('--version')->execute();
     if (!preg_match('/\\Bazaar \\(bzr\\) ([0-9.]*)/', $process->stdoutOutput, $match)) {
         throw new vcsRuntimeException('Could not determine Bazaar version.');
     }
     if (version_compare($match[1], '1.1', '<')) {
         throw new vcsRuntimeException('Bazaar is required in a minimum version of 1.1.');
     }
     $process = new pbsSystemProcess('bzr');
     $process->nonZeroExitCodeException = true;
     $process->argument('plugins')->execute();
     if (strpos($process->stdoutOutput, 'xmloutput') === false) {
         throw new vcsRuntimeException('Missing required bazaar pluging "xmloutput".');
     }
     return self::$checked = true;
 }
Beispiel #6
0
 /**
  * Svnlook command
  *
  * Builds a svnlook command from the specified command, using the 
  * parameters for the specified repository (type).
  * 
  * @param string $command
  * @return pbsSystemProcess
  */
 public function buildSvnLookCommand($command)
 {
     $process = new pbsSystemProcess('/usr/bin/env');
     $process->argument('svnlook')->argument('-t')->argument($this->transaction)->argument($command)->argument($this->path);
     return $process;
 }
 /**
  * Class constructor taking the executable
  *
  * @param string $executable Executable to create system process for;
  * @return void
  */
 public function __construct($executable = 'env')
 {
     parent::__construct($executable);
     $this->nonZeroExitCodeException = true;
     $this->argument('cvs');
 }
 /**
  * Class constructor taking the executable
  * 
  * @param string $executable Executable to create system process for;
  * @return void
  */
 public function __construct($executable = 'svn')
 {
     parent::__construct($executable);
     $this->nonZeroExitCodeException = true;
     $this->argument('--non-interactive');
 }