Browse Source

Related to #130

1.0
Andrés Montañez 10 years ago
parent
commit
40e8c33846
  1. 2
      Mage/Command/BuiltIn/CompileCommand.php
  2. 6
      Mage/Command/BuiltIn/DeployCommand.php
  3. 4
      Mage/Command/BuiltIn/ListCommand.php
  4. 8
      Mage/Command/BuiltIn/ReleasesCommand.php
  5. 6
      Mage/Command/BuiltIn/RollbackCommand.php
  6. 2
      Mage/Command/BuiltIn/UpgradeCommand.php
  7. 2
      bin/mage

2
Mage/Command/BuiltIn/CompileCommand.php

@ -28,7 +28,7 @@ class CompileCommand extends AbstractCommand
{ {
if (ini_get('phar.readonly')) { if (ini_get('phar.readonly')) {
Console::output('The <purple>php.ini</purple> variable <light_red>phar.readonly</light_red> must be <yellow>Off</yellow>.', 1, 2); Console::output('The <purple>php.ini</purple> variable <light_red>phar.readonly</light_red> must be <yellow>Off</yellow>.', 1, 2);
return 300; return 200;
} }
$compiler = new Compiler; $compiler = new Compiler;

6
Mage/Command/BuiltIn/DeployCommand.php

@ -111,20 +111,20 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
*/ */
public function run() public function run()
{ {
$exitCode = 1000; $exitCode = 240;
// Check if Environment is not Locked // Check if Environment is not Locked
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock'; $lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) { if (file_exists($lockFile)) {
Console::output('<red>This environment is locked!</red>', 1, 2); Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile); echo file_get_contents($lockFile);
return 1010; return 231;
} }
// Check for running instance and Lock // Check for running instance and Lock
if (file_exists(getcwd() . '/.mage/~working.lock')) { if (file_exists(getcwd() . '/.mage/~working.lock')) {
Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2); Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2);
return 1020; return 230;
} else { } else {
touch(getcwd() . '/.mage/~working.lock'); touch(getcwd() . '/.mage/~working.lock');
} }

4
Mage/Command/BuiltIn/ListCommand.php

@ -31,7 +31,7 @@ class ListCommand extends AbstractCommand
*/ */
public function run() public function run()
{ {
$exitCode = 600; $exitCode = 221;
$subCommand = $this->getConfig()->getArgument(1); $subCommand = $this->getConfig()->getArgument(1);
try { try {
@ -56,7 +56,7 @@ class ListCommand extends AbstractCommand
*/ */
protected function listEnvironments() protected function listEnvironments()
{ {
$exitCode = 600; $exitCode = 220;
$environments = array(); $environments = array();
$content = scandir(getcwd() . '/.mage/config/environment/'); $content = scandir(getcwd() . '/.mage/config/environment/');
foreach ($content as $file) { foreach ($content as $file) {

8
Mage/Command/BuiltIn/ReleasesCommand.php

@ -28,7 +28,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
*/ */
public function run() public function run()
{ {
$exitCode = 400; $exitCode = 100;
$subCommand = $this->getConfig()->getArgument(1); $subCommand = $this->getConfig()->getArgument(1);
// Run Tasks for Deployment // Run Tasks for Deployment
@ -40,7 +40,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
1, 3 1, 3
); );
return 401; return 101;
} }
$result = true; $result = true;
@ -67,7 +67,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
if (!is_numeric($this->getConfig()->getParameter('release', ''))) { if (!is_numeric($this->getConfig()->getParameter('release', ''))) {
Console::output('<red>Missing required releaseid.</red>', 1, 2); Console::output('<red>Missing required releaseid.</red>', 1, 2);
return 410; return 102;
} }
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock'; $lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
@ -75,7 +75,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
Console::output('<red>This environment is locked!</red>', 1, 2); Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile); echo file_get_contents($lockFile);
return 420; return 103;
} }
$releaseId = $this->getConfig()->getParameter('release', ''); $releaseId = $this->getConfig()->getParameter('release', '');

6
Mage/Command/BuiltIn/RollbackCommand.php

@ -28,19 +28,19 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
*/ */
public function run() public function run()
{ {
$exitCode = 450; $exitCode = 105;
$releaseId = $this->getConfig()->getArgument(1); $releaseId = $this->getConfig()->getArgument(1);
if (!is_numeric($releaseId)) { if (!is_numeric($releaseId)) {
Console::output('<red>This release is mandatory.</red>', 1, 2); Console::output('<red>This release is mandatory.</red>', 1, 2);
return 451; return 104;
} }
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock'; $lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) { if (file_exists($lockFile)) {
Console::output('<red>This environment is locked!</red>', 1, 2); Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile); echo file_get_contents($lockFile);
return 20; return 106;
} }
// Run Tasks for Deployment // Run Tasks for Deployment

2
Mage/Command/BuiltIn/UpgradeCommand.php

@ -38,7 +38,7 @@ class UpgradeCommand extends AbstractCommand
*/ */
public function run() public function run()
{ {
$exitCode = 100; $exitCode = 99;
Console::output('Upgrading <dark_gray>Magallanes</dark_gray> ... ', 1, 0); Console::output('Upgrading <dark_gray>Magallanes</dark_gray> ... ', 1, 0);
$user = ''; $user = '';

2
bin/mage

@ -32,4 +32,4 @@ array_shift($argv);
$console = new Mage\Console; $console = new Mage\Console;
$exitCode = $console->run($argv); $exitCode = $console->run($argv);
exit($exitCode); exit((integer) $exitCode);

Loading…
Cancel
Save