mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-05 17:08:56 +02:00
PHPStorm refactoring.
This commit is contained in:
@@ -24,11 +24,11 @@ use Exception;
|
||||
*/
|
||||
class AddCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* Adds new Configuration Elements
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
* @throws Exception
|
||||
*/
|
||||
/**
|
||||
* Adds new Configuration Elements
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
* @throws Exception
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$subCommand = $this->getConfig()->getArgument(1);
|
||||
@@ -71,24 +71,24 @@ class AddCommand extends AbstractCommand
|
||||
Console::output('Adding new environment: <dark_gray>' . $environmentName . '</dark_gray>');
|
||||
|
||||
$releasesConfig = 'releases:' . PHP_EOL
|
||||
. ' enabled: true' . PHP_EOL
|
||||
. ' max: 10' . PHP_EOL
|
||||
. ' symlink: current' . PHP_EOL
|
||||
. ' directory: releases' . PHP_EOL;
|
||||
. ' enabled: true' . PHP_EOL
|
||||
. ' max: 10' . PHP_EOL
|
||||
. ' symlink: current' . PHP_EOL
|
||||
. ' directory: releases' . PHP_EOL;
|
||||
|
||||
$baseConfig = '#' . $environmentName . PHP_EOL
|
||||
. 'deployment:' . PHP_EOL
|
||||
. ' user: dummy' . PHP_EOL
|
||||
. ' from: ./' . PHP_EOL
|
||||
. ' to: /var/www/vhosts/example.com/www' . PHP_EOL
|
||||
. ' excludes:' . PHP_EOL
|
||||
. ($withReleases ? $releasesConfig : '')
|
||||
. 'hosts:' . PHP_EOL
|
||||
. 'tasks:' . PHP_EOL
|
||||
. ' pre-deploy:' . PHP_EOL
|
||||
. ' on-deploy:' . PHP_EOL
|
||||
. ($withReleases ? (' post-release:' . PHP_EOL) : '')
|
||||
. ' post-deploy:' . PHP_EOL;
|
||||
. 'deployment:' . PHP_EOL
|
||||
. ' user: dummy' . PHP_EOL
|
||||
. ' from: ./' . PHP_EOL
|
||||
. ' to: /var/www/vhosts/example.com/www' . PHP_EOL
|
||||
. ' excludes:' . PHP_EOL
|
||||
. ($withReleases ? $releasesConfig : '')
|
||||
. 'hosts:' . PHP_EOL
|
||||
. 'tasks:' . PHP_EOL
|
||||
. ' pre-deploy:' . PHP_EOL
|
||||
. ' on-deploy:' . PHP_EOL
|
||||
. ($withReleases ? (' post-release:' . PHP_EOL) : '')
|
||||
. ' post-deploy:' . PHP_EOL;
|
||||
|
||||
$result = file_put_contents($environmentConfigFile, $baseConfig);
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ class CompileCommand extends AbstractCommand
|
||||
/**
|
||||
* @see \Mage\Compile::compile()
|
||||
*/
|
||||
public function run ()
|
||||
public function run()
|
||||
{
|
||||
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);
|
||||
return;
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
$compiler = new Compiler;
|
||||
$compiler->compile();
|
||||
|
||||
@@ -35,31 +35,31 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
const DEPLOY_STRATEGY_RSYNC = 'rsync';
|
||||
const DEPLOY_STRATEGY_TARGZ = 'targz';
|
||||
const DEPLOY_STRATEGY_GIT_REBASE = 'git-rebase';
|
||||
const DEPLOY_STRATEGY_GUESS = 'guess';
|
||||
const DEPLOY_STRATEGY_GUESS = 'guess';
|
||||
const DEFAULT_DEPLOY_STRATEGY = self::DEPLOY_STRATEGY_GUESS;
|
||||
|
||||
/**
|
||||
* Deploy has Failed
|
||||
* @var string
|
||||
*/
|
||||
const FAILED = 'failed';
|
||||
* Deploy has Failed
|
||||
* @var string
|
||||
*/
|
||||
const FAILED = 'failed';
|
||||
|
||||
/**
|
||||
* Deploy has Succeded
|
||||
* @var string
|
||||
*/
|
||||
const SUCCEDED = 'succeded';
|
||||
/**
|
||||
* Deploy has Succeded
|
||||
* @var string
|
||||
*/
|
||||
const SUCCEDED = 'succeded';
|
||||
|
||||
/**
|
||||
* Deploy is in progress
|
||||
* @var string
|
||||
*/
|
||||
const IN_PROGRESS = 'in_progress';
|
||||
/**
|
||||
* Deploy is in progress
|
||||
* @var string
|
||||
*/
|
||||
const IN_PROGRESS = 'in_progress';
|
||||
|
||||
/**
|
||||
* Time the Deployment has Started
|
||||
* @var integer
|
||||
*/
|
||||
/**
|
||||
* Time the Deployment has Started
|
||||
* @var integer
|
||||
*/
|
||||
protected $startTime = null;
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
*/
|
||||
public static function getStatus()
|
||||
{
|
||||
return self::$deployStatus;
|
||||
return self::$deployStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,20 +109,20 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
public function run()
|
||||
{
|
||||
// Check if Environment is not Locked
|
||||
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile)) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
return;
|
||||
}
|
||||
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile)) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for running instance and Lock
|
||||
if (file_exists(getcwd() . '/.mage/~working.lock')) {
|
||||
Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2);
|
||||
return;
|
||||
} else {
|
||||
touch(getcwd() . '/.mage/~working.lock');
|
||||
}
|
||||
// Check for running instance and Lock
|
||||
if (file_exists(getcwd() . '/.mage/~working.lock')) {
|
||||
Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2);
|
||||
return;
|
||||
} else {
|
||||
touch(getcwd() . '/.mage/~working.lock');
|
||||
}
|
||||
|
||||
// Release ID
|
||||
$this->getConfig()->setReleaseId(date('YmdHis'));
|
||||
@@ -135,15 +135,15 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
// Deploy Summary - Releases
|
||||
if ($this->getConfig()->release('enabled', false)) {
|
||||
Console::output('<dark_gray>Release ID:</dark_gray> <purple>' . $this->getConfig()->getReleaseId() . '</purple>', 2, 1);
|
||||
Console::output('<dark_gray>Release ID:</dark_gray> <purple>' . $this->getConfig()->getReleaseId() . '</purple>', 2, 1);
|
||||
}
|
||||
|
||||
// Deploy Summary - SCM
|
||||
if ($this->getConfig()->deployment('scm', false)) {
|
||||
$scmConfig = $this->getConfig()->deployment('scm');
|
||||
if (isset($scmConfig['branch'])) {
|
||||
Console::output('<dark_gray>SCM Branch:</dark_gray> <purple>' . $scmConfig['branch'] . '</purple>', 2, 1);
|
||||
}
|
||||
$scmConfig = $this->getConfig()->deployment('scm');
|
||||
if (isset($scmConfig['branch'])) {
|
||||
Console::output('<dark_gray>SCM Branch:</dark_gray> <purple>' . $scmConfig['branch'] . '</purple>', 2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Deploy Summary - Separator Line
|
||||
@@ -156,21 +156,21 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
// Check Status
|
||||
if (self::$failedTasks > 0) {
|
||||
self::$deployStatus = self::FAILED;
|
||||
Console::output('A total of <dark_gray>' . self::$failedTasks . '</dark_gray> deployment tasks failed: <red>ABORTING</red>', 1, 2);
|
||||
self::$deployStatus = self::FAILED;
|
||||
Console::output('A total of <dark_gray>' . self::$failedTasks . '</dark_gray> deployment tasks failed: <red>ABORTING</red>', 1, 2);
|
||||
|
||||
} else {
|
||||
// Run Deployment Tasks
|
||||
$this->runDeploymentTasks();
|
||||
// Run Deployment Tasks
|
||||
$this->runDeploymentTasks();
|
||||
|
||||
// Check Status
|
||||
if (self::$failedTasks > 0) {
|
||||
self::$deployStatus = self::FAILED;
|
||||
Console::output('A total of <dark_gray>' . self::$failedTasks . '</dark_gray> deployment tasks failed: <red>ABORTING</red>', 1, 2);
|
||||
}
|
||||
// Check Status
|
||||
if (self::$failedTasks > 0) {
|
||||
self::$deployStatus = self::FAILED;
|
||||
Console::output('A total of <dark_gray>' . self::$failedTasks . '</dark_gray> deployment tasks failed: <red>ABORTING</red>', 1, 2);
|
||||
}
|
||||
|
||||
// Run Post-Deployment Tasks
|
||||
$this->runNonDeploymentTasks(AbstractTask::STAGE_POST_DEPLOY, $this->getConfig(), 'Post-Deployment');
|
||||
// Run Post-Deployment Tasks
|
||||
$this->runNonDeploymentTasks(AbstractTask::STAGE_POST_DEPLOY, $this->getConfig(), 'Post-Deployment');
|
||||
}
|
||||
|
||||
// Time Information Hosts
|
||||
@@ -191,7 +191,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
// Unlock
|
||||
if (file_exists(getcwd() . '/.mage/~working.lock')) {
|
||||
unlink(getcwd() . '/.mage/~working.lock');
|
||||
unlink(getcwd() . '/.mage/~working.lock');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,33 +209,33 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
// PreDeployment Hook
|
||||
if ($stage == AbstractTask::STAGE_PRE_DEPLOY) {
|
||||
// Look for Remote Source
|
||||
if (is_array($config->deployment('source', null))) {
|
||||
array_unshift($tasksToRun, 'scm/clone');
|
||||
}
|
||||
// Look for Remote Source
|
||||
if (is_array($config->deployment('source', null))) {
|
||||
array_unshift($tasksToRun, 'scm/clone');
|
||||
}
|
||||
|
||||
// Change Branch
|
||||
if ($config->deployment('scm', false)) {
|
||||
array_unshift($tasksToRun, 'scm/change-branch');
|
||||
}
|
||||
// Change Branch
|
||||
if ($config->deployment('scm', false)) {
|
||||
array_unshift($tasksToRun, 'scm/change-branch');
|
||||
}
|
||||
}
|
||||
|
||||
// PostDeployment Hook
|
||||
if ($stage == AbstractTask::STAGE_POST_DEPLOY) {
|
||||
// If Deploy failed, clear post deploy tasks
|
||||
if (self::$deployStatus == self::FAILED) {
|
||||
$tasksToRun = array();
|
||||
}
|
||||
// If Deploy failed, clear post deploy tasks
|
||||
if (self::$deployStatus == self::FAILED) {
|
||||
$tasksToRun = array();
|
||||
}
|
||||
|
||||
// Change Branch Back
|
||||
if ($config->deployment('scm', false)) {
|
||||
array_unshift($tasksToRun, 'scm/change-branch');
|
||||
$config->addParameter('_changeBranchRevert');
|
||||
}
|
||||
// Change Branch Back
|
||||
if ($config->deployment('scm', false)) {
|
||||
array_unshift($tasksToRun, 'scm/change-branch');
|
||||
$config->addParameter('_changeBranchRevert');
|
||||
}
|
||||
|
||||
// Remove Remote Source
|
||||
if (is_array($config->deployment('source', null))) {
|
||||
array_push($tasksToRun, 'scm/remove-clone');
|
||||
// Remove Remote Source
|
||||
if (is_array($config->deployment('source', null))) {
|
||||
array_push($tasksToRun, 'scm/remove-clone');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
if ($this->runTask($task)) {
|
||||
$completedTasks++;
|
||||
} else {
|
||||
self::$failedTasks++;
|
||||
self::$failedTasks++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,151 +271,151 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
protected function runDeploymentTasks()
|
||||
{
|
||||
if (self::$deployStatus == self::FAILED) {
|
||||
return;
|
||||
}
|
||||
if (self::$deployStatus == self::FAILED) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Run Tasks for Deployment
|
||||
$hosts = $this->getConfig()->getHosts();
|
||||
$this->hostsCount = count($hosts);
|
||||
self::$failedTasks = 0;
|
||||
// Run Tasks for Deployment
|
||||
$hosts = $this->getConfig()->getHosts();
|
||||
$this->hostsCount = count($hosts);
|
||||
self::$failedTasks = 0;
|
||||
|
||||
if ($this->hostsCount == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <dark_gray>No hosts defined, skipping deployment tasks.</dark_gray>', 1, 3);
|
||||
if ($this->hostsCount == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <dark_gray>No hosts defined, skipping deployment tasks.</dark_gray>', 1, 3);
|
||||
|
||||
} else {
|
||||
$this->startTimeHosts = time();
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
} else {
|
||||
$this->startTimeHosts = time();
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
|
||||
// Check if Host has specific configuration
|
||||
$hostConfig = null;
|
||||
if (is_array($host)) {
|
||||
$hostConfig = $host;
|
||||
$host = $hostKey;
|
||||
}
|
||||
// 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);
|
||||
// Set Host and Host Specific Config
|
||||
$this->getConfig()->setHost($host);
|
||||
$this->getConfig()->setHostConfig($hostConfig);
|
||||
|
||||
// Prepare Tasks
|
||||
$tasks = 0;
|
||||
$completedTasks = 0;
|
||||
// Prepare Tasks
|
||||
$tasks = 0;
|
||||
$completedTasks = 0;
|
||||
|
||||
Console::output('Deploying to <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>');
|
||||
Console::output('Deploying to <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray>');
|
||||
|
||||
$tasksToRun = $this->getConfig()->getTasks();
|
||||
$tasksToRun = $this->getConfig()->getTasks();
|
||||
|
||||
$deployStrategy = $this->chooseDeployStrategy();
|
||||
|
||||
array_unshift($tasksToRun, $deployStrategy);
|
||||
|
||||
if (count($tasksToRun) == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <dark_gray>No </dark_gray><light_cyan>Deployment</light_cyan> <dark_gray>tasks defined.</dark_gray>', 2);
|
||||
Console::output('Deployment to <dark_gray>' . $host . '</dark_gray> skipped!', 1, 3);
|
||||
if (count($tasksToRun) == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <dark_gray>No </dark_gray><light_cyan>Deployment</light_cyan> <dark_gray>tasks defined.</dark_gray>', 2);
|
||||
Console::output('Deployment to <dark_gray>' . $host . '</dark_gray> skipped!', 1, 3);
|
||||
|
||||
} else {
|
||||
foreach ($tasksToRun as $taskData) {
|
||||
$tasks++;
|
||||
$task = Factory::get($taskData, $this->getConfig(), false, AbstractTask::STAGE_DEPLOY);
|
||||
} else {
|
||||
foreach ($tasksToRun as $taskData) {
|
||||
$tasks++;
|
||||
$task = Factory::get($taskData, $this->getConfig(), false, AbstractTask::STAGE_DEPLOY);
|
||||
|
||||
if ($this->runTask($task)) {
|
||||
$completedTasks++;
|
||||
} else {
|
||||
self::$failedTasks++;
|
||||
}
|
||||
}
|
||||
if ($this->runTask($task)) {
|
||||
$completedTasks++;
|
||||
} else {
|
||||
self::$failedTasks++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($completedTasks == $tasks) {
|
||||
$tasksColor = 'green';
|
||||
} else {
|
||||
$tasksColor = 'red';
|
||||
}
|
||||
if ($completedTasks == $tasks) {
|
||||
$tasksColor = 'green';
|
||||
} else {
|
||||
$tasksColor = 'red';
|
||||
}
|
||||
|
||||
Console::output('Deployment to <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> completed: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
|
||||
}
|
||||
Console::output('Deployment to <dark_gray>' . $this->getConfig()->getHost() . '</dark_gray> completed: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
|
||||
}
|
||||
|
||||
// Reset Host Config
|
||||
$this->getConfig()->setHostConfig(null);
|
||||
}
|
||||
$this->endTimeHosts = time();
|
||||
// Reset Host Config
|
||||
$this->getConfig()->setHostConfig(null);
|
||||
}
|
||||
$this->endTimeHosts = time();
|
||||
|
||||
if (self::$failedTasks > 0) {
|
||||
self::$deployStatus = self::FAILED;
|
||||
} else {
|
||||
self::$deployStatus = self::SUCCEDED;
|
||||
}
|
||||
if (self::$failedTasks > 0) {
|
||||
self::$deployStatus = self::FAILED;
|
||||
} else {
|
||||
self::$deployStatus = self::SUCCEDED;
|
||||
}
|
||||
|
||||
// Releasing
|
||||
if (self::$deployStatus == self::SUCCEDED && $this->getConfig()->release('enabled', false) == true) {
|
||||
// Execute the Releases
|
||||
Console::output('Starting the <dark_gray>Releasing</dark_gray>');
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
// Releasing
|
||||
if (self::$deployStatus == self::SUCCEDED && $this->getConfig()->release('enabled', false) == true) {
|
||||
// Execute the Releases
|
||||
Console::output('Starting the <dark_gray>Releasing</dark_gray>');
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
|
||||
// Check if Host has specific configuration
|
||||
$hostConfig = null;
|
||||
if (is_array($host)) {
|
||||
$hostConfig = $host;
|
||||
$host = $hostKey;
|
||||
}
|
||||
// Check if Host has specific configuration
|
||||
$hostConfig = null;
|
||||
if (is_array($host)) {
|
||||
$hostConfig = $host;
|
||||
$host = $hostKey;
|
||||
}
|
||||
|
||||
// Set Host
|
||||
$this->getConfig()->setHost($host);
|
||||
$this->getConfig()->setHostConfig($hostConfig);
|
||||
// Set Host
|
||||
$this->getConfig()->setHost($host);
|
||||
$this->getConfig()->setHostConfig($hostConfig);
|
||||
|
||||
$task = Factory::get($this->chooseReleaseStrategy(), $this->getConfig(), false, AbstractTask::STAGE_DEPLOY);
|
||||
$task = Factory::get($this->chooseReleaseStrategy(), $this->getConfig(), false, AbstractTask::STAGE_DEPLOY);
|
||||
|
||||
if ($this->runTask($task, 'Releasing on host <purple>' . $host . '</purple> ... ')) {
|
||||
$completedTasks++;
|
||||
}
|
||||
if ($this->runTask($task, 'Releasing on host <purple>' . $host . '</purple> ... ')) {
|
||||
$completedTasks++;
|
||||
}
|
||||
|
||||
// Reset Host Config
|
||||
$this->getConfig()->setHostConfig(null);
|
||||
}
|
||||
Console::output('Finished the <dark_gray>Releasing</dark_gray>', 1, 3);
|
||||
// Reset Host Config
|
||||
$this->getConfig()->setHostConfig(null);
|
||||
}
|
||||
Console::output('Finished the <dark_gray>Releasing</dark_gray>', 1, 3);
|
||||
|
||||
// Execute the Post-Release Tasks
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
// Execute the Post-Release Tasks
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
|
||||
// Check if Host has specific configuration
|
||||
$hostConfig = null;
|
||||
if (is_array($host)) {
|
||||
$hostConfig = $host;
|
||||
$host = $hostKey;
|
||||
}
|
||||
// Check if Host has specific configuration
|
||||
$hostConfig = null;
|
||||
if (is_array($host)) {
|
||||
$hostConfig = $host;
|
||||
$host = $hostKey;
|
||||
}
|
||||
|
||||
// Set Host
|
||||
$this->getConfig()->setHost($host);
|
||||
$this->getConfig()->setHostConfig($hostConfig);
|
||||
// Set Host
|
||||
$this->getConfig()->setHost($host);
|
||||
$this->getConfig()->setHostConfig($hostConfig);
|
||||
|
||||
$tasksToRun = $this->getConfig()->getTasks(AbstractTask::STAGE_POST_RELEASE);
|
||||
$tasks = count($tasksToRun);
|
||||
$completedTasks = 0;
|
||||
$tasksToRun = $this->getConfig()->getTasks(AbstractTask::STAGE_POST_RELEASE);
|
||||
$tasks = count($tasksToRun);
|
||||
$completedTasks = 0;
|
||||
|
||||
if (count($tasksToRun) > 0) {
|
||||
Console::output('Starting <dark_gray>Post-Release</dark_gray> tasks for <dark_gray>' . $host . '</dark_gray>:');
|
||||
if (count($tasksToRun) > 0) {
|
||||
Console::output('Starting <dark_gray>Post-Release</dark_gray> tasks for <dark_gray>' . $host . '</dark_gray>:');
|
||||
|
||||
foreach ($tasksToRun as $task) {
|
||||
$task = Factory::get($task, $this->getConfig(), false, AbstractTask::STAGE_POST_RELEASE);
|
||||
foreach ($tasksToRun as $task) {
|
||||
$task = Factory::get($task, $this->getConfig(), false, AbstractTask::STAGE_POST_RELEASE);
|
||||
|
||||
if ($this->runTask($task)) {
|
||||
$completedTasks++;
|
||||
}
|
||||
}
|
||||
if ($this->runTask($task)) {
|
||||
$completedTasks++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($completedTasks == $tasks) {
|
||||
$tasksColor = 'green';
|
||||
} else {
|
||||
$tasksColor = 'red';
|
||||
}
|
||||
Console::output('Finished <dark_gray>Post-Release</dark_gray> tasks for <dark_gray>' . $host . '</dark_gray>: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
|
||||
}
|
||||
if ($completedTasks == $tasks) {
|
||||
$tasksColor = 'green';
|
||||
} else {
|
||||
$tasksColor = 'red';
|
||||
}
|
||||
Console::output('Finished <dark_gray>Post-Release</dark_gray> tasks for <dark_gray>' . $host . '</dark_gray>: <' . $tasksColor . '>' . $completedTasks . '/' . $tasks . '</' . $tasksColor . '> tasks done.', 1, 3);
|
||||
}
|
||||
|
||||
// Reset Host Config
|
||||
$this->getConfig()->setHostConfig(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reset Host Config
|
||||
$this->getConfig()->setHostConfig(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -452,8 +452,8 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
$result = false;
|
||||
}
|
||||
} catch (ErrorWithMessageException $e) {
|
||||
Console::output('<red>FAIL</red> [Message: ' . $e->getMessage() . ']', 0);
|
||||
$result = false;
|
||||
Console::output('<red>FAIL</red> [Message: ' . $e->getMessage() . ']', 0);
|
||||
$result = false;
|
||||
|
||||
} catch (SkipException $e) {
|
||||
Console::output('<yellow>SKIPPED</yellow>', 0);
|
||||
@@ -506,21 +506,21 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
*/
|
||||
protected function sendNotification($result)
|
||||
{
|
||||
$projectName = $this->getConfig()->general('name', false);
|
||||
$projectEmail = $this->getConfig()->general('email', false);
|
||||
$notificationsEnabled = $this->getConfig()->general('notifications', false);
|
||||
$projectName = $this->getConfig()->general('name', false);
|
||||
$projectEmail = $this->getConfig()->general('email', false);
|
||||
$notificationsEnabled = $this->getConfig()->general('notifications', false);
|
||||
|
||||
// We need notifications enabled, and a project name and email to send the notification
|
||||
// We need notifications enabled, and a project name and email to send the notification
|
||||
if (!$projectName || !$projectEmail || !$notificationsEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$mailer = new Mailer;
|
||||
$mailer->setAddress($projectEmail)
|
||||
->setProject($projectName)
|
||||
->setLogFile(Console::getLogFile())
|
||||
->setEnvironment($this->getConfig()->getEnvironment())
|
||||
->send($result);
|
||||
->setProject($projectName)
|
||||
->setLogFile(Console::getLogFile())
|
||||
->setEnvironment($this->getConfig()->getEnvironment())
|
||||
->send($result);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -532,30 +532,30 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
{
|
||||
// Guess a Deploy Strategy
|
||||
switch ($this->getConfig()->deployment('strategy', self::DEFAULT_DEPLOY_STRATEGY)) {
|
||||
case self::DEPLOY_STRATEGY_DISABLED:
|
||||
$deployStrategy = 'deployment/strategy/disabled';
|
||||
break;
|
||||
case self::DEPLOY_STRATEGY_DISABLED:
|
||||
$deployStrategy = 'deployment/strategy/disabled';
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_RSYNC:
|
||||
$deployStrategy = 'deployment/strategy/rsync';
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_TARGZ:
|
||||
$deployStrategy = 'deployment/strategy/tar-gz';
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_GIT_REBASE:
|
||||
$deployStrategy = 'deployment/strategy/git-rebase';
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_GUESS:
|
||||
default:
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
$deployStrategy = 'deployment/strategy/tar-gz';
|
||||
} else {
|
||||
case self::DEPLOY_STRATEGY_RSYNC:
|
||||
$deployStrategy = 'deployment/strategy/rsync';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_TARGZ:
|
||||
$deployStrategy = 'deployment/strategy/tar-gz';
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_GIT_REBASE:
|
||||
$deployStrategy = 'deployment/strategy/git-rebase';
|
||||
break;
|
||||
|
||||
case self::DEPLOY_STRATEGY_GUESS:
|
||||
default:
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
$deployStrategy = 'deployment/strategy/tar-gz';
|
||||
} else {
|
||||
$deployStrategy = 'deployment/strategy/rsync';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $deployStrategy;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ use Mage\Console;
|
||||
class InitCommand extends AbstractCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Command for Initalize a new Configuration Proyect
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
/**
|
||||
* Command for Initalize a new Configuration Proyect
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$configDir = getcwd() . '/.mage';
|
||||
@@ -61,32 +61,32 @@ class InitCommand extends AbstractCommand
|
||||
*/
|
||||
protected function getGeneralConfig()
|
||||
{
|
||||
// Assamble Global Settings
|
||||
$projectName = $this->getConfig()->getParameter('name', '');
|
||||
$notificationEmail = $this->getConfig()->getParameter('email', '');
|
||||
$notificationEnabled = ($notificationEmail != '') ? 'true' : 'false';
|
||||
// Assamble Global Settings
|
||||
$projectName = $this->getConfig()->getParameter('name', '');
|
||||
$notificationEmail = $this->getConfig()->getParameter('email', '');
|
||||
$notificationEnabled = ($notificationEmail != '') ? 'true' : 'false';
|
||||
|
||||
$globalSettings = str_replace(
|
||||
array(
|
||||
'%projectName%',
|
||||
'%notificationEmail%',
|
||||
'%notificationEnabled%',
|
||||
'%loggingEnabled%',
|
||||
'%maxlogs%',
|
||||
'%ssh_needs_tty%',
|
||||
),
|
||||
array(
|
||||
$projectName,
|
||||
$notificationEmail,
|
||||
$notificationEnabled,
|
||||
'true',
|
||||
30,
|
||||
'false'
|
||||
),
|
||||
$this->getGeneralConfigTemplate()
|
||||
);
|
||||
$globalSettings = str_replace(
|
||||
array(
|
||||
'%projectName%',
|
||||
'%notificationEmail%',
|
||||
'%notificationEnabled%',
|
||||
'%loggingEnabled%',
|
||||
'%maxlogs%',
|
||||
'%ssh_needs_tty%',
|
||||
),
|
||||
array(
|
||||
$projectName,
|
||||
$notificationEmail,
|
||||
$notificationEnabled,
|
||||
'true',
|
||||
30,
|
||||
'false'
|
||||
),
|
||||
$this->getGeneralConfigTemplate()
|
||||
);
|
||||
|
||||
return $globalSettings;
|
||||
return $globalSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,14 +95,14 @@ class InitCommand extends AbstractCommand
|
||||
*/
|
||||
protected function getGeneralConfigTemplate()
|
||||
{
|
||||
$template = '# global settings' . PHP_EOL
|
||||
. 'name: %projectName%' . PHP_EOL
|
||||
. 'email: %notificationEmail%' . PHP_EOL
|
||||
. 'notifications: %notificationEnabled%' . PHP_EOL
|
||||
. 'logging: %loggingEnabled%' . PHP_EOL
|
||||
. 'maxlogs: %maxlogs%' . PHP_EOL
|
||||
. 'ssh_needs_tty: %ssh_needs_tty%' . PHP_EOL;
|
||||
$template = '# global settings' . PHP_EOL
|
||||
. 'name: %projectName%' . PHP_EOL
|
||||
. 'email: %notificationEmail%' . PHP_EOL
|
||||
. 'notifications: %notificationEnabled%' . PHP_EOL
|
||||
. 'logging: %loggingEnabled%' . PHP_EOL
|
||||
. 'maxlogs: %maxlogs%' . PHP_EOL
|
||||
. 'ssh_needs_tty: %ssh_needs_tty%' . PHP_EOL;
|
||||
|
||||
return $template;
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,60 +20,61 @@ use Mage\Console;
|
||||
*/
|
||||
class InstallCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* Installs Magallanes
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
/**
|
||||
* Installs Magallanes
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Console::output('Installing <dark_gray>Magallanes</dark_gray>... ', 1, 0);
|
||||
Console::output('Installing <dark_gray>Magallanes</dark_gray>... ', 1, 0);
|
||||
|
||||
// Vars
|
||||
$installDir = $this->getConfig()->getParameter('installDir', '/opt/magallanes');
|
||||
$systemWide = $this->getConfig()->getParameter('systemWide', false);
|
||||
// Vars
|
||||
$installDir = $this->getConfig()->getParameter('installDir', '/opt/magallanes');
|
||||
$systemWide = $this->getConfig()->getParameter('systemWide', false);
|
||||
|
||||
// Clean vars
|
||||
$baseDir = realpath(dirname($installDir));
|
||||
$installDir = basename($installDir);
|
||||
// Clean vars
|
||||
$baseDir = realpath(dirname($installDir));
|
||||
$installDir = basename($installDir);
|
||||
|
||||
// Check if install dir is available
|
||||
if (!is_dir($baseDir) || !is_writable($baseDir)) {
|
||||
Console::output('<red>Failure: install directory is invalid.</red>', 0, 2);
|
||||
// Check if install dir is available
|
||||
if (!is_dir($baseDir) || !is_writable($baseDir)) {
|
||||
Console::output('<red>Failure: install directory is invalid.</red>', 0, 2);
|
||||
|
||||
// Chck if it is a system wide install the user is root
|
||||
} else if ($systemWide && (getenv('LOGNAME') != 'root')) {
|
||||
Console::output('<red>Failure: you have to be root to perform a system wide install.</red>', 0, 2);
|
||||
// Chck if it is a system wide install the user is root
|
||||
} else if ($systemWide && (getenv('LOGNAME') != 'root')) {
|
||||
Console::output('<red>Failure: you have to be root to perform a system wide install.</red>', 0, 2);
|
||||
|
||||
} else {
|
||||
$destinationDir = $baseDir . '/' . $installDir;
|
||||
if (!is_dir($destinationDir)) {
|
||||
mkdir($destinationDir);
|
||||
}
|
||||
} else {
|
||||
$destinationDir = $baseDir . '/' . $installDir;
|
||||
if (!is_dir($destinationDir)) {
|
||||
mkdir($destinationDir);
|
||||
}
|
||||
|
||||
// Copy
|
||||
$this->recursiveCopy('./', $destinationDir . '/' . MAGALLANES_VERSION);
|
||||
// Copy
|
||||
$this->recursiveCopy('./', $destinationDir . '/' . MAGALLANES_VERSION);
|
||||
|
||||
// Check if there is already a symlink
|
||||
if (file_exists($destinationDir . '/' . 'latest')
|
||||
&& is_link($destinationDir . '/' . 'latest')) {
|
||||
unlink($destinationDir . '/' . 'latest');
|
||||
}
|
||||
// Check if there is already a symlink
|
||||
if (file_exists($destinationDir . '/' . 'latest')
|
||||
&& is_link($destinationDir . '/' . 'latest')
|
||||
) {
|
||||
unlink($destinationDir . '/' . 'latest');
|
||||
}
|
||||
|
||||
// Create "latest" symlink
|
||||
symlink(
|
||||
$destinationDir . '/' . MAGALLANES_VERSION,
|
||||
$destinationDir . '/' . 'latest'
|
||||
);
|
||||
chmod($destinationDir . '/' . MAGALLANES_VERSION . '/bin/mage', 0755);
|
||||
// Create "latest" symlink
|
||||
symlink(
|
||||
$destinationDir . '/' . MAGALLANES_VERSION,
|
||||
$destinationDir . '/' . 'latest'
|
||||
);
|
||||
chmod($destinationDir . '/' . MAGALLANES_VERSION . '/bin/mage', 0755);
|
||||
|
||||
if ($systemWide) {
|
||||
if (!file_exists('/usr/bin/mage')) {
|
||||
symlink($destinationDir . '/latest/bin/mage', '/usr/bin/mage');
|
||||
}
|
||||
}
|
||||
if ($systemWide) {
|
||||
if (!file_exists('/usr/bin/mage')) {
|
||||
symlink($destinationDir . '/latest/bin/mage', '/usr/bin/mage');
|
||||
}
|
||||
}
|
||||
|
||||
Console::output('<light_green>Success!</light_green>', 0, 2);
|
||||
}
|
||||
Console::output('<light_green>Success!</light_green>', 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,11 +24,11 @@ use Exception;
|
||||
*/
|
||||
class ListCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* Command for Listing Configuration Elements
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
* @throws Exception
|
||||
*/
|
||||
/**
|
||||
* Command for Listing Configuration Elements
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
* @throws Exception
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$subCommand = $this->getConfig()->getArgument(1);
|
||||
@@ -53,24 +53,24 @@ class ListCommand extends AbstractCommand
|
||||
*/
|
||||
protected function listEnvironments()
|
||||
{
|
||||
$environments = array();
|
||||
$environments = array();
|
||||
$content = scandir(getcwd() . '/.mage/config/environment/');
|
||||
foreach ($content as $file) {
|
||||
if (strpos($file, '.yml') !== false) {
|
||||
$environments[] = str_replace('.yml', '', $file);
|
||||
$environments[] = str_replace('.yml', '', $file);
|
||||
}
|
||||
}
|
||||
sort($environments);
|
||||
|
||||
if (count($environments) > 0) {
|
||||
Console::output('<dark_gray>These are your configured environments:</dark_gray>', 1, 1);
|
||||
foreach ($environments as $environment) {
|
||||
Console::output('* <light_red>' . $environment . '</light_red>', 2, 1);
|
||||
}
|
||||
Console::output('', 1, 1);
|
||||
Console::output('<dark_gray>These are your configured environments:</dark_gray>', 1, 1);
|
||||
foreach ($environments as $environment) {
|
||||
Console::output('* <light_red>' . $environment . '</light_red>', 2, 1);
|
||||
}
|
||||
Console::output('', 1, 1);
|
||||
|
||||
} else {
|
||||
Console::output('<dark_gray>You don\'t have any environment configured.</dark_gray>', 1, 2);
|
||||
Console::output('<dark_gray>You don\'t have any environment configured.</dark_gray>', 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ use Mage\Console;
|
||||
*/
|
||||
class LockCommand extends AbstractCommand implements RequiresEnvironment
|
||||
{
|
||||
/**
|
||||
* Locks the Deployment to a Environment
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
/**
|
||||
* Locks the Deployment to a Environment
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Console::output('Your name (enter to leave blank): ', 0, 0);
|
||||
|
||||
@@ -46,33 +46,33 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
|
||||
$this->getConfig()->setHost($host);
|
||||
|
||||
switch ($subCommand) {
|
||||
case 'list':
|
||||
$task = Factory::get('releases/list', $this->getConfig());
|
||||
$task->init();
|
||||
$result = $task->run();
|
||||
break;
|
||||
case 'list':
|
||||
$task = Factory::get('releases/list', $this->getConfig());
|
||||
$task->init();
|
||||
$result = $task->run();
|
||||
break;
|
||||
|
||||
case 'rollback':
|
||||
if (!is_numeric($this->getConfig()->getParameter('release', ''))) {
|
||||
Console::output('<red>Missing required releaseid.</red>', 1, 2);
|
||||
case 'rollback':
|
||||
if (!is_numeric($this->getConfig()->getParameter('release', ''))) {
|
||||
Console::output('<red>Missing required releaseid.</red>', 1, 2);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile)) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
if (file_exists($lockFile)) {
|
||||
Console::output('<red>This environment is locked!</red>', 1, 2);
|
||||
echo file_get_contents($lockFile);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$releaseId = $this->getConfig()->getParameter('release', '');
|
||||
$task = Factory::get('releases/rollback', $this->getConfig());
|
||||
$task->init();
|
||||
$task->setRelease($releaseId);
|
||||
$result = $task->run();
|
||||
break;
|
||||
$releaseId = $this->getConfig()->getParameter('release', '');
|
||||
$task = Factory::get('releases/rollback', $this->getConfig());
|
||||
$task->init();
|
||||
$task->setRelease($releaseId);
|
||||
$result = $task->run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ use Mage\Console;
|
||||
class UnlockCommand
|
||||
extends AbstractCommand implements RequiresEnvironment
|
||||
{
|
||||
/**
|
||||
* Unlocks an Environment
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
/**
|
||||
* Unlocks an Environment
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
|
||||
|
||||
@@ -21,10 +21,10 @@ use Mage\Console;
|
||||
*/
|
||||
class UpdateCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* Updates the SCM Base Code
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
/**
|
||||
* Updates the SCM Base Code
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$task = Factory::get('scm/update', $this->getConfig());
|
||||
|
||||
@@ -20,10 +20,10 @@ use Mage\Console;
|
||||
*/
|
||||
class UpgradeCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* Source for downloading
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* Source for downloading
|
||||
* @var string
|
||||
*/
|
||||
const DOWNLOAD = 'http://download.magephp.com/magallanes.{version}.tar.gz';
|
||||
|
||||
/**
|
||||
@@ -51,47 +51,47 @@ class UpgradeCommand extends AbstractCommand
|
||||
Console::output('You need to be the <dark_gray>' . $owner . '</dark_gray> user to perform the upgrade, or <dark_gray>root</dark_gray>.', 2);
|
||||
|
||||
} else {
|
||||
// Check version
|
||||
$version = json_decode(file_get_contents(self::UPGRADE));
|
||||
// Check version
|
||||
$version = json_decode(file_get_contents(self::UPGRADE));
|
||||
|
||||
if ($version !== false && $version !== null) {
|
||||
$versionCompare = version_compare(MAGALLANES_VERSION, $version->latest);
|
||||
if ($versionCompare == 0) {
|
||||
Console::output('<yellow>SKIP</yellow>', 0, 1);
|
||||
Console::output('Your current version is up to date.', 2);
|
||||
if ($version !== false && $version !== null) {
|
||||
$versionCompare = version_compare(MAGALLANES_VERSION, $version->latest);
|
||||
if ($versionCompare == 0) {
|
||||
Console::output('<yellow>SKIP</yellow>', 0, 1);
|
||||
Console::output('Your current version is up to date.', 2);
|
||||
|
||||
} else if ($versionCompare == 1) {
|
||||
Console::output('<yellow>SKIP</yellow>', 0, 1);
|
||||
Console::output('Your current version is newer.', 2);
|
||||
} else if ($versionCompare == 1) {
|
||||
Console::output('<yellow>SKIP</yellow>', 0, 1);
|
||||
Console::output('Your current version is newer.', 2);
|
||||
|
||||
} else if ($versionCompare == -1) {
|
||||
// Download Package
|
||||
$tarball = file_get_contents(str_replace('{version}', $version->latest, self::DOWNLOAD));
|
||||
if ($tarball === false) {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Corrupted download.', 2);
|
||||
} else if ($versionCompare == -1) {
|
||||
// Download Package
|
||||
$tarball = file_get_contents(str_replace('{version}', $version->latest, self::DOWNLOAD));
|
||||
if ($tarball === false) {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Corrupted download.', 2);
|
||||
|
||||
} else {
|
||||
$tarballFile = tempnam('/tmp', 'magallanes_download');
|
||||
rename($tarballFile, $tarballFile . '.tar.gz');
|
||||
$tarballFile .= '.tar.gz';
|
||||
file_put_contents($tarballFile, $tarball);
|
||||
} else {
|
||||
$tarballFile = tempnam('/tmp', 'magallanes_download');
|
||||
rename($tarballFile, $tarballFile . '.tar.gz');
|
||||
$tarballFile .= '.tar.gz';
|
||||
file_put_contents($tarballFile, $tarball);
|
||||
|
||||
Console::executeCommand('rm -rf ' . MAGALLANES_DIRECTORY);
|
||||
Console::executeCommand('cd ' . dirname($tarballFile) . ' && tar xfz ' . $tarballFile);
|
||||
Console::executeCommand('mv ' . dirname($tarballFile) . '/magallanes ' . MAGALLANES_DIRECTORY);
|
||||
Console::executeCommand('rm -rf ' . MAGALLANES_DIRECTORY);
|
||||
Console::executeCommand('cd ' . dirname($tarballFile) . ' && tar xfz ' . $tarballFile);
|
||||
Console::executeCommand('mv ' . dirname($tarballFile) . '/magallanes ' . MAGALLANES_DIRECTORY);
|
||||
|
||||
Console::output('<green>OK</green>', 0, 1);
|
||||
}
|
||||
Console::output('<green>OK</green>', 0, 1);
|
||||
}
|
||||
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Invalid version.', 2);
|
||||
}
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Invalid version.', 2);
|
||||
}
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Invalid version.', 2);
|
||||
}
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Invalid version.', 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ use Mage\Console;
|
||||
*/
|
||||
class VersionCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* Display the Magallanes Version
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
/**
|
||||
* Display the Magallanes Version
|
||||
* @see \Mage\Command\AbstractCommand::run()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Console::output('Running <blue>Magallanes</blue> version <dark_gray>' . MAGALLANES_VERSION .'</dark_gray>', 0, 2);
|
||||
Console::output('Running <blue>Magallanes</blue> version <dark_gray>' . MAGALLANES_VERSION . '</dark_gray>', 0, 2);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user