mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-13 20:50:18 +02:00
Verify if environment is defined. Verify that rollback has release point.
This commit is contained in:
parent
7d8bf35df4
commit
d63ca9cc04
@ -23,7 +23,13 @@ class Mage_Config
|
|||||||
. '/' . md5(microtime()) . '/';
|
. '/' . md5(microtime()) . '/';
|
||||||
$this->_environment['deployment']['source']['temporal'] = $newTemporal;
|
$this->_environment['deployment']['source']['temporal'] = $newTemporal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else if (($environment != '') && !file_exists('.mage/config/environment/' . $environment . '.yml')) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadSCM()
|
public function loadSCM()
|
||||||
|
@ -125,7 +125,7 @@ class Mage_Console
|
|||||||
// Load Config
|
// Load Config
|
||||||
$config = new Mage_Config;
|
$config = new Mage_Config;
|
||||||
$config->loadGeneral();
|
$config->loadGeneral();
|
||||||
$config->loadEnvironment($this->getEnvironment());
|
$environmentOk = $config->loadEnvironment($this->getEnvironment());
|
||||||
$config->loadSCM();
|
$config->loadSCM();
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
@ -142,6 +142,10 @@ class Mage_Console
|
|||||||
Mage_Console::output('Starting <blue>Magallanes</blue>', 0, 2);
|
Mage_Console::output('Starting <blue>Magallanes</blue>', 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$environmentOk) {
|
||||||
|
Mage_Console::output('<red>You have selected an invalid environment</red>', 0, 2);
|
||||||
|
|
||||||
|
} else {
|
||||||
switch ($this->getAction()) {
|
switch ($this->getAction()) {
|
||||||
case 'deploy':
|
case 'deploy':
|
||||||
$task = new Mage_Task_Deploy;
|
$task = new Mage_Task_Deploy;
|
||||||
@ -150,12 +154,21 @@ class Mage_Console
|
|||||||
|
|
||||||
case 'releases':
|
case 'releases':
|
||||||
$task = new Mage_Task_Releases;
|
$task = new Mage_Task_Releases;
|
||||||
|
if (!isset($this->_args[1])) {
|
||||||
|
Mage_Console::output('<red>You must indicate a task</red>', 0, 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch ($this->_args[1]) {
|
switch ($this->_args[1]) {
|
||||||
case 'list':
|
case 'list':
|
||||||
$task->setAction($this->_args[1]);
|
$task->setAction($this->_args[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'rollback':
|
case 'rollback':
|
||||||
|
if (!isset($this->_args[2])) {
|
||||||
|
Mage_Console::output('<red>You must indicate a release point</red>', 0, 2);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
|
||||||
$task->setAction($this->_args[1]);
|
$task->setAction($this->_args[1]);
|
||||||
$task->setRelease($this->_args[2]);
|
$task->setRelease($this->_args[2]);
|
||||||
break;
|
break;
|
||||||
@ -211,6 +224,7 @@ class Mage_Console
|
|||||||
Mage_Console::output('<red>Invalid action</red>', 0, 2);
|
Mage_Console::output('<red>Invalid action</red>', 0, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($showGrettings) {
|
if ($showGrettings) {
|
||||||
Mage_Console::output('Finished <blue>Magallanes</blue>', 0, 2);
|
Mage_Console::output('Finished <blue>Magallanes</blue>', 0, 2);
|
||||||
|
@ -18,6 +18,11 @@ class Mage_Task_Deploy
|
|||||||
$this->_startTime = time();
|
$this->_startTime = time();
|
||||||
$this->_config = $config;
|
$this->_config = $config;
|
||||||
|
|
||||||
|
if ($config->getEnvironment() == '') {
|
||||||
|
Mage_Console::output('<red>You must specify an environment</red>', 0, 2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Run Pre-Deployment Tasks
|
// Run Pre-Deployment Tasks
|
||||||
$this->_runNonDeploymentTasks('pre-deploy', $config, 'Pre-Deployment');
|
$this->_runNonDeploymentTasks('pre-deploy', $config, 'Pre-Deployment');
|
||||||
|
|
||||||
|
@ -31,6 +31,11 @@ class Mage_Task_Releases
|
|||||||
{
|
{
|
||||||
$this->_config = $config;
|
$this->_config = $config;
|
||||||
|
|
||||||
|
if ($config->getEnvironment() == '') {
|
||||||
|
Mage_Console::output('<red>You must specify an environment</red>', 0, 2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Run Tasks for Deployment
|
// Run Tasks for Deployment
|
||||||
$hosts = $config->getHosts();
|
$hosts = $config->getHosts();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user