diff --git a/Mage/Command/BuiltIn/AddCommand.php b/Mage/Command/BuiltIn/AddCommand.php index fab6f71..d7b1d12 100644 --- a/Mage/Command/BuiltIn/AddCommand.php +++ b/Mage/Command/BuiltIn/AddCommand.php @@ -68,7 +68,7 @@ class AddCommand extends AbstractCommand throw new Exception('The environment already exists.'); } - Console::output('Adding new environment: ' . $environmentName . ''); + Console::output('Adding new environment: ' . $environmentName . ''); $releasesConfig = 'releases:' . PHP_EOL . ' enabled: true' . PHP_EOL @@ -93,10 +93,10 @@ class AddCommand extends AbstractCommand $result = file_put_contents($environmentConfigFile, $baseConfig); if ($result) { - Console::output('Success!! Environment config file for ' . $environmentName . ' created successfully at ' . $environmentConfigFile . ''); - Console::output('So please! Review and adjust its configuration.', 2, 2); + Console::output('Success!! Environment config file for ' . $environmentName . ' created successfully at ' . $environmentConfigFile . ''); + Console::output('So please! Review and adjust its configuration.', 2, 2); } else { - Console::output('Error!! Unable to create config file for environment called ' . $environmentName . '', 1, 2); + Console::output('Error!! Unable to create config file for environment called ' . $environmentName . '', 1, 2); } } } diff --git a/Mage/Command/BuiltIn/DeployCommand.php b/Mage/Command/BuiltIn/DeployCommand.php index 8efa11a..943a630 100644 --- a/Mage/Command/BuiltIn/DeployCommand.php +++ b/Mage/Command/BuiltIn/DeployCommand.php @@ -133,21 +133,21 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $this->getConfig()->setReleaseId(date('YmdHis')); // Deploy Summary - Console::output('Deploy summary', 1, 1); + Console::output('Deploy summary', 1, 1); // Deploy Summary - Environment - Console::output('Environment: ' . $this->getConfig()->getEnvironment() . '', 2, 1); + Console::output('Environment: ' . $this->getConfig()->getEnvironment() . '', 2, 1); // Deploy Summary - Releases if ($this->getConfig()->release('enabled', false)) { - Console::output('Release ID: ' . $this->getConfig()->getReleaseId() . '', 2, 1); + Console::output('Release ID: ' . $this->getConfig()->getReleaseId() . '', 2, 1); } // Deploy Summary - SCM if ($this->getConfig()->deployment('scm', false)) { $scmConfig = $this->getConfig()->deployment('scm'); if (isset($scmConfig['branch'])) { - Console::output('SCM Branch: ' . $scmConfig['branch'] . '', 2, 1); + Console::output('SCM Branch: ' . $scmConfig['branch'] . '', 2, 1); } } @@ -162,7 +162,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment // Check Status if (self::$failedTasks > 0) { self::$deployStatus = self::FAILED; - Console::output('A total of ' . self::$failedTasks . ' deployment tasks failed: ABORTING', 1, 2); + Console::output('A total of ' . self::$failedTasks . ' deployment tasks failed: ABORTING', 1, 2); } else { // Run Deployment Tasks @@ -171,7 +171,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment // Check Status if (self::$failedTasks > 0) { self::$deployStatus = self::FAILED; - Console::output('A total of ' . self::$failedTasks . ' deployment tasks failed: ABORTING', 1, 2); + Console::output('A total of ' . self::$failedTasks . ' deployment tasks failed: ABORTING', 1, 2); } // Run Post-Deployment Tasks @@ -181,15 +181,15 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment // Time Information Hosts if ($this->hostsCount > 0) { $timeTextHost = $this->transcurredTime($this->endTimeHosts - $this->startTimeHosts); - Console::output('Time for deployment: ' . $timeTextHost . '.'); + Console::output('Time for deployment: ' . $timeTextHost . '.'); $timeTextPerHost = $this->transcurredTime(round(($this->endTimeHosts - $this->startTimeHosts) / $this->hostsCount)); - Console::output('Average time per host: ' . $timeTextPerHost . '.'); + Console::output('Average time per host: ' . $timeTextPerHost . '.'); } // Time Information General $timeText = $this->transcurredTime(time() - $this->startTime); - Console::output('Total time: ' . $timeText . '.', 1, 2); + Console::output('Total time: ' . $timeText . '.', 1, 2); // Send Notifications $this->sendNotification(self::$failedTasks > 0 ? false : true); @@ -251,10 +251,10 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment } if (count($tasksToRun) == 0) { - Console::output('No ' . $title . ' tasks defined.', 1, 3); + Console::output('No ' . $title . ' tasks defined.', 1, 3); } else { - Console::output('Starting ' . $title . ' tasks:'); + Console::output('Starting ' . $title . ' tasks:'); $tasks = 0; $completedTasks = 0; @@ -276,7 +276,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $tasksColor = 'red'; } - Console::output('Finished ' . $title . ' tasks: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); + Console::output('Finished ' . $title . ' tasks: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } } @@ -292,7 +292,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment self::$failedTasks = 0; if ($this->hostsCount == 0) { - Console::output('Warning! No hosts defined, skipping deployment tasks.', 1, 3); + Console::output('Warning! No hosts defined, skipping deployment tasks.', 1, 3); } else { $this->startTimeHosts = time(); @@ -313,7 +313,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $tasks = 0; $completedTasks = 0; - Console::output('Deploying to ' . $this->getConfig()->getHost() . ''); + Console::output('Deploying to ' . $this->getConfig()->getHost() . ''); $tasksToRun = $this->getConfig()->getTasks(); @@ -322,8 +322,8 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment array_unshift($tasksToRun, $deployStrategy); if (count($tasksToRun) == 0) { - Console::output('Warning! No Deployment tasks defined.', 2); - Console::output('Deployment to ' . $host . ' skipped!', 1, 3); + Console::output('Warning! No Deployment tasks defined.', 2); + Console::output('Deployment to ' . $host . ' skipped!', 1, 3); } else { foreach ($tasksToRun as $taskData) { @@ -343,7 +343,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $tasksColor = 'red'; } - Console::output('Deployment to ' . $this->getConfig()->getHost() . ' completed: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); + Console::output('Deployment to ' . $this->getConfig()->getHost() . ' completed: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } // Reset Host Config @@ -360,7 +360,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment // Releasing if (self::$deployStatus == self::SUCCEDED && $this->getConfig()->release('enabled', false) === true) { // Execute the Releases - Console::output('Starting the Releasing'); + Console::output('Starting the Releasing'); $completedTasks = 0; foreach ($hosts as $hostKey => $host) { @@ -384,7 +384,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment // Reset Host Config $this->getConfig()->setHostConfig(null); } - Console::output('Finished the Releasing', 1, 3); + Console::output('Finished the Releasing', 1, 3); // Execute the Post-Release Tasks foreach ($hosts as $hostKey => $host) { @@ -405,7 +405,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $completedTasks = 0; if (count($tasksToRun) > 0) { - Console::output('Starting Post-Release tasks for ' . $host . ':'); + Console::output('Starting Post-Release tasks for ' . $host . ':'); foreach ($tasksToRun as $task) { $task = Factory::get($task, $this->getConfig(), false, AbstractTask::STAGE_POST_RELEASE); @@ -420,7 +420,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment } else { $tasksColor = 'red'; } - Console::output('Finished Post-Release tasks for ' . $host . ': <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); + Console::output('Finished Post-Release tasks for ' . $host . ': <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } // Reset Host Config @@ -435,7 +435,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $hosts = $this->getConfig()->getHosts(); if (count($hosts) == 0) { - Console::output('Warning! No hosts defined, unable to get releases.', 1, 3); + Console::output('Warning! No hosts defined, unable to get releases.', 1, 3); } else { $result = true; diff --git a/Mage/Command/BuiltIn/InitCommand.php b/Mage/Command/BuiltIn/InitCommand.php index f996335..90d665f 100644 --- a/Mage/Command/BuiltIn/InitCommand.php +++ b/Mage/Command/BuiltIn/InitCommand.php @@ -30,11 +30,11 @@ class InitCommand extends AbstractCommand $exitCode = 50; $configDir = getcwd() . '/.mage'; - Console::output('Initiating managing process for application with Magallanes'); + Console::output('Initiating managing process for application with Magallanes'); // Check if there is already a config dir if (file_exists($configDir)) { - Console::output('Error!! Already exists .mage directory.', 1, 2); + Console::output('Error!! Already exists .mage directory.', 1, 2); } else { $results = array(); $results[] = mkdir($configDir); @@ -48,8 +48,8 @@ class InitCommand extends AbstractCommand $results[] = file_put_contents($configDir . '/config/general.yml', $this->getGeneralConfig()); if (!in_array(false, $results)) { - Console::output('Success!! The configuration for Magallanes has been generated at .mage directory.'); - Console::output('Please!! Review and adjust the configuration.', 2, 2); + Console::output('Success!! The configuration for Magallanes has been generated at .mage directory.'); + Console::output('Please!! Review and adjust the configuration.', 2, 2); $exitCode = 0; } else { diff --git a/Mage/Command/BuiltIn/InstallCommand.php b/Mage/Command/BuiltIn/InstallCommand.php index 932b3c0..4271d43 100644 --- a/Mage/Command/BuiltIn/InstallCommand.php +++ b/Mage/Command/BuiltIn/InstallCommand.php @@ -27,7 +27,7 @@ class InstallCommand extends AbstractCommand public function run() { $exitCode = 88; - Console::output('Installing Magallanes... ', 1, 0); + Console::output('Installing Magallanes... ', 1, 0); // Vars $installDir = $this->getConfig()->getParameter('installDir', '/opt/magallanes'); diff --git a/Mage/Command/BuiltIn/ListCommand.php b/Mage/Command/BuiltIn/ListCommand.php index 8c3561a..0d27862 100644 --- a/Mage/Command/BuiltIn/ListCommand.php +++ b/Mage/Command/BuiltIn/ListCommand.php @@ -67,7 +67,7 @@ class ListCommand extends AbstractCommand sort($environments); if (count($environments) > 0) { - Console::output('These are your configured environments:', 1, 1); + Console::output('These are your configured environments:', 1, 1); foreach ($environments as $environment) { Console::output('* ' . $environment . '', 2, 1); } @@ -75,7 +75,7 @@ class ListCommand extends AbstractCommand $exitCode = 0; } else { - Console::output('You don\'t have any environment configured.', 1, 2); + Console::output('You don\'t have any environment configured.', 1, 2); } return $exitCode; diff --git a/Mage/Command/BuiltIn/ReleasesCommand.php b/Mage/Command/BuiltIn/ReleasesCommand.php index be8b502..3a40439 100644 --- a/Mage/Command/BuiltIn/ReleasesCommand.php +++ b/Mage/Command/BuiltIn/ReleasesCommand.php @@ -36,7 +36,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment if (count($hosts) == 0) { Console::output( - 'Warning! No hosts defined, unable to get releases.', + 'Warning! No hosts defined, unable to get releases.', 1, 3 ); diff --git a/Mage/Command/BuiltIn/RollbackCommand.php b/Mage/Command/BuiltIn/RollbackCommand.php index 12a8f4e..8d85ac8 100644 --- a/Mage/Command/BuiltIn/RollbackCommand.php +++ b/Mage/Command/BuiltIn/RollbackCommand.php @@ -47,7 +47,7 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment $hosts = $this->getConfig()->getHosts(); if (count($hosts) == 0) { - Console::output('Warning! No hosts defined, unable to get releases.', 1, 3); + Console::output('Warning! No hosts defined, unable to get releases.', 1, 3); } else { $result = true; diff --git a/Mage/Command/BuiltIn/UpgradeCommand.php b/Mage/Command/BuiltIn/UpgradeCommand.php index 7e5aae0..94fe6e0 100644 --- a/Mage/Command/BuiltIn/UpgradeCommand.php +++ b/Mage/Command/BuiltIn/UpgradeCommand.php @@ -39,7 +39,7 @@ class UpgradeCommand extends AbstractCommand public function run() { $exitCode = 99; - Console::output('Upgrading Magallanes ... ', 1, 0); + Console::output('Upgrading Magallanes ... ', 1, 0); $user = ''; // Check if user is root @@ -49,7 +49,7 @@ class UpgradeCommand extends AbstractCommand if ($user != 'root' && $user != $owner) { Console::output('FAIL', 0, 1); - Console::output('You need to be the ' . $owner . ' user to perform the upgrade, or root.', 2); + Console::output('You need to be the ' . $owner . ' user to perform the upgrade, or root.', 2); } else { // Check version diff --git a/Mage/Command/BuiltIn/VersionCommand.php b/Mage/Command/BuiltIn/VersionCommand.php index 8437242..0c7938c 100644 --- a/Mage/Command/BuiltIn/VersionCommand.php +++ b/Mage/Command/BuiltIn/VersionCommand.php @@ -26,7 +26,7 @@ class VersionCommand extends AbstractCommand */ public function run() { - Console::output('Running Magallanes version ' . MAGALLANES_VERSION . '', 0, 2); + Console::output('Running Magallanes version ' . MAGALLANES_VERSION . '', 0, 2); return 0; } diff --git a/Mage/Console.php b/Mage/Console.php index 9cb04a0..b9dd97c 100644 --- a/Mage/Console.php +++ b/Mage/Console.php @@ -115,7 +115,7 @@ class Console } else { self::output('Starting Magallanes', 0, 1); self::log("Logging enabled"); - self::output('Logging enabled: ' . self::getLogFile() . '', 1, 2); + self::output('Logging enabled: ' . self::getLogFile() . '', 1, 2); } } diff --git a/Mage/Console/Colors.php b/Mage/Console/Colors.php index 84bfb62..5ab48bc 100644 --- a/Mage/Console/Colors.php +++ b/Mage/Console/Colors.php @@ -25,7 +25,7 @@ class Colors */ private static $foregroundColors = array( 'black' => '0;30', - 'dark_gray' => '1;30', + 'bold' => '1', 'blue' => '0;34', 'light_blue' => '1;34', 'green' => '0;32', diff --git a/Mage/Task/BuiltIn/Releases/ListTask.php b/Mage/Task/BuiltIn/Releases/ListTask.php index 0774351..ffbd2c4 100644 --- a/Mage/Task/BuiltIn/Releases/ListTask.php +++ b/Mage/Task/BuiltIn/Releases/ListTask.php @@ -38,7 +38,7 @@ class ListTask extends AbstractTask implements IsReleaseAware $releasesDirectory = $this->getConfig()->release('directory', 'releases'); $symlink = $this->getConfig()->release('symlink', 'current'); - Console::output('Releases available on ' . $this->getConfig()->getHost() . ''); + Console::output('Releases available on ' . $this->getConfig()->getHost() . ''); // Get Releases $output = ''; @@ -51,7 +51,7 @@ class ListTask extends AbstractTask implements IsReleaseAware $currentRelease = trim(array_pop($currentRelease)); if (count($releases) == 0) { - Console::output('No releases available ... ', 2); + Console::output('No releases available ... ', 2); } else { rsort($releases); $releases = array_slice($releases, 0, 10); @@ -80,8 +80,8 @@ class ListTask extends AbstractTask implements IsReleaseAware Console::output( 'Release: ' . $release . ' ' - . '- Date: ' . $releaseDate . ' ' - . '- Index: ' . $releaseIndex . '' . $dateDiff . $isCurrent, 2); + . '- Date: ' . $releaseDate . ' ' + . '- Index: ' . $releaseIndex . '' . $dateDiff . $isCurrent, 2); } } diff --git a/Mage/Task/BuiltIn/Releases/RollbackTask.php b/Mage/Task/BuiltIn/Releases/RollbackTask.php index a8ebb9c..7a437fd 100644 --- a/Mage/Task/BuiltIn/Releases/RollbackTask.php +++ b/Mage/Task/BuiltIn/Releases/RollbackTask.php @@ -56,7 +56,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware $releases = ($output == '') ? array() : explode(PHP_EOL, $output); if (count($releases) == 0) { - Console::output('Release are not available for ' . $this->getConfig()->getHost() . ' ... FAIL'); + Console::output('Release are not available for ' . $this->getConfig()->getHost() . ' ... FAIL'); } else { rsort($releases); @@ -81,10 +81,10 @@ class RollbackTask extends AbstractTask implements IsReleaseAware } if (!$releaseIsAvailable) { - Console::output('Release ' . $this->getReleaseId() . ' is invalid or unavailable for ' . $this->getConfig()->getHost() . ' ... FAIL'); + Console::output('Release ' . $this->getReleaseId() . ' is invalid or unavailable for ' . $this->getConfig()->getHost() . ' ... FAIL'); } else { - Console::output('Rollback release on ' . $this->getConfig()->getHost() . ''); + Console::output('Rollback release on ' . $this->getConfig()->getHost() . ''); $rollbackTo = $releasesDirectory . '/' . $releaseId; // Get Current Release @@ -178,7 +178,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware $tasksColor = 'red'; } - Console::output('Release rollback on ' . $this->getConfig()->getHost() . ' compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); + Console::output('Release rollback on ' . $this->getConfig()->getHost() . ' compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . ' tasks done.', 1, 3); } }