diff --git a/Mage/Command/BuiltIn/Deploy.php b/Mage/Command/BuiltIn/Deploy.php index 27ecabb..c30d59d 100644 --- a/Mage/Command/BuiltIn/Deploy.php +++ b/Mage/Command/BuiltIn/Deploy.php @@ -16,7 +16,7 @@ class Mage_Command_BuiltIn_Deploy { $this->getConfig()->setReleaseId(date('YmdHis')); $failedTasks = 0; - + $this->_startTime = time(); $lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock'; @@ -73,12 +73,12 @@ class Mage_Command_BuiltIn_Deploy } } $this->_endTimeHosts = time(); - + if ($failedTasks > 0) { Mage_Console::output('A total of ' . $failedTasks . ' deployment tasks failed: ABORTING', 1, 2); return; } - + // Releasing if ($this->getConfig()->release('enabled', false) == true) { // Execute the Releases @@ -86,7 +86,7 @@ class Mage_Command_BuiltIn_Deploy foreach ($hosts as $host) { $this->getConfig()->setHost($host); $task = Mage_Task_Factory::get('deployment/release', $this->getConfig(), false, 'deploy'); - + if ($this->_runTask($task, 'Releasing on host ' . $host . ' ... ')) { $completedTasks++; } @@ -95,26 +95,29 @@ class Mage_Command_BuiltIn_Deploy // Execute the Post-Release Tasks foreach ($hosts as $host) { - Mage_Console::output('Starting Post-Release tasks for ' . $host . ':'); - $this->getConfig()->setHost($host); - $tasksToRun = $this->getConfig()->getTasks('post-release'); - $tasks = count($tasksToRun); - $completedTasks = 0; - - foreach ($tasksToRun as $task) { - $task = Mage_Task_Factory::get($task, $this->getConfig(), false, 'post-release'); + if (count($tasksToRun) > 0) { + $this->getConfig()->setHost($host); + $tasksToRun = $this->getConfig()->getTasks('post-release'); + $tasks = count($tasksToRun); + $completedTasks = 0; - if ($this->_runTask($task)) { - $completedTasks++; - } - } - - if ($completedTasks == $tasks) { - $tasksColor = 'green'; - } else { - $tasksColor = 'red'; + Mage_Console::output('Starting Post-Release tasks for ' . $host . ':'); + + foreach ($tasksToRun as $task) { + $task = Mage_Task_Factory::get($task, $this->getConfig(), false, 'post-release'); + + if ($this->_runTask($task)) { + $completedTasks++; + } + } + + if ($completedTasks == $tasks) { + $tasksColor = 'green'; + } else { + $tasksColor = 'red'; + } + Mage_Console::output('Finished Post-Release tasks for ' . $host . ': <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } - Mage_Console::output('Finished Post-Release tasks for ' . $host . ': <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } } } @@ -168,7 +171,7 @@ class Mage_Command_BuiltIn_Deploy foreach ($tasksToRun as $taskData) { $tasks++; $task = Mage_Task_Factory::get($taskData, $config, false, $stage); - + if ($this->_runTask($task)) { $completedTasks++; } @@ -183,7 +186,7 @@ class Mage_Command_BuiltIn_Deploy Mage_Console::output('Finished ' . $title . ' tasks: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } } - + private function _runTask($task, $title = null) { $task->init(); @@ -192,17 +195,17 @@ class Mage_Command_BuiltIn_Deploy $title = 'Running ' . $task->getName() . ' ... '; } Mage_Console::output($title, 2, 0); - + $runTask = true; if (($task instanceOf Mage_Task_Releases_SkipOnOverride) && $this->getConfig()->getParameter('overrideRelease', false)) { $runTask == false; } - + $result = false; if ($runTask == true) { try { $result = $task->run(); - + if ($result == true) { Mage_Console::output('OK', 0); $result = true; @@ -223,7 +226,7 @@ class Mage_Command_BuiltIn_Deploy Mage_Console::output('SKIPPED', 0); $result = true; } - + return $result; } diff --git a/bin/mage b/bin/mage index dc575ac..cd4cc16 100755 --- a/bin/mage +++ b/bin/mage @@ -1,5 +1,5 @@ #!/bin/sh -#VERSION:0.9.11 +#VERSION:0.9.12 SCRIPT=$(readlink -f $0) DIR=$(dirname $SCRIPT) diff --git a/bin/mage.php b/bin/mage.php index 8ffdbcc..086816d 100644 --- a/bin/mage.php +++ b/bin/mage.php @@ -3,7 +3,7 @@ date_default_timezone_set('UTC'); $baseDir = dirname(dirname(__FILE__)); -define('MAGALLANES_VERSION', '0.9.11'); +define('MAGALLANES_VERSION', '0.9.12'); // Preload require_once $baseDir . '/Mage/spyc.php';