/** * exec * * @param string $command * * @return Build */ protected function exec($command) { $this->out('>> ' . $command); $return = exec($command); $this->out($return . "\n"); return $this; } /** * out * * @param string $text * @param boolean $nl * * @return Build */ public function out($text, $nl = true) { fwrite(STDOUT, $text . ($nl ? "\n" : '')); return $this; } } $build = new Build(); $build->execute();
*/ protected function exec($command, $arguments = array(), $options = array()) { $arguments = implode(' ', (array) $arguments); $options = implode(' ', (array) $options); $command = sprintf('%s %s %s', $command, $arguments, $options); $this->out('>> ' . $command); if ($this->io->getOption('dry-run')) { return ''; } $return = exec(trim($command), $this->lastOutput, $this->lastReturn); $this->out($return); } /** * stop * * @param string $msg * * @return void */ protected function stop($msg = null) { if ($msg) { $this->out($msg); } $this->close(); } } $app = new Build(); $app->execute();