[Nostromo] Refactor Runtime, added getEnvParam method

This commit is contained in:
Andrés Montañez
2017-01-11 17:59:41 -03:00
parent f407e9d92d
commit c9ec69e385
17 changed files with 62 additions and 61 deletions
+4 -4
View File
@@ -70,7 +70,7 @@ 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->getEnvironmentConfig('releases', false)) {
if ($this->runtime->getEnvParam('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()));
@@ -86,8 +86,8 @@ class DeployCommand extends AbstractCommand
$this->runtime->setEnvironmentConfig('branch', $input->getOption('branch'));
}
if ($this->runtime->getEnvironmentConfig('branch', false)) {
$output->writeln(sprintf(' Branch: <fg=green>%s</>', $this->runtime->getEnvironmentConfig('branch')));
if ($this->runtime->getEnvParam('branch', false)) {
$output->writeln(sprintf(' Branch: <fg=green>%s</>', $this->runtime->getEnvParam('branch')));
}
$output->writeln('');
@@ -140,7 +140,7 @@ class DeployCommand extends AbstractCommand
protected function runOnHosts(OutputInterface $output, $tasks)
{
$hosts = $this->runtime->getEnvironmentConfig('hosts');
$hosts = $this->runtime->getEnvParam('hosts');
if (count($hosts) == 0) {
$output->writeln(sprintf(' No hosts defined, skipping %s tasks', $this->getStageName()));
$output->writeln('');
+3 -3
View File
@@ -58,7 +58,7 @@ class ListCommand extends AbstractCommand
try {
$this->runtime->setEnvironment($input->getArgument('environment'));
if (!$this->runtime->getEnvironmentConfig('releases', false)) {
if (!$this->runtime->getEnvParam('releases', false)) {
throw new RuntimeException('Releases are not enabled', 70);
}
@@ -71,12 +71,12 @@ class ListCommand extends AbstractCommand
$output->writeln('');
$hosts = $this->runtime->getEnvironmentConfig('hosts');
$hosts = $this->runtime->getEnvParam('hosts');
if (count($hosts) == 0) {
$output->writeln('No hosts defined');
$output->writeln('');
} else {
$hostPath = rtrim($this->runtime->getEnvironmentConfig('host_path'), '/');
$hostPath = rtrim($this->runtime->getEnvParam('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->getEnvironmentConfig('releases', false)) {
if (!$this->runtime->getEnvParam('releases', false)) {
throw new RuntimeException('Releases are not enabled', 70);
}
@@ -104,8 +104,8 @@ class RollbackCommand extends DeployCommand
*/
protected function checkReleaseAvailability($releaseToRollback)
{
$hosts = $this->runtime->getEnvironmentConfig('hosts');
$hostPath = rtrim($this->runtime->getEnvironmentConfig('host_path'), '/');
$hosts = $this->runtime->getEnvParam('hosts');
$hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/');
$availableInHosts = 0;
foreach ($hosts as $host) {