public function setBinaryPath($phpPath = null) { if ($phpPath === null) { if ($this->adapter->defined('PHP_BINARY') === true) { $phpPath = $this->adapter->constant('PHP_BINARY'); } if ($phpPath === null) { $phpPath = $this->adapter->getenv('PHP_PEAR_PHP_BIN'); if ($phpPath === false) { $phpPath = $this->adapter->getenv('PHPBIN'); if ($phpPath === false) { $phpDirectory = $this->adapter->constant('PHP_BINDIR'); if ($phpDirectory === null) { throw new exceptions\runtime('Unable to find PHP executable'); } $phpPath = $phpDirectory . '/php'; } } } } return parent::setBinaryPath($phpPath); }
protected function doRun() { $tag = trim(@file_get_contents($this->tagFile)) ?: 0; file_put_contents($this->tagFile, ++$tag); $tag = '0.0.' . $tag; $this->taggerEngine->setSrcDirectory($this->workingDirectory)->setVersion('$Rev: ' . $tag . ' $')->tagVersion(); $git = new cli\command('git'); $git->addOption('commit')->addOption('-am', '\'Set version to ' . $tag . '.\'')->run(); if ($git->getExitCode() !== 0) { throw new cli\command\exception('Unable to commit \'' . $this->tagFile . '\' in repository: ' . $git->getStderr()); } $git->reset()->addOption('tag', $tag)->run(); if ($git->getExitCode() !== 0) { throw new cli\command\exception('Unable to apply tag \'' . $tag . '\': ' . $git->getStderr()); } $git->reset()->addOption('push')->addOption('--tags')->addOption($this->remote)->addOption($this->branch)->run(); if ($git->getExitCode() !== 0) { throw new cli\command\exception('Unable to push tag \'' . $tag . '\' to \'' . $this->remote . '\' in branch \'' . $this->branch . '\': ' . $git->getStderr()); } $tag = 'DEVELOPMENT-' . $tag; $this->taggerEngine->setVersion('$Rev: ' . $tag . ' $')->tagVersion(); $git->reset()->addOption('commit')->addOption('-am', '\'Set version to ' . $tag . '.\'')->run(); if ($git->getExitCode() !== 0) { throw new cli\command\exception('Unable to commit tag \'' . $tag . '\': ' . $git->getStderr()); } $git->reset()->addOption('push')->addOption($this->remote)->addOption($this->branch)->run(); if ($git->getExitCode() !== 0) { throw new cli\command\exception('Unable to push tag \'' . $tag . '\' to \'' . $this->remote . '\' in branch \'' . $this->branch . '\': ' . $git->getStderr()); } return $this; }