public function handle()
{
$this->setDeploymentStatus();
$hooks = $this->buildCommandList();
foreach (array_keys($hooks) as $stage) {
$before = $stage - 1;
$after = $stage + 1;
if (isset($hooks[$stage]['before'])) {
foreach ($hooks[$stage]['before'] as $hook) {
$this->createCommandStep($before, $hook);
}
}
$this->createDeployStep($stage);
if (isset($hooks[$stage]['after'])) {
foreach ($hooks[$stage]['after'] as $hook) {
$this->createCommandStep($after, $hook);
}
}
}
$this->dispatch(new DeployProject($this->deployment));
}