diff --git a/.gitignore b/.gitignore
index 5dc363a..a147ed3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,9 @@
-.settings
-.settings/*
-.project
-.buildpath
-.idea
vendor
+mage.phar
# OS generated files # // GitHub Recommendation
######################
.DS_Store*
ehthumbs.db
Icon?
-Thumbs.db
\ No newline at end of file
+Thumbs.db
diff --git a/LICENSE b/LICENSE
index ccdd780..78cd384 100644
--- a/LICENSE
+++ b/LICENSE
@@ -24,4 +24,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------
The Yaml Library Parser is (c) by Fabien Potencier, and belongs to the Symfony Proyect
---------
\ No newline at end of file
+--------
diff --git a/LICENSE_YAML b/LICENSE_YAML
index 4acdf9d..0b3292c 100644
--- a/LICENSE_YAML
+++ b/LICENSE_YAML
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
+THE SOFTWARE.
diff --git a/Mage/Command/AbstractCommand.php b/Mage/Command/AbstractCommand.php
index b513517..3ed5a9d 100644
--- a/Mage/Command/AbstractCommand.php
+++ b/Mage/Command/AbstractCommand.php
@@ -52,4 +52,4 @@ abstract class AbstractCommand
{
return $this->config;
}
-}
\ No newline at end of file
+}
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/CompileCommand.php b/Mage/Command/BuiltIn/CompileCommand.php
index f67e875..9cd94b6 100644
--- a/Mage/Command/BuiltIn/CompileCommand.php
+++ b/Mage/Command/BuiltIn/CompileCommand.php
@@ -28,7 +28,7 @@ class CompileCommand extends AbstractCommand
{
if (ini_get('phar.readonly')) {
Console::output('The php.ini variable phar.readonly must be Off.', 1, 2);
- return 300;
+ return 200;
}
$compiler = new Compiler;
diff --git a/Mage/Command/BuiltIn/DeployCommand.php b/Mage/Command/BuiltIn/DeployCommand.php
index d1888b3..943a630 100644
--- a/Mage/Command/BuiltIn/DeployCommand.php
+++ b/Mage/Command/BuiltIn/DeployCommand.php
@@ -3,6 +3,7 @@
* This file is part of the Magallanes package.
*
* (c) Andrés Montañez
+* (c) Alex V Kotelnikov
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -16,6 +17,7 @@ use Mage\Task\Factory;
use Mage\Task\AbstractTask;
use Mage\Task\Releases\SkipOnOverride;
use Mage\Task\ErrorWithMessageException;
+use Mage\Task\RollbackException;
use Mage\Task\SkipException;
use Mage\Console;
use Mage\Config;
@@ -109,20 +111,20 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
*/
public function run()
{
- $exitCode = 1000;
+ $exitCode = 240;
// Check if Environment is not Locked
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) {
Console::output('This environment is locked!', 1, 2);
echo file_get_contents($lockFile);
- return 1010;
+ return 231;
}
// Check for running instance and Lock
if (file_exists(getcwd() . '/.mage/~working.lock')) {
Console::output('There is already an instance of Magallanes running!', 1, 2);
- return 1020;
+ return 230;
} else {
touch(getcwd() . '/.mage/~working.lock');
}
@@ -131,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);
}
}
@@ -160,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
@@ -169,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
@@ -179,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);
@@ -249,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;
@@ -274,7 +276,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
$tasksColor = 'red';
}
- Console::output('Finished ' . $title . ' tasks: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
+ Console::output('Finished ' . $title . ' tasks: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
}
}
@@ -290,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();
@@ -311,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();
@@ -320,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) {
@@ -341,7 +343,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
$tasksColor = 'red';
}
- Console::output('Deployment to ' . $this->getConfig()->getHost() . ' completed: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
+ Console::output('Deployment to ' . $this->getConfig()->getHost() . ' completed: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
}
// Reset Host Config
@@ -356,9 +358,9 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
}
// Releasing
- if (self::$deployStatus == self::SUCCEDED && $this->getConfig()->release('enabled', false) == true) {
+ 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) {
@@ -382,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) {
@@ -403,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);
@@ -418,7 +420,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
} else {
$tasksColor = 'red';
}
- Console::output('Finished Post-Release tasks for ' . $host . ': <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
+ Console::output('Finished Post-Release tasks for ' . $host . ': <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
}
// Reset Host Config
@@ -428,6 +430,28 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
}
}
+ protected function runRollbackTask(){
+ $this->getConfig()->reload();
+ $hosts = $this->getConfig()->getHosts();
+
+ if (count($hosts) == 0) {
+ Console::output('Warning! No hosts defined, unable to get releases.', 1, 3);
+
+ } else {
+ $result = true;
+ foreach ($hosts as $host) {
+ $this->getConfig()->setHost($host);
+
+ $this->getConfig()->setReleaseId(-1);
+ $task = Factory::get('releases/rollback', $this->getConfig());
+ $task->init();
+ $result = $task->run() && $result;
+ }
+ return $result;
+ }
+ return false;
+ }
+
/**
* Runs a Task
*
@@ -439,7 +463,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
{
$task->init();
- if ($title == null) {
+ if ($title === null) {
$title = 'Running ' . $task->getName() . ' ... ';
}
Console::output($title, 2, 0);
@@ -449,11 +473,11 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
$runTask = false;
}
- if ($runTask == true) {
+ if ($runTask === true) {
try {
$result = $task->run();
- if ($result == true) {
+ if ($result === true) {
Console::output('OK', 0);
$result = true;
@@ -461,6 +485,11 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
Console::output('FAIL', 0);
$result = false;
}
+ } catch (RollbackException $e) {
+ Console::output('FAIL, Rollback started [Message: ' . $e->getMessage() . ']', 0);
+ $this->runRollbackTask();
+ $result = false;
+
} catch (ErrorWithMessageException $e) {
Console::output('FAIL [Message: ' . $e->getMessage() . ']', 0);
$result = false;
@@ -564,7 +593,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
case self::DEPLOY_STRATEGY_GUESS:
default:
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$deployStrategy = 'deployment/strategy/tar-gz';
} else {
$deployStrategy = 'deployment/strategy/rsync';
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 47a8411..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');
@@ -122,4 +122,4 @@ class InstallCommand extends AbstractCommand
return false;
}
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Command/BuiltIn/ListCommand.php b/Mage/Command/BuiltIn/ListCommand.php
index 48e89bf..0d27862 100644
--- a/Mage/Command/BuiltIn/ListCommand.php
+++ b/Mage/Command/BuiltIn/ListCommand.php
@@ -31,7 +31,7 @@ class ListCommand extends AbstractCommand
*/
public function run()
{
- $exitCode = 600;
+ $exitCode = 221;
$subCommand = $this->getConfig()->getArgument(1);
try {
@@ -56,7 +56,7 @@ class ListCommand extends AbstractCommand
*/
protected function listEnvironments()
{
- $exitCode = 600;
+ $exitCode = 220;
$environments = array();
$content = scandir(getcwd() . '/.mage/config/environment/');
foreach ($content as $file) {
@@ -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 2837903..3a40439 100644
--- a/Mage/Command/BuiltIn/ReleasesCommand.php
+++ b/Mage/Command/BuiltIn/ReleasesCommand.php
@@ -28,7 +28,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
*/
public function run()
{
- $exitCode = 400;
+ $exitCode = 100;
$subCommand = $this->getConfig()->getArgument(1);
// Run Tasks for Deployment
@@ -36,16 +36,25 @@ 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
);
- return 401;
+ return 101;
}
$result = true;
- foreach ($hosts as $host) {
+ foreach ($hosts as $hostKey => $host) {
+ // Check if Host has specific configuration
+ $hostConfig = null;
+ if (is_array($host)) {
+ $hostConfig = $host;
+ $host = $hostKey;
+ }
+
+ // Set Host and Host Specific Config
$this->getConfig()->setHost($host);
+ $this->getConfig()->setHostConfig($hostConfig);
switch ($subCommand) {
case 'list':
@@ -58,7 +67,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
if (!is_numeric($this->getConfig()->getParameter('release', ''))) {
Console::output('Missing required releaseid.', 1, 2);
- return 410;
+ return 102;
}
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
@@ -66,7 +75,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
Console::output('This environment is locked!', 1, 2);
echo file_get_contents($lockFile);
- return 420;
+ return 103;
}
$releaseId = $this->getConfig()->getParameter('release', '');
diff --git a/Mage/Command/BuiltIn/RollbackCommand.php b/Mage/Command/BuiltIn/RollbackCommand.php
index 7a5b85b..8d85ac8 100644
--- a/Mage/Command/BuiltIn/RollbackCommand.php
+++ b/Mage/Command/BuiltIn/RollbackCommand.php
@@ -28,31 +28,40 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
*/
public function run()
{
- $exitCode = 450;
+ $exitCode = 105;
$releaseId = $this->getConfig()->getArgument(1);
if (!is_numeric($releaseId)) {
Console::output('This release is mandatory.', 1, 2);
- return 451;
+ return 104;
}
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) {
Console::output('This environment is locked!', 1, 2);
echo file_get_contents($lockFile);
- return 20;
+ return 106;
}
// Run Tasks for Deployment
$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;
- foreach ($hosts as $host) {
+ foreach ($hosts as $hostKey => $host) {
+ // Check if Host has specific configuration
+ $hostConfig = null;
+ if (is_array($host)) {
+ $hostConfig = $host;
+ $host = $hostKey;
+ }
+
+ // Set Host and Host Specific Config
$this->getConfig()->setHost($host);
+ $this->getConfig()->setHostConfig($hostConfig);
$this->getConfig()->setReleaseId($releaseId);
$task = Factory::get('releases/rollback', $this->getConfig());
diff --git a/Mage/Command/BuiltIn/UpdateCommand.php b/Mage/Command/BuiltIn/UpdateCommand.php
index 9cba1cb..14dc75a 100644
--- a/Mage/Command/BuiltIn/UpdateCommand.php
+++ b/Mage/Command/BuiltIn/UpdateCommand.php
@@ -35,7 +35,7 @@ class UpdateCommand extends AbstractCommand
Console::output('Updating application via ' . $task->getName() . ' ... ', 1, 0);
$result = $task->run();
- if ($result == true) {
+ if ($result === true) {
Console::output('OK' . PHP_EOL, 0);
$exitCode = 0;
@@ -45,5 +45,4 @@ class UpdateCommand extends AbstractCommand
return $exitCode;
}
-
-}
\ No newline at end of file
+}
diff --git a/Mage/Command/BuiltIn/UpgradeCommand.php b/Mage/Command/BuiltIn/UpgradeCommand.php
index 5de6a2d..94fe6e0 100644
--- a/Mage/Command/BuiltIn/UpgradeCommand.php
+++ b/Mage/Command/BuiltIn/UpgradeCommand.php
@@ -38,8 +38,8 @@ class UpgradeCommand extends AbstractCommand
*/
public function run()
{
- $exitCode = 100;
- Console::output('Upgrading Magallanes ... ', 1, 0);
+ $exitCode = 99;
+ 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 ca591d7..0c7938c 100644
--- a/Mage/Command/BuiltIn/VersionCommand.php
+++ b/Mage/Command/BuiltIn/VersionCommand.php
@@ -26,9 +26,8 @@ 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;
}
-
-}
\ No newline at end of file
+}
diff --git a/Mage/Command/Factory.php b/Mage/Command/Factory.php
index 0584046..4088239 100644
--- a/Mage/Command/Factory.php
+++ b/Mage/Command/Factory.php
@@ -12,7 +12,6 @@ namespace Mage\Command;
use Mage\Command\AbstractCommand;
use Mage\Config;
-use Mage\Autoload;
use Exception;
@@ -59,4 +58,4 @@ class Factory
return $instance;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Command/RequiresEnvironment.php b/Mage/Command/RequiresEnvironment.php
index 5ee0771..9a0a56c 100644
--- a/Mage/Command/RequiresEnvironment.php
+++ b/Mage/Command/RequiresEnvironment.php
@@ -17,4 +17,4 @@ namespace Mage\Command;
*/
interface RequiresEnvironment
{
-}
\ No newline at end of file
+}
diff --git a/Mage/Config.php b/Mage/Config.php
index 2991acd..e839c22 100644
--- a/Mage/Config.php
+++ b/Mage/Config.php
@@ -13,7 +13,6 @@ namespace Mage;
use Mage\Config\ConfigNotFoundException;
use Mage\Config\RequiredConfigNotFoundException;
use Mage\Console;
-use Mage\Yaml\Exception\RuntimeException;
use Mage\Yaml\Yaml;
use Exception;
@@ -121,29 +120,6 @@ class Config
return $this->parseConfigFile($filePath);
}
-
- /**
- * Obviously this method is a HACK. It was refactored from ::loadEnvironment()
- * TODO Please put it to SCM functionality.
- *
- * @param array $settings
- *
- * @return array
- */
- protected function updateSCMTempDir(array $settings)
- {
- // Create temporal directory for clone
- if (isset($settings['deployment']['source']) && is_array($settings['deployment']['source'])) {
- if (trim($settings['deployment']['source']['temporal']) == '') {
- $settings['deployment']['source']['temporal'] = sys_get_temp_dir();
- }
- $settings['deployment']['source']['temporal']
- = rtrim($settings['deployment']['source']['temporal'], '/') . '/' . md5(microtime()) . '/';
- }
-
- return $settings;
- }
-
/**
* Loads the Environment configuration
* @param $filePath string
@@ -156,9 +132,6 @@ class Config
$settings = $this->parseConfigFile($filePath);
- //this is a HACK in the old code - no time to remove it now, so I factored it out in own method
- $settings = $this->updateSCMTempDir($settings);
-
return $settings;
}
@@ -490,6 +463,11 @@ class Config
}
}
+ public function setSourceTemporal($directory)
+ {
+ $this->environmentConfig['deployment']['source']['temporal'] = $directory;
+ }
+
/**
* Returns Releasing Options
*
diff --git a/Mage/Console.php b/Mage/Console.php
index 1173354..b9dd97c 100644
--- a/Mage/Console.php
+++ b/Mage/Console.php
@@ -26,7 +26,6 @@ use SplFileInfo;
class Console
{
/**
- * TODO refactor into own static class
* @var array
*/
public static $paramsNotRequiringEnvironment = array('install' => 'install', 'upgrade' => 'upgrade', 'version' => 'version');
@@ -116,11 +115,10 @@ 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);
}
}
-
// Run Command - Check if there is a Configuration Error
if ($configError !== false) {
self::output('' . $configError . '', 1, 2);
@@ -131,12 +129,21 @@ class Console
$command = Factory::get($commandName, $config);
if ($command instanceOf RequiresEnvironment) {
- if ($config->getEnvironment() == false) {
+ if ($config->getEnvironment() === false) {
throw new Exception('You must specify an environment for this command.');
}
}
+
+ // Run the Command
$exitCode = $command->run();
+ // Check for errors
+ if (is_int($exitCode) && $exitCode !== 0) {
+ throw new Exception('Command execution failed with following exit code: ' . $exitCode, $exitCode);
+ } elseif (is_bool($exitCode) && !$exitCode) {
+ $exitCode = 1;
+ throw new Exception('Command execution failed.', $exitCode);
+ }
} catch (Exception $exception) {
self::output('' . $exception->getMessage() . '', 1, 2);
}
@@ -213,7 +220,7 @@ class Console
public static function log($message)
{
if (self::$logEnabled) {
- if (self::$log == null) {
+ if (self::$log === null) {
self::$logFile = realpath(getcwd() . '/.mage/logs') . '/log-' . date('Ymd-His') . '.log';
self::$log = fopen(self::$logFile, 'w');
}
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/Mailer.php b/Mage/Mailer.php
index e0b3443..f2fb33d 100644
--- a/Mage/Mailer.php
+++ b/Mage/Mailer.php
@@ -84,6 +84,6 @@ class Mailer
. $attachment . self::EOL
. '--Mage-mixed-' . $boundary . '--' . self::EOL;
- @mail($this->address, $subject, $message, $headers);
+ mail($this->address, $subject, $message, $headers);
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/AbstractTask.php b/Mage/Task/AbstractTask.php
index c61f87d..663b387 100644
--- a/Mage/Task/AbstractTask.php
+++ b/Mage/Task/AbstractTask.php
@@ -181,7 +181,7 @@ abstract class AbstractTask
*/
protected final function runCommandRemote($command, &$output = null, $cdToDirectoryFirst = true)
{
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
if ($this instanceOf IsReleaseAware) {
$releasesDirectory = '';
@@ -223,7 +223,7 @@ abstract class AbstractTask
*/
protected final function runCommand($command, &$output = null)
{
- if ($this->getStage() == self::STAGE_DEPLOY) {
+ if ($this->getStage() == self::STAGE_DEPLOY || $this->getStage() == self::STAGE_POST_RELEASE) {
return $this->runCommandRemote($command, $output);
} else {
return $this->runCommandLocal($command, $output);
@@ -238,7 +238,7 @@ abstract class AbstractTask
*/
protected function getReleasesAwareCommand($command)
{
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$deployToDirectory = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
diff --git a/Mage/Task/BuiltIn/Deployment/ReleaseTask.php b/Mage/Task/BuiltIn/Deployment/ReleaseTask.php
index bf42643..84187ad 100644
--- a/Mage/Task/BuiltIn/Deployment/ReleaseTask.php
+++ b/Mage/Task/BuiltIn/Deployment/ReleaseTask.php
@@ -37,7 +37,7 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
public function run()
{
$resultFetch = false;
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$symlink = $this->getConfig()->release('symlink', 'current');
@@ -107,7 +107,7 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
protected function cleanUpReleases()
{
// Count Releases
- if ($this->getConfig()->release('enabled', false) == true) {
+ 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 5affe97..9e787c7 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php
@@ -30,7 +30,7 @@ abstract class BaseStrategyTaskAbstract extends AbstractTask implements IsReleas
$overrideRelease = $this->getParameter('overrideRelease', false);
$symlink = $this->getConfig()->release('symlink', 'current');
- if ($overrideRelease == true) {
+ if ($overrideRelease === true) {
$releaseToOverride = false;
$resultFetch = $this->runCommandRemote('ls -ld ' . $symlink . ' | cut -d"/" -f2', $releaseToOverride);
if ($resultFetch && is_numeric($releaseToOverride)) {
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/DisabledTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/DisabledTask.php
index 958faef..e3255b5 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/DisabledTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/DisabledTask.php
@@ -38,5 +38,4 @@ class DisabledTask extends AbstractTask implements IsReleaseAware
{
throw new SkipException;
}
-
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/GitRebaseTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/GitRebaseTask.php
index a7e4774..b19e06e 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/GitRebaseTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/GitRebaseTask.php
@@ -10,7 +10,6 @@
namespace Mage\Task\BuiltIn\Deployment\Strategy;
-use Mage\Task\AbstractTask;
use Mage\Task\Releases\IsReleaseAware;
/**
@@ -35,20 +34,6 @@ class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
*/
public function run()
{
- $this->checkOverrideRelease();
- $excludes = $this->getExcludes();
-
- // If we are working with releases
- $deployToDirectory = $this->getConfig()->deployment('to');
- if ($this->getConfig()->release('enabled', false) == true) {
- $releasesDirectory = $this->getConfig()->release('directory', 'releases');
-
- $deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
- . '/' . $releasesDirectory
- . '/' . $this->getConfig()->getReleaseId();
- $this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
- }
-
$branch = $this->getParameter('branch', 'master');
$remote = $this->getParameter('remote', 'origin');
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/GitRemoteCacheTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/GitRemoteCacheTask.php
index 43296c3..3934e48 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/GitRemoteCacheTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/GitRemoteCacheTask.php
@@ -42,7 +42,7 @@ class GitRemoteCacheTask extends AbstractTask implements IsReleaseAware
{
$overrideRelease = $this->getParameter('overrideRelease', false);
- if ($overrideRelease == true) {
+ if ($overrideRelease === true) {
$releaseToOverride = false;
$resultFetch = $this->runCommandRemote('ls -ld current | cut -d"/" -f2', $releaseToOverride);
if ($resultFetch && is_numeric($releaseToOverride)) {
@@ -63,7 +63,7 @@ class GitRemoteCacheTask extends AbstractTask implements IsReleaseAware
$userExcludes = $this->getConfig()->deployment('excludes', array());
$deployToDirectory = $this->getConfig()->deployment('to');
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
@@ -97,39 +97,8 @@ class GitRemoteCacheTask extends AbstractTask implements IsReleaseAware
$command = 'cd ' . $remoteCacheFolder . ' && /usr/bin/env git archive ' . $branch . ' | tar -x -C ' . $deployToDirectory . ' ' . $excludeCmd;
$result = $this->runCommandRemote($command) && $result;
- // Count Releases
- if ($this->getConfig()->release('enabled', false) == true) {
- $releasesDirectory = $this->getConfig()->release('directory', 'releases');
- $symlink = $this->getConfig()->release('symlink', 'current');
-
- if (substr($symlink, 0, 1) == '/') {
- $releasesDirectory = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory;
- }
-
- $maxReleases = $this->getConfig()->release('max', false);
- if (($maxReleases !== false) && ($maxReleases > 0)) {
- $releasesList = '';
- $countReleasesFetch = $this->runCommandRemote('ls -1 ' . $releasesDirectory, $releasesList);
- $releasesList = trim($releasesList);
-
- if ($countReleasesFetch && $releasesList != '') {
- $releasesList = explode(PHP_EOL, $releasesList);
- if (count($releasesList) > $maxReleases) {
- $releasesToDelete = array_diff($releasesList, array($this->getConfig()->getReleaseId()));
- sort($releasesToDelete);
- $releasesToDeleteCount = count($releasesToDelete) - $maxReleases;
- $releasesToDelete = array_slice($releasesToDelete, 0, $releasesToDeleteCount + 1);
-
- foreach ($releasesToDelete as $releaseIdToDelete) {
- $directoryToDelete = $releasesDirectory . '/' . $releaseIdToDelete;
- if ($directoryToDelete != '/') {
- $command = 'rm -rf ' . $directoryToDelete;
- $result = $result && $this->runCommandRemote($command);
- }
- }
- }
- }
- }
+ if ($result) {
+ $this->cleanUpReleases();
}
return $result;
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
index c4c92ad..3555ce0 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
@@ -27,8 +27,8 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
*/
public function getName()
{
- if ($this->getConfig()->release('enabled', false) == true) {
- if ($this->getConfig()->getParameter('overrideRelease', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
+ if ($this->getConfig()->getParameter('overrideRelease', false) === true) {
return 'Deploy via Rsync (with Releases override) [built-in]';
} else {
$rsync_copy = $this->getConfig()->deployment("rsync");
@@ -52,10 +52,11 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$this->checkOverrideRelease();
$excludes = $this->getExcludes();
+ $excludesListFilePath = $this->getConfig()->deployment('excludes_file', '');
// If we are working with releases
$deployToDirectory = $this->getConfig()->deployment('to');
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$symlink = $this->getConfig()->release('symlink', 'current');
@@ -95,6 +96,7 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
. $strategyFlags . ' '
. '--rsh="ssh ' . $this->getConfig()->getHostIdentityFileOption() . '-p' . $this->getConfig()->getHostPort() . '" '
. $this->excludes($excludes) . ' '
+ . $this->excludesListFile($excludesListFilePath) . ' '
. $this->getConfig()->deployment('from') . ' '
. $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
$result = $this->runCommandLocal($command);
@@ -117,4 +119,18 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$excludesRsync = trim($excludesRsync);
return $excludesRsync;
}
+
+ /**
+ * Generates the Exclude from file for rsync
+ * @param string $excludesFile
+ * @return string
+ */
+ protected function excludesListFile($excludesFile)
+ {
+ $excludesListFileRsync = '';
+ if(!empty($excludesFile) && file_exists($excludesFile) && is_file($excludesFile) && is_readable($excludesFile)) {
+ $excludesListFileRsync = ' --exclude-from=' . $excludesFile;
+ }
+ return $excludesListFileRsync;
+ }
}
diff --git a/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php b/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php
index 2077eb7..d45ea17 100644
--- a/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php
+++ b/Mage/Task/BuiltIn/Deployment/Strategy/TarGzTask.php
@@ -10,7 +10,6 @@
namespace Mage\Task\BuiltIn\Deployment\Strategy;
-use Mage\Console;
use Mage\Task\BuiltIn\Deployment\Strategy\BaseStrategyTaskAbstract;
use Mage\Task\Releases\IsReleaseAware;
@@ -27,8 +26,8 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
*/
public function getName()
{
- if ($this->getConfig()->release('enabled', false) == true) {
- if ($this->getConfig()->getParameter('overrideRelease', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
+ if ($this->getConfig()->getParameter('overrideRelease', false) === true) {
return 'Deploy via TarGz (with Releases override) [built-in]';
} else {
return 'Deploy via TarGz (with Releases) [built-in]';
@@ -47,10 +46,11 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$this->checkOverrideRelease();
$excludes = $this->getExcludes();
+ $excludesListFilePath = $this->getConfig()->deployment('excludes_file', '');;
// If we are working with releases
$deployToDirectory = $this->getConfig()->deployment('to');
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
. '/' . $releasesDirectory
@@ -67,6 +67,8 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$excludeCmd .= ' --exclude=' . $excludeFile;
}
+ $excludeFromFileCmd = $this->excludesListFile($excludesListFilePath);
+
// Strategy Flags
$strategyFlags = $this->getConfig()->deployment('strategy_flags', $this->getConfig()->general('strategy_flags', array()));
if (isset($strategyFlags['targz']) && isset($strategyFlags['targz']['create'])) {
@@ -75,7 +77,7 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
$strategyFlags = '';
}
- $command = 'tar cfzh' . $strategyFlags . ' ' . $localTarGz . '.tar.gz ' . $excludeCmd . ' -C ' . $this->getConfig()->deployment('from') . ' .';
+ $command = 'tar cfzh' . $strategyFlags . ' ' . $localTarGz . '.tar.gz ' . $excludeCmd . $excludeFromFileCmd . ' -C ' . $this->getConfig()->deployment('from') . ' .';
$result = $this->runCommandLocal($command);
// Strategy Flags
@@ -113,4 +115,18 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
return $result;
}
+
+ /**
+ * Generates the Exclude from file for rsync
+ * @param string $excludesFile
+ * @return string
+ */
+ protected function excludesListFile($excludesFile)
+ {
+ $excludesListFileRsync = '';
+ if(!empty($excludesFile) && file_exists($excludesFile) && is_file($excludesFile) && is_readable($excludesFile)) {
+ $excludesListFileRsync = ' --exclude-from=' . $excludesFile;
+ }
+ return $excludesListFileRsync;
+ }
}
diff --git a/Mage/Task/BuiltIn/Filesystem/LinkSharedFilesTask.php b/Mage/Task/BuiltIn/Filesystem/LinkSharedFilesTask.php
index 86dc645..4ed89a1 100644
--- a/Mage/Task/BuiltIn/Filesystem/LinkSharedFilesTask.php
+++ b/Mage/Task/BuiltIn/Filesystem/LinkSharedFilesTask.php
@@ -8,6 +8,16 @@ use Mage\Task\SkipException;
class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware
{
+ const LINKED_FOLDERS = 'linked_folders';
+ const LINKED_STRATEGY = 'linking_strategy';
+
+ const ABSOLUTE_LINKING = 'absolute';
+ const RELATIVE_LINKING = 'relative';
+
+ public $linkingStrategies = array(
+ self::ABSOLUTE_LINKING,
+ self::RELATIVE_LINKING
+ );
/**
* Returns the Title of the Task
* @return string
@@ -25,28 +35,41 @@ class LinkSharedFilesTask extends AbstractTask implements IsReleaseAware
*/
public function run()
{
- $linkedFiles = $this->getParameter('linked_files', []);
- $linkedFolders = $this->getParameter('linked_folders', []);
+ $linkedFiles = $this->getParameter('linked_files', []);
+ $linkedFolders = $this->getParameter(self::LINKED_FOLDERS, []);
+ $linkingStrategy = $this->getParameter(self::LINKED_STRATEGY, self::ABSOLUTE_LINKING);
+
+ $linkedEntities = array_merge($linkedFiles,$linkedFolders);
+
if (sizeof($linkedFiles) == 0 && sizeof($linkedFolders) == 0) {
throw new SkipException('No files and folders configured for sym-linking.');
}
$sharedFolderName = $this->getParameter('shared', 'shared');
- $sharedFolderName = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $sharedFolderName;
+ $sharedFolderPath = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $sharedFolderName;
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
- $releasesDirectory = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory;
+ $releasesDirectoryPath = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory;
- $currentCopy = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
- foreach ($linkedFolders as $folder) {
- $command = "ln -nfs $sharedFolderName/$folder $currentCopy/$folder";
- $this->runCommandRemote($command);
- }
+ $currentCopy = $releasesDirectoryPath . '/' . $this->getConfig()->getReleaseId();
+ $relativeDiffPath = str_replace($this->getConfig()->deployment('to'),'',$currentCopy) . '/';
- foreach ($linkedFiles as $folder) {
- $command = "ln -nfs $sharedFolderName/$folder $currentCopy/$folder";
+ foreach ($linkedEntities as $ePath) {
+ if(is_array($ePath) && in_array($strategy = reset($ePath), $this->linkingStrategies ) ) {
+ $entityPath = key($ePath);
+ } else {
+ $strategy = $linkingStrategy;
+ $entityPath = $ePath;
+ }
+ $sharedEntityLinkedPath = "$sharedFolderPath/$entityPath";
+ if($strategy==self::RELATIVE_LINKING) {
+ $parentFolderPath = dirname($entityPath);
+ $relativePath = $parentFolderPath=='.'?$relativeDiffPath:$relativeDiffPath.$parentFolderPath.'/';
+ $sharedEntityLinkedPath = ltrim(preg_replace('/(\w+\/)/', '../', $relativePath),'/').$sharedFolderName .'/'. $entityPath;
+ }
+ $command = "ln -nfs $sharedEntityLinkedPath $currentCopy/$entityPath";
$this->runCommandRemote($command);
}
return true;
}
-}
+}
\ No newline at end of file
diff --git a/Mage/Task/BuiltIn/Magento/ClearCacheTask.php b/Mage/Task/BuiltIn/Magento/ClearCacheTask.php
index 8a8cf55..7db7780 100644
--- a/Mage/Task/BuiltIn/Magento/ClearCacheTask.php
+++ b/Mage/Task/BuiltIn/Magento/ClearCacheTask.php
@@ -39,4 +39,4 @@ class ClearCacheTask extends AbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Magento/ClearFullPageCacheTask.php b/Mage/Task/BuiltIn/Magento/ClearFullPageCacheTask.php
index 8dd0b49..17c3d66 100644
--- a/Mage/Task/BuiltIn/Magento/ClearFullPageCacheTask.php
+++ b/Mage/Task/BuiltIn/Magento/ClearFullPageCacheTask.php
@@ -39,4 +39,4 @@ class ClearFullPageCacheTask extends AbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Releases/ListTask.php b/Mage/Task/BuiltIn/Releases/ListTask.php
index ef88004..ffbd2c4 100644
--- a/Mage/Task/BuiltIn/Releases/ListTask.php
+++ b/Mage/Task/BuiltIn/Releases/ListTask.php
@@ -34,11 +34,11 @@ class ListTask extends AbstractTask implements IsReleaseAware
*/
public function run()
{
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$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);
}
}
@@ -146,5 +146,4 @@ class ListTask extends AbstractTask implements IsReleaseAware
return $textDiff;
}
-
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Releases/RollbackTask.php b/Mage/Task/BuiltIn/Releases/RollbackTask.php
index 759c042..7a437fd 100644
--- a/Mage/Task/BuiltIn/Releases/RollbackTask.php
+++ b/Mage/Task/BuiltIn/Releases/RollbackTask.php
@@ -47,7 +47,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
*/
public function run()
{
- if ($this->getConfig()->release('enabled', false) == true) {
+ if ($this->getConfig()->release('enabled', false) === true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
$symlink = $this->getConfig()->release('symlink', 'current');
@@ -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
@@ -111,7 +111,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$tasks++;
$result = $task->run();
- if ($result == true) {
+ if ($result === true) {
Console::output('OK', 0);
$completedTasks++;
} else {
@@ -161,7 +161,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$tasks++;
$result = $task->run();
- if ($result == true) {
+ if ($result === true) {
Console::output('OK', 0);
$completedTasks++;
} else {
@@ -178,7 +178,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
$tasksColor = 'red';
}
- Console::output('Release rollback on ' . $this->getConfig()->getHost() . ' compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
+ Console::output('Release rollback on ' . $this->getConfig()->getHost() . ' compted: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '' . $tasksColor . '> tasks done.', 1, 3);
}
}
@@ -188,5 +188,4 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
return false;
}
}
-
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php b/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php
index dfb6127..8c5e33f 100644
--- a/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php
+++ b/Mage/Task/BuiltIn/Scm/ChangeBranchTask.php
@@ -105,4 +105,4 @@ class ChangeBranchTask extends AbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Scm/CloneTask.php b/Mage/Task/BuiltIn/Scm/CloneTask.php
index c5c1170..5402117 100644
--- a/Mage/Task/BuiltIn/Scm/CloneTask.php
+++ b/Mage/Task/BuiltIn/Scm/CloneTask.php
@@ -53,6 +53,15 @@ class CloneTask extends AbstractTask
$this->name = 'SCM Clone (GIT) [built-in]';
break;
}
+
+ // Create temporal directory for clone
+ if (is_array($this->source)) {
+ if (trim($this->source['temporal']) == '') {
+ $this->source['temporal'] = sys_get_temp_dir();
+ }
+ $this->source['temporal'] = rtrim($this->source['temporal'], '/') . '/' . md5(microtime()) . '/';
+ $this->getConfig()->setSourceTemporal($this->source['temporal']);
+ }
}
/**
diff --git a/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php b/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php
new file mode 100644
index 0000000..9d68e09
--- /dev/null
+++ b/Mage/Task/BuiltIn/Scm/ForceUpdateTask.php
@@ -0,0 +1,87 @@
+
+*
+* For the full copyright and license information, please view the LICENSE
+* file that was distributed with this source code.
+*/
+
+namespace Mage\Task\BuiltIn\Scm;
+
+use Mage\Task\AbstractTask;
+use Mage\Task\SkipException;
+
+/**
+ * Task for Force Updating a Working Copy
+ *
+ * 'git fetch' downloads the latest from remote without trying to merge or rebase anything.
+ * 'git reset' resets the master branch to what you just fetched.
+ * The '--hard' option changes all the files in your working tree to match the files in origin/master,
+ * so if you have any local changes, they will be lost.
+ *
+ * @author Samuel Chiriluta
+ */
+class ForceUpdateTask extends AbstractTask
+{
+ /**
+ * Name of the Task
+ * @var string
+ */
+ private $name = 'SCM Force Update [built-in]';
+
+ /**
+ * (non-PHPdoc)
+ * @see \Mage\Task\AbstractTask::getName()
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * (non-PHPdoc)
+ * @see \Mage\Task\AbstractTask::init()
+ */
+ public function init()
+ {
+ switch ($this->getConfig()->general('scm')) {
+ case 'git':
+ $this->name = 'SCM Force Update (GIT) [built-in]';
+ break;
+ }
+ }
+
+ /**
+ * Force Updates the Working Copy
+ * @see \Mage\Task\AbstractTask::run()
+ */
+ public function run()
+ {
+ switch ($this->getConfig()->general('scm')) {
+ case 'git':
+ $branch = $this->getParameter('branch', 'master');
+ $remote = $this->getParameter('remote', 'origin');
+
+ $command = 'git fetch ' . $remote . ' ' . $branch;
+ $result = $this->runCommandRemote($command);
+
+ $command = 'git reset --hard ' . $remote . '/' . $branch;
+ $result = $result && $this->runCommandRemote($command);
+
+ $command = 'git pull ' . $remote . ' ' . $branch;
+ $result = $result && $this->runCommandRemote($command);
+ break;
+
+ default:
+ throw new SkipException;
+ break;
+ }
+
+ $result = $this->runCommandLocal($command);
+ $this->getConfig()->reload();
+
+ return $result;
+ }
+}
diff --git a/Mage/Task/BuiltIn/Scm/RemoveCloneTask.php b/Mage/Task/BuiltIn/Scm/RemoveCloneTask.php
index 5084622..e0c102d 100644
--- a/Mage/Task/BuiltIn/Scm/RemoveCloneTask.php
+++ b/Mage/Task/BuiltIn/Scm/RemoveCloneTask.php
@@ -58,4 +58,4 @@ class RemoveCloneTask extends AbstractTask
{
return $this->runCommandLocal('rm -rf ' . $this->source['temporal']);
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Scm/UpdateTask.php b/Mage/Task/BuiltIn/Scm/UpdateTask.php
index e883a2c..22c496e 100644
--- a/Mage/Task/BuiltIn/Scm/UpdateTask.php
+++ b/Mage/Task/BuiltIn/Scm/UpdateTask.php
@@ -69,4 +69,4 @@ class UpdateTask extends AbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Symfony2/AsseticDumpTask.php b/Mage/Task/BuiltIn/Symfony2/AsseticDumpTask.php
index 7b08660..7b1c69c 100644
--- a/Mage/Task/BuiltIn/Symfony2/AsseticDumpTask.php
+++ b/Mage/Task/BuiltIn/Symfony2/AsseticDumpTask.php
@@ -42,4 +42,4 @@ class AsseticDumpTask extends SymfonyAbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Symfony2/AssetsInstallTask.php b/Mage/Task/BuiltIn/Symfony2/AssetsInstallTask.php
index c53292c..f7ca981 100644
--- a/Mage/Task/BuiltIn/Symfony2/AssetsInstallTask.php
+++ b/Mage/Task/BuiltIn/Symfony2/AssetsInstallTask.php
@@ -49,4 +49,4 @@ class AssetsInstallTask extends SymfonyAbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php b/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php
index fff5c24..44acc46 100644
--- a/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php
+++ b/Mage/Task/BuiltIn/Symfony2/CacheClearTask.php
@@ -42,4 +42,4 @@ class CacheClearTask extends SymfonyAbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/BuiltIn/Symfony2/DoctrineMigrate.php b/Mage/Task/BuiltIn/Symfony2/DoctrineMigrate.php
new file mode 100644
index 0000000..b76633d
--- /dev/null
+++ b/Mage/Task/BuiltIn/Symfony2/DoctrineMigrate.php
@@ -0,0 +1,40 @@
+
+*
+* For the full copyright and license information, please view the LICENSE
+* file that was distributed with this source code.
+*/
+
+namespace Mage\Task\BuiltIn\Symfony2;
+
+use Mage\Task\BuiltIn\Symfony2\SymfonyAbstractTask;
+
+/**
+ * Task for Doctrine migrations
+ */
+class DoctrineMigrate extends SymfonyAbstractTask
+{
+ /**
+ * (non-PHPdoc)
+ * @see \Mage\Task\AbstractTask::getName()
+ */
+ public function getName()
+ {
+ return 'Symfony v2 - Migrate doctrine entities [built-in]';
+ }
+
+ /**
+ * Migrates Doctrine entities
+ *
+ * @see \Mage\Task\AbstractTask::run()
+ */
+ public function run()
+ {
+ $env = $this->getParameter('env', 'dev');
+ $command = $this->getAppPath() . ' doctrine:migrations:migrate -n --env=' . $env;
+ return $this->runCommand($command);
+ }
+}
diff --git a/Mage/Task/BuiltIn/Symfony2/SymfonyAbstractTask.php b/Mage/Task/BuiltIn/Symfony2/SymfonyAbstractTask.php
index 4fae2e2..7ac246c 100644
--- a/Mage/Task/BuiltIn/Symfony2/SymfonyAbstractTask.php
+++ b/Mage/Task/BuiltIn/Symfony2/SymfonyAbstractTask.php
@@ -29,4 +29,4 @@ abstract class SymfonyAbstractTask extends AbstractTask
return $this->getConfig()->general('symfony_app_path', $defaultAppPath);
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Task/Factory.php b/Mage/Task/Factory.php
index fce6050..912026f 100644
--- a/Mage/Task/Factory.php
+++ b/Mage/Task/Factory.php
@@ -11,7 +11,6 @@
namespace Mage\Task;
use Mage\Config;
-use Mage\Autoload;
use Exception;
diff --git a/Mage/Task/RollbackException.php b/Mage/Task/RollbackException.php
new file mode 100644
index 0000000..d2e56df
--- /dev/null
+++ b/Mage/Task/RollbackException.php
@@ -0,0 +1,23 @@
+
+*
+* For the full copyright and license information, please view the LICENSE
+* file that was distributed with this source code.
+*/
+
+namespace Mage\Task;
+
+use Exception;
+
+/**
+ * Exception that indicates that the Task was Failed and rollback needed
+ *
+ * @author Alex V Kotelnikov
+ */
+class RollbackException extends Exception
+{
+
+}
\ No newline at end of file
diff --git a/Mage/Task/SkipException.php b/Mage/Task/SkipException.php
index e26684a..66bf4a8 100644
--- a/Mage/Task/SkipException.php
+++ b/Mage/Task/SkipException.php
@@ -19,4 +19,4 @@ use Exception;
*/
class SkipException extends Exception
{
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Dumper.php b/Mage/Yaml/Dumper.php
index 5090513..1a594df 100644
--- a/Mage/Yaml/Dumper.php
+++ b/Mage/Yaml/Dumper.php
@@ -72,4 +72,4 @@ class Dumper
return $output;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Escaper.php b/Mage/Yaml/Escaper.php
index 021b7ea..ad75520 100644
--- a/Mage/Yaml/Escaper.php
+++ b/Mage/Yaml/Escaper.php
@@ -86,4 +86,4 @@ class Escaper
{
return sprintf("'%s'", str_replace('\'', '\'\'', $value));
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Exception/DumpException.php b/Mage/Yaml/Exception/DumpException.php
index bc3581b..20ac47c 100644
--- a/Mage/Yaml/Exception/DumpException.php
+++ b/Mage/Yaml/Exception/DumpException.php
@@ -22,4 +22,4 @@ use Mage\Yaml\Exception\RuntimeException;
*/
class DumpException extends RuntimeException
{
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Exception/ExceptionInterface.php b/Mage/Yaml/Exception/ExceptionInterface.php
index fa12000..cc55042 100644
--- a/Mage/Yaml/Exception/ExceptionInterface.php
+++ b/Mage/Yaml/Exception/ExceptionInterface.php
@@ -20,4 +20,4 @@ namespace Mage\Yaml\Exception;
*/
interface ExceptionInterface
{
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Exception/ParseException.php b/Mage/Yaml/Exception/ParseException.php
index 3c4465b..6064ce4 100644
--- a/Mage/Yaml/Exception/ParseException.php
+++ b/Mage/Yaml/Exception/ParseException.php
@@ -147,4 +147,4 @@ class ParseException extends RuntimeException
$this->message .= '.';
}
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Exception/RuntimeException.php b/Mage/Yaml/Exception/RuntimeException.php
index 51245bd..5bbe8a3 100644
--- a/Mage/Yaml/Exception/RuntimeException.php
+++ b/Mage/Yaml/Exception/RuntimeException.php
@@ -22,4 +22,4 @@ use Mage\Yaml\Exception\ExceptionInterface;
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Inline.php b/Mage/Yaml/Inline.php
index 2586dde..0341f78 100644
--- a/Mage/Yaml/Inline.php
+++ b/Mage/Yaml/Inline.php
@@ -502,4 +502,4 @@ class Inline
$~x
EOF;
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Parser.php b/Mage/Yaml/Parser.php
index fa7007d..4237dc5 100644
--- a/Mage/Yaml/Parser.php
+++ b/Mage/Yaml/Parser.php
@@ -655,5 +655,4 @@ class Parser
{
return (0 === strpos($this->currentLine, '- '));
}
-
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Unescaper.php b/Mage/Yaml/Unescaper.php
index fc3bbcf..e7a25b3 100644
--- a/Mage/Yaml/Unescaper.php
+++ b/Mage/Yaml/Unescaper.php
@@ -139,4 +139,4 @@ class Unescaper
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F);
}
-}
\ No newline at end of file
+}
diff --git a/Mage/Yaml/Yaml.php b/Mage/Yaml/Yaml.php
index a476c60..3845c80 100644
--- a/Mage/Yaml/Yaml.php
+++ b/Mage/Yaml/Yaml.php
@@ -99,4 +99,4 @@ class Yaml
return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType, $objectSupport);
}
-}
\ No newline at end of file
+}
diff --git a/bin/mage b/bin/mage
index b668d45..728e3aa 100755
--- a/bin/mage
+++ b/bin/mage
@@ -13,7 +13,7 @@ date_default_timezone_set('UTC');
$baseDir = dirname(dirname(__FILE__));
-define('MAGALLANES_VERSION', '1.0.2');
+define('MAGALLANES_VERSION', '1.0.3');
define('MAGALLANES_DIRECTORY', $baseDir);
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
@@ -32,4 +32,4 @@ array_shift($argv);
$console = new Mage\Console;
$exitCode = $console->run($argv);
-exit($exitCode);
+exit((integer) $exitCode);
diff --git a/box.json b/box.json
new file mode 100644
index 0000000..cc32edb
--- /dev/null
+++ b/box.json
@@ -0,0 +1,16 @@
+{
+ "files": ["LICENSE"],
+ "finder": [
+ {
+ "name": "*.php",
+ "exclude": [
+ "docs"
+ ],
+ "in": "Mage"
+ }
+ ],
+ "git-version": "git_tag",
+ "main": "bin/mage",
+ "output": "mage.phar",
+ "stub": true
+}
diff --git a/docs/example-config/.mage/config/environment/ioncube.yml b/docs/example-config/.mage/config/environment/ioncube.yml.txt
similarity index 92%
rename from docs/example-config/.mage/config/environment/ioncube.yml
rename to docs/example-config/.mage/config/environment/ioncube.yml.txt
index da001d8..9a6037b 100644
--- a/docs/example-config/.mage/config/environment/ioncube.yml
+++ b/docs/example-config/.mage/config/environment/ioncube.yml.txt
@@ -10,11 +10,11 @@ deployment:
ioncube: test
releases:
- enabled: true
- symlink: current
- directory: releases
+ enabled: true
+ symlink: current
+ directory: releases
hosts:
- - localhost
+ - localhost
tasks:
pre-deploy:
- ioncube/encrypt
@@ -27,9 +27,8 @@ ioncube:
encoder: ioncube_encoder54
checkencoding: true
checkignorepaths:
- -/public/js/*
- -/public/css/*
-
+ - /public/js/*
+ - /public/css/*
projfile: project.prj
project:
replace-target:
@@ -57,7 +56,6 @@ ioncube:
- 'Comment 2'
- "(c) ACTweb 2013"
- "Draft Version"
-
loader-event:
- corrupt-file=Corupted files
- expired-file=System needs updated
diff --git a/docs/example-config/.mage/config/environment/production.yml b/docs/example-config/.mage/config/environment/production.yml
index e785fe0..5122d7d 100644
--- a/docs/example-config/.mage/config/environment/production.yml
+++ b/docs/example-config/.mage/config/environment/production.yml
@@ -2,11 +2,6 @@
deployment:
user: root
from: ./
-# source:
-# type: git
-# repository: git://github.com/andres-montanez/Magallanes.git
-# from: master
-# temporal: /tmp/myAppClone
to: /var/www/vhosts/example.com/www
excludes:
- application/data/cache/twig/*
@@ -16,25 +11,13 @@ releases:
symlink: current
directory: releases
hosts:
- s01.example.com:22:
- deployment:
- user: nobody
- s02.example.com:
- deployment:
- user: toor
- to: /home/web/public
- releases:
- max: 10
- tasks:
- on-deploy:
- - privileges
- - s03.example.com
+ - s01.example.com
+ - s02.example.com
tasks:
pre-deploy:
- scm/update
on-deploy:
-# - symfony2/cache-warmup: {env: prod}
+ - symfony2/cache-warmup: { env: prod }
- privileges
- sampleTask
- sampleTaskRollbackAware
- #post-deploy:
\ No newline at end of file
diff --git a/docs/example-config/.mage/config/environment/production.yml.advanced.txt b/docs/example-config/.mage/config/environment/production.yml.advanced.txt
new file mode 100644
index 0000000..538e517
--- /dev/null
+++ b/docs/example-config/.mage/config/environment/production.yml.advanced.txt
@@ -0,0 +1,38 @@
+#production
+deployment:
+ user: root
+ from: ./
+# source:
+# type: git
+# repository: git://github.com/andres-montanez/Magallanes.git
+# from: master
+# temporal: /tmp/myAppClone
+ to: /var/www/vhosts/example.com/www
+ excludes:
+ - application/data/cache/twig/*
+releases:
+ enabled: true
+ max: 5
+ symlink: current
+ directory: releases
+hosts:
+ - s01.example.com
+ - s02.example.com
+# s02.example.com:
+# deployment:
+# user: toor
+# to: /home/web/public
+# releases:
+# max: 10
+# tasks:
+# on-deploy:
+# - privileges
+tasks:
+ pre-deploy:
+ - scm/update
+ on-deploy:
+ - symfony2/cache-warmup: { env: prod }
+ - privileges
+ - sampleTask
+ - sampleTaskRollbackAware
+ #post-deploy:
diff --git a/docs/example-config/.mage/config/general.yml b/docs/example-config/.mage/config/general.yml
index f601999..3834ff3 100644
--- a/docs/example-config/.mage/config/general.yml
+++ b/docs/example-config/.mage/config/general.yml
@@ -5,4 +5,4 @@ notifications: true
logging: true
scm:
type: git
- url: git://github.com/andres-montanez/Zend-Framework-Twig-example-app.git
\ No newline at end of file
+ url: git://github.com/andres-montanez/Zend-Framework-Twig-example-app.git
diff --git a/docs/example-config/.mage/logs/.gitignore b/docs/example-config/.mage/logs/.gitignore
index 6976a48..5592679 100644
--- a/docs/example-config/.mage/logs/.gitignore
+++ b/docs/example-config/.mage/logs/.gitignore
@@ -1 +1 @@
-log-*
\ No newline at end of file
+log-*
diff --git a/docs/example-config/.mage/tasks/FailTask.php b/docs/example-config/.mage/tasks/FailTask.php
index 91e9c52..641e887 100644
--- a/docs/example-config/.mage/tasks/FailTask.php
+++ b/docs/example-config/.mage/tasks/FailTask.php
@@ -14,4 +14,4 @@ class FailTask extends AbstractTask
{
return false;
}
-}
\ No newline at end of file
+}
diff --git a/docs/example-config/.mage/tasks/Privileges.php b/docs/example-config/.mage/tasks/Privileges.php
index f5d88bd..1092533 100644
--- a/docs/example-config/.mage/tasks/Privileges.php
+++ b/docs/example-config/.mage/tasks/Privileges.php
@@ -17,4 +17,4 @@ class Privileges extends AbstractTask
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/docs/example-config/.mage/tasks/SampleTask.php b/docs/example-config/.mage/tasks/SampleTask.php
index fc9f9a1..380a4ec 100644
--- a/docs/example-config/.mage/tasks/SampleTask.php
+++ b/docs/example-config/.mage/tasks/SampleTask.php
@@ -14,4 +14,4 @@ class SampleTask extends AbstractTask
{
return true;
}
-}
\ No newline at end of file
+}
diff --git a/docs/example-config/.mage/tasks/SampleTaskRollbackAware.php b/docs/example-config/.mage/tasks/SampleTaskRollbackAware.php
index ef02d13..d9213f4 100644
--- a/docs/example-config/.mage/tasks/SampleTaskRollbackAware.php
+++ b/docs/example-config/.mage/tasks/SampleTaskRollbackAware.php
@@ -19,4 +19,5 @@ class SampleTaskRollbackAware extends AbstractTask implements RollbackAware
{
return true;
}
-}
\ No newline at end of file
+}
+
diff --git a/docs/example-config/.mage/tasks/TaskWithParameters.php b/docs/example-config/.mage/tasks/TaskWithParameters.php
index bf99deb..003ffef 100644
--- a/docs/example-config/.mage/tasks/TaskWithParameters.php
+++ b/docs/example-config/.mage/tasks/TaskWithParameters.php
@@ -18,8 +18,10 @@ class TaskWithParameters extends AbstractTask
public function run()
{
- //throw new Mage_Task_SkipException;
- //return false;
- return true;
+ if ($this->getParameter('booleanOption', false)) {
+ return true;
+ } else {
+ return false;
+ }
}
-}
\ No newline at end of file
+}