mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-06 09:28:57 +02:00
PSR-2 Fixer
This commit is contained in:
@@ -12,7 +12,6 @@ namespace Mage\Command\BuiltIn;
|
||||
|
||||
use Mage\Command\AbstractCommand;
|
||||
use Mage\Console;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,6 @@ use Mage\Task\SkipException;
|
||||
use Mage\Console;
|
||||
use Mage\Config;
|
||||
use Mage\Mailer;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
@@ -172,7 +171,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
if (self::$failedTasks > 0) {
|
||||
self::$deployStatus = self::FAILED;
|
||||
Console::output('A total of <bold>' . self::$failedTasks . '</bold> deployment tasks failed: <red>ABORTING</red>', 1, 2);
|
||||
|
||||
} else {
|
||||
// Run Deployment Tasks
|
||||
$this->runDeploymentTasks();
|
||||
@@ -265,7 +263,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
if (count($tasksToRun) == 0) {
|
||||
Console::output('<bold>No </bold><light_cyan>' . $title . '</light_cyan> <bold>tasks defined.</bold>', 1, 3);
|
||||
|
||||
} else {
|
||||
Console::output('Starting <bold>' . $title . '</bold> tasks:');
|
||||
|
||||
@@ -306,7 +303,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
if ($this->hostsCount == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <bold>No hosts defined, skipping deployment tasks.</bold>', 1, 3);
|
||||
|
||||
} else {
|
||||
$this->startTimeHosts = time();
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
@@ -337,7 +333,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
if (count($tasksToRun) == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <bold>No </bold><light_cyan>Deployment</light_cyan> <bold>tasks defined.</bold>', 2);
|
||||
Console::output('Deployment to <bold>' . $host . '</bold> skipped!', 1, 3);
|
||||
|
||||
} else {
|
||||
foreach ($tasksToRun as $taskData) {
|
||||
$tasks++;
|
||||
@@ -443,21 +438,20 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
}
|
||||
}
|
||||
|
||||
protected function runRollbackTask(AbstractTask $task){
|
||||
protected function runRollbackTask(AbstractTask $task)
|
||||
{
|
||||
$this->getConfig()->reload();
|
||||
$hosts = $this->getConfig()->getHosts();
|
||||
|
||||
Console::output("",1,2);
|
||||
Console::output("Starting the <bold>rollback</bold>",1,1);
|
||||
|
||||
if(!in_array($task->getStage(), $this->acceptedStagesToRollback ) ) {
|
||||
$stagesString = implode(', ',$this->acceptedStagesToRollback);
|
||||
Console::output("<light_purple>Warning!</light_purple> <bold>Rollback during deployment can be called only at the stages: $stagesString <bold>",1);
|
||||
Console::output("<bold>Rollback:<bold> <red>ABORTING</red>",1,3);
|
||||
Console::output("", 1, 2);
|
||||
Console::output("Starting the <bold>rollback</bold>", 1, 1);
|
||||
|
||||
if (!in_array($task->getStage(), $this->acceptedStagesToRollback)) {
|
||||
$stagesString = implode(', ', $this->acceptedStagesToRollback);
|
||||
Console::output("<light_purple>Warning!</light_purple> <bold>Rollback during deployment can be called only at the stages: $stagesString <bold>", 1);
|
||||
Console::output("<bold>Rollback:<bold> <red>ABORTING</red>", 1, 3);
|
||||
} elseif (count($hosts) == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <bold>No hosts defined, unable to get releases.</bold>', 1, 3);
|
||||
|
||||
} else {
|
||||
$result = true;
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
@@ -482,7 +476,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
);
|
||||
$task->init();
|
||||
$result = $task->run() && $result;
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -506,7 +499,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
Console::output($title, 2, 0);
|
||||
|
||||
$runTask = true;
|
||||
if (($task instanceOf SkipOnOverride) && $this->getConfig()->getParameter('overrideRelease', false)) {
|
||||
if (($task instanceof SkipOnOverride) && $this->getConfig()->getParameter('overrideRelease', false)) {
|
||||
$runTask = false;
|
||||
}
|
||||
|
||||
@@ -517,7 +510,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
if ($result === true) {
|
||||
Console::output('<green>OK</green>', 0);
|
||||
$result = true;
|
||||
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>', 0);
|
||||
$result = false;
|
||||
@@ -526,15 +518,12 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
Console::output('<red>FAIL, Rollback catched</red> [Message: ' . $e->getMessage() . ']', 0);
|
||||
$this->runRollbackTask($task);
|
||||
$result = false;
|
||||
|
||||
} catch (ErrorWithMessageException $e) {
|
||||
Console::output('<red>FAIL</red> [Message: ' . $e->getMessage() . ']', 0);
|
||||
$result = false;
|
||||
|
||||
} catch (SkipException $e) {
|
||||
Console::output('<yellow>SKIPPED</yellow>', 0);
|
||||
$result = true;
|
||||
|
||||
} catch (Exception $e) {
|
||||
Console::output('<red>FAIL</red>', 0);
|
||||
$result = false;
|
||||
@@ -645,7 +634,6 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
*/
|
||||
protected function chooseReleaseStrategy()
|
||||
{
|
||||
|
||||
if ($this->getConfig()->release('enabled', self::DEFAULT_RELEASE_IS_ENABLED)
|
||||
&& $this->getConfig()->deployment('strategy', self::DEFAULT_DEPLOY_STRATEGY) !== self::DEPLOY_STRATEGY_DISABLED
|
||||
) {
|
||||
@@ -656,5 +644,4 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
return $strategy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ class InitCommand extends AbstractCommand
|
||||
Console::output('<light_green>Success!!</light_green> The configuration for <bold>Magallanes</bold> has been generated at <blue>.mage</blue> directory.');
|
||||
Console::output('<bold>Please!! Review and adjust the configuration.</bold>', 2, 2);
|
||||
$exitCode = 0;
|
||||
|
||||
} else {
|
||||
Console::output('<light_red>Error!!</light_red> Unable to generate the configuration.', 1, 2);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,8 @@ class InstallCommand extends AbstractCommand
|
||||
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')) {
|
||||
} elseif ($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)) {
|
||||
@@ -104,7 +103,6 @@ class InstallCommand extends AbstractCommand
|
||||
$from . DIRECTORY_SEPARATOR . $file,
|
||||
$to . DIRECTORY_SEPARATOR . $file
|
||||
);
|
||||
|
||||
} else {
|
||||
copy(
|
||||
$from . DIRECTORY_SEPARATOR . $file,
|
||||
@@ -114,10 +112,8 @@ class InstallCommand extends AbstractCommand
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
} elseif (is_file($from)) {
|
||||
return copy($from, $to);
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Mage\Command\BuiltIn;
|
||||
|
||||
use Mage\Command\AbstractCommand;
|
||||
use Mage\Console;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
@@ -73,7 +72,6 @@ class ListCommand extends AbstractCommand
|
||||
}
|
||||
Console::output('', 1, 1);
|
||||
$exitCode = 0;
|
||||
|
||||
} else {
|
||||
Console::output('<bold>You don\'t have any environment configured.</bold>', 1, 2);
|
||||
}
|
||||
|
||||
@@ -58,5 +58,4 @@ class LockCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
if (count($hosts) == 0) {
|
||||
Console::output('<light_purple>Warning!</light_purple> <bold>No hosts defined, unable to get releases.</bold>', 1, 3);
|
||||
|
||||
} else {
|
||||
$result = true;
|
||||
foreach ($hosts as $hostKey => $host) {
|
||||
|
||||
@@ -41,5 +41,4 @@ class UnlockCommand extends AbstractCommand implements RequiresEnvironment
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ class UpdateCommand extends AbstractCommand
|
||||
if ($result === true) {
|
||||
Console::output('<green>OK</green>' . PHP_EOL, 0);
|
||||
$exitCode = 0;
|
||||
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>' . PHP_EOL, 0);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ class UpgradeCommand extends AbstractCommand
|
||||
if ($user != 'root' && $user != $owner) {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('You need to be the <bold>' . $owner . '</bold> user to perform the upgrade, or <bold>root</bold>.', 2);
|
||||
|
||||
} else {
|
||||
// Check version
|
||||
$version = json_decode(file_get_contents(self::UPGRADE));
|
||||
@@ -61,19 +60,16 @@ class UpgradeCommand extends AbstractCommand
|
||||
Console::output('<yellow>SKIP</yellow>', 0, 1);
|
||||
Console::output('Your current version is up to date.', 2);
|
||||
$exitCode = 0;
|
||||
|
||||
} else if ($versionCompare == 1) {
|
||||
} elseif ($versionCompare == 1) {
|
||||
Console::output('<yellow>SKIP</yellow>', 0, 1);
|
||||
Console::output('Your current version is newer.', 2);
|
||||
$exitCode = 0;
|
||||
|
||||
} else if ($versionCompare == -1) {
|
||||
} elseif ($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');
|
||||
@@ -87,7 +83,6 @@ class UpgradeCommand extends AbstractCommand
|
||||
Console::output('<green>OK</green>', 0, 1);
|
||||
$exitCode = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
Console::output('<red>FAIL</red>', 0, 1);
|
||||
Console::output('Invalid version.', 2);
|
||||
|
||||
Reference in New Issue
Block a user