mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-08 14:28:57 +02:00
[Nostromo] Refactor Runtime methods.
This commit is contained in:
@@ -48,7 +48,7 @@ class EnvironmentsCommand extends AbstractCommand
|
||||
$table = new Table($output);
|
||||
$table->setHeaders(['Environment', 'User', 'Branch', 'Hosts']);
|
||||
|
||||
$configuration = $this->runtime->getConfigOptions('environments');
|
||||
$configuration = $this->runtime->getConfigOption('environments');
|
||||
foreach ($configuration as $environment => $config) {
|
||||
$row = [$environment];
|
||||
|
||||
|
||||
@@ -70,24 +70,24 @@ class DeployCommand extends AbstractCommand
|
||||
$output->writeln(sprintf(' Environment: <fg=green>%s</>', $this->runtime->getEnvironment()));
|
||||
$this->log(sprintf('Environment: %s', $this->runtime->getEnvironment()));
|
||||
|
||||
if ($this->runtime->getEnvParam('releases', false)) {
|
||||
if ($this->runtime->getEnvOption('releases', false)) {
|
||||
$this->runtime->generateReleaseId();
|
||||
$output->writeln(sprintf(' Release ID: <fg=green>%s</>', $this->runtime->getReleaseId()));
|
||||
$this->log(sprintf('Release ID: %s', $this->runtime->getReleaseId()));
|
||||
}
|
||||
|
||||
if ($this->runtime->getConfigOptions('log_file', false)) {
|
||||
$output->writeln(sprintf(' Logfile: <fg=green>%s</>', $this->runtime->getConfigOptions('log_file')));
|
||||
if ($this->runtime->getConfigOption('log_file', false)) {
|
||||
$output->writeln(sprintf(' Logfile: <fg=green>%s</>', $this->runtime->getConfigOption('log_file')));
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(' Strategy: <fg=green>%s</>', $strategy->getName()));
|
||||
|
||||
if ($input->getOption('branch') !== false) {
|
||||
$this->runtime->setEnvironmentConfig('branch', $input->getOption('branch'));
|
||||
$this->runtime->setEnvOption('branch', $input->getOption('branch'));
|
||||
}
|
||||
|
||||
if ($this->runtime->getEnvParam('branch', false)) {
|
||||
$output->writeln(sprintf(' Branch: <fg=green>%s</>', $this->runtime->getEnvParam('branch')));
|
||||
if ($this->runtime->getEnvOption('branch', false)) {
|
||||
$output->writeln(sprintf(' Branch: <fg=green>%s</>', $this->runtime->getEnvOption('branch')));
|
||||
}
|
||||
|
||||
$output->writeln('');
|
||||
@@ -140,7 +140,7 @@ class DeployCommand extends AbstractCommand
|
||||
|
||||
protected function runOnHosts(OutputInterface $output, $tasks)
|
||||
{
|
||||
$hosts = $this->runtime->getEnvParam('hosts');
|
||||
$hosts = $this->runtime->getEnvOption('hosts');
|
||||
if (count($hosts) == 0) {
|
||||
$output->writeln(sprintf(' No hosts defined, skipping %s tasks', $this->getStageName()));
|
||||
$output->writeln('');
|
||||
|
||||
@@ -58,25 +58,25 @@ class ListCommand extends AbstractCommand
|
||||
try {
|
||||
$this->runtime->setEnvironment($input->getArgument('environment'));
|
||||
|
||||
if (!$this->runtime->getEnvParam('releases', false)) {
|
||||
if (!$this->runtime->getEnvOption('releases', false)) {
|
||||
throw new RuntimeException('Releases are not enabled', 70);
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(' Environment: <fg=green>%s</>', $this->runtime->getEnvironment()));
|
||||
$this->log(sprintf('Environment: %s', $this->runtime->getEnvironment()));
|
||||
|
||||
if ($this->runtime->getConfigOptions('log_file', false)) {
|
||||
$output->writeln(sprintf(' Logfile: <fg=green>%s</>', $this->runtime->getConfigOptions('log_file')));
|
||||
if ($this->runtime->getConfigOption('log_file', false)) {
|
||||
$output->writeln(sprintf(' Logfile: <fg=green>%s</>', $this->runtime->getConfigOption('log_file')));
|
||||
}
|
||||
|
||||
$output->writeln('');
|
||||
|
||||
$hosts = $this->runtime->getEnvParam('hosts');
|
||||
$hosts = $this->runtime->getEnvOption('hosts');
|
||||
if (count($hosts) == 0) {
|
||||
$output->writeln('No hosts defined');
|
||||
$output->writeln('');
|
||||
} else {
|
||||
$hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/');
|
||||
$hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/');
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$this->runtime->setWorkingHost($host);
|
||||
|
||||
@@ -61,7 +61,7 @@ class RollbackCommand extends DeployCommand
|
||||
$strategy = $this->runtime->guessStrategy();
|
||||
$this->taskFactory = new TaskFactory($this->runtime);
|
||||
|
||||
if (!$this->runtime->getEnvParam('releases', false)) {
|
||||
if (!$this->runtime->getEnvOption('releases', false)) {
|
||||
throw new RuntimeException('Releases are not enabled', 70);
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ class RollbackCommand extends DeployCommand
|
||||
$output->writeln(sprintf(' Rollback to Release Id: <fg=green>%s</>', $this->runtime->getReleaseId()));
|
||||
$this->log(sprintf('Release ID: %s', $this->runtime->getReleaseId()));
|
||||
|
||||
if ($this->runtime->getConfigOptions('log_file', false)) {
|
||||
$output->writeln(sprintf(' Logfile: <fg=green>%s</>', $this->runtime->getConfigOptions('log_file')));
|
||||
if ($this->runtime->getConfigOption('log_file', false)) {
|
||||
$output->writeln(sprintf(' Logfile: <fg=green>%s</>', $this->runtime->getConfigOption('log_file')));
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(' Strategy: <fg=green>%s</>', $strategy->getName()));
|
||||
@@ -104,8 +104,8 @@ class RollbackCommand extends DeployCommand
|
||||
*/
|
||||
protected function checkReleaseAvailability($releaseToRollback)
|
||||
{
|
||||
$hosts = $this->runtime->getEnvParam('hosts');
|
||||
$hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/');
|
||||
$hosts = $this->runtime->getEnvOption('hosts');
|
||||
$hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/');
|
||||
|
||||
$availableInHosts = 0;
|
||||
foreach ($hosts as $host) {
|
||||
|
||||
Reference in New Issue
Block a user