mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-08 16:52:15 +02:00
Add environment with releases.
This commit is contained in:
parent
a04daec14e
commit
f21f63456a
|
@ -153,8 +153,14 @@ class Mage_Console
|
||||||
case 'add';
|
case 'add';
|
||||||
switch ($this->_args[1]) {
|
switch ($this->_args[1]) {
|
||||||
case 'environment':
|
case 'environment':
|
||||||
|
if (isset($this->_args[3]) && ($this->_args[3] == '--with-releases')) {
|
||||||
|
$withRelases = true;
|
||||||
|
} else {
|
||||||
|
$withRelases = false;
|
||||||
|
}
|
||||||
|
|
||||||
$task = new Mage_Task_Add;
|
$task = new Mage_Task_Add;
|
||||||
$task->environment($this->_args[2]);
|
$task->environment($this->_args[2], $withRelases);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class Mage_Task_Add
|
class Mage_Task_Add
|
||||||
{
|
{
|
||||||
public function environment($environmentName)
|
public function environment($environmentName, $withRelases = false)
|
||||||
{
|
{
|
||||||
$environmentName = strtolower($environmentName);
|
$environmentName = strtolower($environmentName);
|
||||||
$environmentConfigFile = '.mage/config/environment/' . $environmentName . '.yaml';
|
$environmentConfigFile = '.mage/config/environment/' . $environmentName . '.yaml';
|
||||||
|
@ -12,12 +12,18 @@ class Mage_Task_Add
|
||||||
if (file_exists($environmentConfigFile)) {
|
if (file_exists($environmentConfigFile)) {
|
||||||
Mage_Console::output('<light_red>Error!!</light_red> Already exists an environment called <dark_gray>' . $environmentName . '</dark_gray>', 1, 2);
|
Mage_Console::output('<light_red>Error!!</light_red> Already exists an environment called <dark_gray>' . $environmentName . '</dark_gray>', 1, 2);
|
||||||
} else {
|
} else {
|
||||||
|
$releasesConfig = 'releases:' . PHP_EOL
|
||||||
|
. ' enabled: true' . PHP_EOL
|
||||||
|
. ' symlink: current' . PHP_EOL
|
||||||
|
. ' directory: releases' . PHP_EOL;
|
||||||
|
|
||||||
$baseConfig = '#' . $environmentName . PHP_EOL
|
$baseConfig = '#' . $environmentName . PHP_EOL
|
||||||
. 'deployment:'
|
. 'deployment:' . PHP_EOL
|
||||||
. ' user: dummy' . PHP_EOL
|
. ' user: dummy' . PHP_EOL
|
||||||
. ' from: ./' . PHP_EOL
|
. ' from: ./' . PHP_EOL
|
||||||
. ' to: /var/www/vhosts/example.com/www' . PHP_EOL
|
. ' to: /var/www/vhosts/example.com/www' . PHP_EOL
|
||||||
. ' excludes:' . PHP_EOL
|
. ' excludes:' . PHP_EOL
|
||||||
|
. ($withRelases ? $releasesConfig : '')
|
||||||
. 'hosts:' . PHP_EOL
|
. 'hosts:' . PHP_EOL
|
||||||
. 'tasks:'
|
. 'tasks:'
|
||||||
. ' pre-deploy:' . PHP_EOL
|
. ' pre-deploy:' . PHP_EOL
|
||||||
|
|
|
@ -9,7 +9,6 @@ releases:
|
||||||
enabled: true
|
enabled: true
|
||||||
symlink: current
|
symlink: current
|
||||||
directory: releases
|
directory: releases
|
||||||
tasks:
|
|
||||||
hosts:
|
hosts:
|
||||||
- s01.example.com
|
- s01.example.com
|
||||||
- s02.example.com
|
- s02.example.com
|
||||||
|
|
Loading…
Reference in a new issue