From 724fc05b9e07f5ed62de01ad874b86a25d69ab44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Wed, 6 Aug 2014 14:35:50 -0300 Subject: [PATCH] Tweaks. --- Mage/Command/BuiltIn/DeployCommand.php | 1 + Mage/Command/BuiltIn/ReleasesCommand.php | 1 + Mage/Command/BuiltIn/RollbackCommand.php | 4 +++- Mage/Console.php | 6 ++---- Mage/Task/BuiltIn/Deployment/ReleaseTask.php | 1 + .../Deployment/Strategy/BaseStrategyTaskAbstract.php | 2 +- Mage/Yaml/Parser.php | 1 + 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Mage/Command/BuiltIn/DeployCommand.php b/Mage/Command/BuiltIn/DeployCommand.php index 45ee323..e0f45d8 100644 --- a/Mage/Command/BuiltIn/DeployCommand.php +++ b/Mage/Command/BuiltIn/DeployCommand.php @@ -350,6 +350,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment if (self::$deployStatus == self::SUCCEDED && $this->getConfig()->release('enabled', false) == true) { // Execute the Releases Console::output('Starting the Releasing'); + $completedTasks = 0; foreach ($hosts as $hostKey => $host) { // Check if Host has specific configuration diff --git a/Mage/Command/BuiltIn/ReleasesCommand.php b/Mage/Command/BuiltIn/ReleasesCommand.php index 12e1e1e..cd4f761 100644 --- a/Mage/Command/BuiltIn/ReleasesCommand.php +++ b/Mage/Command/BuiltIn/ReleasesCommand.php @@ -28,6 +28,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment */ public function run() { + $result = false; $subCommand = $this->getConfig()->getArgument(1); // Run Tasks for Deployment diff --git a/Mage/Command/BuiltIn/RollbackCommand.php b/Mage/Command/BuiltIn/RollbackCommand.php index c154ecf..b6bda5c 100644 --- a/Mage/Command/BuiltIn/RollbackCommand.php +++ b/Mage/Command/BuiltIn/RollbackCommand.php @@ -28,14 +28,16 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment */ public function run() { + $result = false; $releaseId = $this->getConfig()->getArgument(1); + if (!is_numeric($releaseId)) { Console::output('This release is mandatory.', 1, 2); return false; } $lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock'; - if (file_exists($lockFile) && ($subcommand == 'rollback')) { + if (file_exists($lockFile)) { Console::output('This environment is locked!', 1, 2); echo file_get_contents($lockFile); return null; diff --git a/Mage/Console.php b/Mage/Console.php index dac0dfc..bb48cf6 100644 --- a/Mage/Console.php +++ b/Mage/Console.php @@ -85,11 +85,10 @@ class Console } }); - // Load configuration + $config = self::$config = new Config; $configError = false; try { - // Load Config - $config = self::$config = new Config; + // Load configuration $config->load($arguments); } catch (Exception $exception) { @@ -249,7 +248,6 @@ class Console public static function readInput() { $fp = fopen("php://stdin", "r"); - $line = ''; $line = fgets($fp); return rtrim($line); diff --git a/Mage/Task/BuiltIn/Deployment/ReleaseTask.php b/Mage/Task/BuiltIn/Deployment/ReleaseTask.php index 5dd1ec7..98fec7d 100644 --- a/Mage/Task/BuiltIn/Deployment/ReleaseTask.php +++ b/Mage/Task/BuiltIn/Deployment/ReleaseTask.php @@ -36,6 +36,7 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride */ public function run() { + $resultFetch = false; if ($this->getConfig()->release('enabled', false) == true) { $releasesDirectory = $this->getConfig()->release('directory', 'releases'); $symlink = $this->getConfig()->release('symlink', 'current'); diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php b/Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php index a5f354c..3078514 100644 --- a/Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php +++ b/Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php @@ -95,7 +95,7 @@ abstract class BaseStrategyTaskAbstract extends AbstractTask implements IsReleas $directoryToDelete = $releasesDirectory . '/' . $releaseIdToDelete; if ($directoryToDelete != '/') { $command = 'rm -rf ' . $directoryToDelete; - $result = $result && $this->runCommandRemote($command); + $this->runCommandRemote($command); } } } diff --git a/Mage/Yaml/Parser.php b/Mage/Yaml/Parser.php index ce74210..fa7007d 100644 --- a/Mage/Yaml/Parser.php +++ b/Mage/Yaml/Parser.php @@ -480,6 +480,7 @@ class Parser if ($isCurrentLineBlank) { $text .= substr($this->currentLine, $indentation); } else { + /** @noinspection PhpUndefinedVariableInspection */ $text .= $matches[1]; }