/** * @param $command * @param bool $withoutException */ public static function executeCommand($command, $withoutException = false) { exec($command . " 1> /dev/null 2> /tmp/_genie_output", $output, $returnVar); if ($returnVar !== 0 && $withoutException === false) { throw new RuntimeException(implode(",", $output)); } elseif ($returnVar !== 0) { $climate = new CLImate(); $climate->shout("FAILED!"); $climate->shout(implode(",", $output)); $climate->shout("See /tmp/_genie_output for failure details."); } }
/** * Check what files will be uploaded/deleted. * * @param array $files */ public function listFiles($files) { if (count($files['upload']) == 0 && count($files['delete']) == 0) { $this->cli->out(' No files to upload.'); } if (count($files['delete']) > 0) { $this->cli->shout(' Files that will be deleted in next deployment:'); foreach ($files['delete'] as $file_to_delete) { $this->cli->out(' ' . $file_to_delete); } } if (count($files['upload']) > 0) { $this->cli->lightGreen(' Files that will be uploaded in next deployment:'); foreach ($files['upload'] as $file_to_upload) { $this->cli->out(' ' . $file_to_upload); } } }
/** * Returns CLImate shout output * * @param string $string Output * @return mixed */ public function shout($string) { return $this->climate->shout($string); }