public function getTask($task, array $macroOptions = [])
{
$script = array_get($this->tasks, $task, '');
if ($script == '') {
throw new \Exception(sprintf('Task "%s" is not defined.', $task));
}
$options = array_merge($this->getTaskOptions($task), $macroOptions);
$parallel = array_get($options, 'parallel', false);
$confirm = array_get($options, 'confirm', null);
return new Task($this->getServers($options), $options['as'], $script, $parallel, $confirm);
}
/** * Run the given task out of the container. * * @param \Laravel\Envoy\TaskContainer $container * @param string $task * @return void */ protected function runTask($container, $task) { $confirm = $container->getTask($task)->confirm; if ($confirm && !$this->confirmTaskWithUser($task, $confirm)) { return; } if (($exitCode = $this->runTaskOverSSH($container->getTask($task))) > 0) { foreach ($container->getErrorCallbacks() as $callback) { call_user_func($callback, $task); } return $exitCode; } foreach ($container->getAfterCallbacks() as $callback) { call_user_func($callback, $task); } }