From b095cd0bb853ac9f7b8842349ee66ec3e9e6cde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Wed, 11 Jan 2017 22:22:21 -0300 Subject: [PATCH] [Nostromo] Refactor Runtime methods. --- .../BuiltIn/Config/EnvironmentsCommand.php | 2 +- src/Command/BuiltIn/DeployCommand.php | 14 ++--- src/Command/BuiltIn/Releases/ListCommand.php | 10 +-- .../BuiltIn/Releases/RollbackCommand.php | 10 +-- .../{Releases => }/ReleasesStrategy.php | 3 +- .../Strategy/{Rsync => }/RsyncStrategy.php | 3 +- src/Runtime/Runtime.php | 61 ++++++++----------- .../BuiltIn/Composer/DumpAutoloadTask.php | 2 +- src/Task/BuiltIn/Composer/InstallTask.php | 2 +- .../BuiltIn/Deploy/Release/CleanupTask.php | 4 +- .../BuiltIn/Deploy/Release/PrepareTask.php | 2 +- src/Task/BuiltIn/Deploy/ReleaseTask.php | 4 +- src/Task/BuiltIn/Deploy/RsyncTask.php | 10 +-- src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php | 2 +- src/Task/BuiltIn/Deploy/TarGz/CopyTask.php | 6 +- src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php | 4 +- src/Task/BuiltIn/Git/ChangeBranchTask.php | 2 +- src/Task/BuiltIn/Git/UpdateTask.php | 2 +- src/Task/BuiltIn/Symfony/AsseticDumpTask.php | 4 +- .../BuiltIn/Symfony/AssetsInstallTask.php | 4 +- src/Task/BuiltIn/Symfony/CacheClearTask.php | 4 +- src/Task/BuiltIn/Symfony/CacheWarmupTask.php | 4 +- tests/Deploy/StrategyTest.php | 4 +- tests/Runtime/RuntimeTest.php | 20 ------ 24 files changed, 75 insertions(+), 108 deletions(-) rename src/Deploy/Strategy/{Releases => }/ReleasesStrategy.php (97%) rename src/Deploy/Strategy/{Rsync => }/RsyncStrategy.php (96%) diff --git a/src/Command/BuiltIn/Config/EnvironmentsCommand.php b/src/Command/BuiltIn/Config/EnvironmentsCommand.php index e5b010e..566f83e 100644 --- a/src/Command/BuiltIn/Config/EnvironmentsCommand.php +++ b/src/Command/BuiltIn/Config/EnvironmentsCommand.php @@ -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]; diff --git a/src/Command/BuiltIn/DeployCommand.php b/src/Command/BuiltIn/DeployCommand.php index ea6a67e..a5cc2d5 100644 --- a/src/Command/BuiltIn/DeployCommand.php +++ b/src/Command/BuiltIn/DeployCommand.php @@ -70,24 +70,24 @@ class DeployCommand extends AbstractCommand $output->writeln(sprintf(' Environment: %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: %s', $this->runtime->getReleaseId())); $this->log(sprintf('Release ID: %s', $this->runtime->getReleaseId())); } - if ($this->runtime->getConfigOptions('log_file', false)) { - $output->writeln(sprintf(' Logfile: %s', $this->runtime->getConfigOptions('log_file'))); + if ($this->runtime->getConfigOption('log_file', false)) { + $output->writeln(sprintf(' Logfile: %s', $this->runtime->getConfigOption('log_file'))); } $output->writeln(sprintf(' Strategy: %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: %s', $this->runtime->getEnvParam('branch'))); + if ($this->runtime->getEnvOption('branch', false)) { + $output->writeln(sprintf(' Branch: %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(''); diff --git a/src/Command/BuiltIn/Releases/ListCommand.php b/src/Command/BuiltIn/Releases/ListCommand.php index d4b5d22..5c034c9 100644 --- a/src/Command/BuiltIn/Releases/ListCommand.php +++ b/src/Command/BuiltIn/Releases/ListCommand.php @@ -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: %s', $this->runtime->getEnvironment())); $this->log(sprintf('Environment: %s', $this->runtime->getEnvironment())); - if ($this->runtime->getConfigOptions('log_file', false)) { - $output->writeln(sprintf(' Logfile: %s', $this->runtime->getConfigOptions('log_file'))); + if ($this->runtime->getConfigOption('log_file', false)) { + $output->writeln(sprintf(' Logfile: %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); diff --git a/src/Command/BuiltIn/Releases/RollbackCommand.php b/src/Command/BuiltIn/Releases/RollbackCommand.php index 961a4f7..794ad5d 100644 --- a/src/Command/BuiltIn/Releases/RollbackCommand.php +++ b/src/Command/BuiltIn/Releases/RollbackCommand.php @@ -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: %s', $this->runtime->getReleaseId())); $this->log(sprintf('Release ID: %s', $this->runtime->getReleaseId())); - if ($this->runtime->getConfigOptions('log_file', false)) { - $output->writeln(sprintf(' Logfile: %s', $this->runtime->getConfigOptions('log_file'))); + if ($this->runtime->getConfigOption('log_file', false)) { + $output->writeln(sprintf(' Logfile: %s', $this->runtime->getConfigOption('log_file'))); } $output->writeln(sprintf(' Strategy: %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) { diff --git a/src/Deploy/Strategy/Releases/ReleasesStrategy.php b/src/Deploy/Strategy/ReleasesStrategy.php similarity index 97% rename from src/Deploy/Strategy/Releases/ReleasesStrategy.php rename to src/Deploy/Strategy/ReleasesStrategy.php index 6897b8b..0ae0bdf 100644 --- a/src/Deploy/Strategy/Releases/ReleasesStrategy.php +++ b/src/Deploy/Strategy/ReleasesStrategy.php @@ -8,11 +8,10 @@ * file that was distributed with this source code. */ -namespace Mage\Deploy\Strategy\Releases; +namespace Mage\Deploy\Strategy; use Mage\Runtime\Exception\RuntimeException; use Mage\Runtime\Runtime; -use Mage\Deploy\Strategy\StrategyInterface; /** * Strategy for Deployment with Releases, using TarGz and SCP diff --git a/src/Deploy/Strategy/Rsync/RsyncStrategy.php b/src/Deploy/Strategy/RsyncStrategy.php similarity index 96% rename from src/Deploy/Strategy/Rsync/RsyncStrategy.php rename to src/Deploy/Strategy/RsyncStrategy.php index f6b5376..499a6f6 100644 --- a/src/Deploy/Strategy/Rsync/RsyncStrategy.php +++ b/src/Deploy/Strategy/RsyncStrategy.php @@ -8,11 +8,10 @@ * file that was distributed with this source code. */ -namespace Mage\Deploy\Strategy\Rsync; +namespace Mage\Deploy\Strategy; use Mage\Runtime\Exception\RuntimeException; use Mage\Runtime\Runtime; -use Mage\Deploy\Strategy\StrategyInterface; /** * Strategy for Deployment with Rsync diff --git a/src/Runtime/Runtime.php b/src/Runtime/Runtime.php index a3001c0..b7b5aec 100644 --- a/src/Runtime/Runtime.php +++ b/src/Runtime/Runtime.php @@ -10,8 +10,8 @@ namespace Mage\Runtime; -use Mage\Deploy\Strategy\Releases\ReleasesStrategy; -use Mage\Deploy\Strategy\Rsync\RsyncStrategy; +use Mage\Deploy\Strategy\ReleasesStrategy; +use Mage\Deploy\Strategy\RsyncStrategy; use Mage\Deploy\Strategy\StrategyInterface; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; @@ -190,13 +190,13 @@ class Runtime } /** - * Retrieves the Configuration options for a specific section in the configuration + * Retrieves the Configuration Option for a specific section in the configuration * * @param string $key Section name * @param mixed $default Default value * @return mixed */ - public function getConfigOptions($key, $default = null) + public function getConfigOption($key, $default = null) { if (array_key_exists($key, $this->configuration)) { return $this->configuration[$key]; @@ -206,31 +206,13 @@ class Runtime } /** - * Returns the configuration for the current Environment - * - * @return array - */ - public function getEnvironmentConfig() - { - if (!array_key_exists('environments', $this->configuration) || !is_array($this->configuration['environments'])) { - return []; - } - - if (!array_key_exists($this->environment, $this->configuration['environments'])) { - return []; - } - - return $this->configuration['environments'][$this->environment]; - } - - /** - * Returns the configuration parameter for the current Environment + * Returns the Configuration Option for a specific section the current Environment * * @param string $key Section/Parameter name * @param mixed $default Default value * @return mixed */ - public function getEnvParam($key, $default = null) + public function getEnvOption($key, $default = null) { if (!array_key_exists('environments', $this->configuration) || !is_array($this->configuration['environments'])) { return $default; @@ -248,13 +230,13 @@ class Runtime } /** - * Overwrites an Environment configuration option + * Overwrites an Environment Configuration Option * * @param string $key * @param mixed $value * @return Runtime */ - public function setEnvironmentConfig($key, $value) + public function setEnvOption($key, $value) { if (array_key_exists('environments', $this->configuration) && is_array($this->configuration['environments'])) { if (array_key_exists($this->environment, $this->configuration['environments'])) { @@ -321,10 +303,17 @@ class Runtime */ public function getTasks() { - $config = $this->getEnvironmentConfig(); - if (array_key_exists($this->stage, $config)) { - if (is_array($config[$this->stage])) { - return $config[$this->stage]; + if (!array_key_exists('environments', $this->configuration) || !is_array($this->configuration['environments'])) { + return []; + } + + if (!array_key_exists($this->environment, $this->configuration['environments'])) { + return []; + } + + if (array_key_exists($this->stage, $this->configuration['environments'][$this->environment])) { + if (is_array($this->configuration['environments'][$this->environment][$this->stage])) { + return $this->configuration['environments'][$this->environment][$this->stage]; } } @@ -420,8 +409,8 @@ class Runtime */ public function runRemoteCommand($cmd, $jail, $timeout = 120) { - $user = $this->getEnvParam('user'); - $sudo = $this->getEnvParam('sudo', false); + $user = $this->getEnvOption('user'); + $sudo = $this->getEnvOption('sudo', false); $host = $this->getWorkingHost(); $sshConfig = $this->getSSHConfig(); @@ -430,7 +419,7 @@ class Runtime $cmdDelegate = sprintf('sudo %s', $cmd); } - $hostPath = rtrim($this->getEnvParam('host_path'), '/'); + $hostPath = rtrim($this->getEnvOption('host_path'), '/'); if ($jail && $this->getReleaseId()) { $cmdDelegate = sprintf('cd %s/releases/%s && %s', $hostPath, $this->getReleaseId(), $cmdDelegate); } elseif ($jail) { @@ -450,7 +439,7 @@ class Runtime */ public function getSSHConfig() { - $sshConfig = $this->getEnvParam('ssh', ['port' => '22', 'flags' => '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no']); + $sshConfig = $this->getEnvOption('ssh', ['port' => '22', 'flags' => '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no']); if (!array_key_exists('port', $sshConfig)) { $sshConfig['port'] = '22'; @@ -491,7 +480,7 @@ class Runtime */ public function getBranch() { - return $this->getEnvParam('branch', false); + return $this->getEnvOption('branch', false); } /** @@ -503,7 +492,7 @@ class Runtime { $strategy = new RsyncStrategy(); - if ($this->getEnvParam('releases', false)) { + if ($this->getEnvOption('releases', false)) { $strategy = new ReleasesStrategy(); } diff --git a/src/Task/BuiltIn/Composer/DumpAutoloadTask.php b/src/Task/BuiltIn/Composer/DumpAutoloadTask.php index f290800..b778413 100644 --- a/src/Task/BuiltIn/Composer/DumpAutoloadTask.php +++ b/src/Task/BuiltIn/Composer/DumpAutoloadTask.php @@ -43,7 +43,7 @@ class DumpAutoloadTask extends AbstractTask protected function getOptions() { - $userOptions = $this->runtime->getConfigOptions('composer', []); + $userOptions = $this->runtime->getConfigOption('composer', []); $options = array_merge( ['path' => 'composer', 'flags' => '--optimize'], (is_array($userOptions) ? $userOptions : []), diff --git a/src/Task/BuiltIn/Composer/InstallTask.php b/src/Task/BuiltIn/Composer/InstallTask.php index 4ecb1e3..ce97361 100644 --- a/src/Task/BuiltIn/Composer/InstallTask.php +++ b/src/Task/BuiltIn/Composer/InstallTask.php @@ -43,7 +43,7 @@ class InstallTask extends AbstractTask protected function getOptions() { - $userOptions = $this->runtime->getConfigOptions('composer', []); + $userOptions = $this->runtime->getConfigOption('composer', []); $options = array_merge( ['path' => 'composer', 'flags' => '--optimize-autoloader'], (is_array($userOptions) ? $userOptions : []), diff --git a/src/Task/BuiltIn/Deploy/Release/CleanupTask.php b/src/Task/BuiltIn/Deploy/Release/CleanupTask.php index f5f288c..c0c7276 100644 --- a/src/Task/BuiltIn/Deploy/Release/CleanupTask.php +++ b/src/Task/BuiltIn/Deploy/Release/CleanupTask.php @@ -32,9 +32,9 @@ class CleanupTask extends AbstractTask public function execute() { - $hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/'); + $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/'); $currentReleaseId = $this->runtime->getReleaseId(); - $maxReleases = $this->runtime->getEnvParam('releases'); + $maxReleases = $this->runtime->getEnvOption('releases'); $cmdListReleases = sprintf('ls -1 %s/releases', $hostPath); diff --git a/src/Task/BuiltIn/Deploy/Release/PrepareTask.php b/src/Task/BuiltIn/Deploy/Release/PrepareTask.php index a4f6651..74117b5 100644 --- a/src/Task/BuiltIn/Deploy/Release/PrepareTask.php +++ b/src/Task/BuiltIn/Deploy/Release/PrepareTask.php @@ -32,7 +32,7 @@ class PrepareTask extends AbstractTask public function execute() { - $hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/'); + $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/'); $cmdMakeDir = sprintf('mkdir -p %s/releases/%s', $hostPath, $this->runtime->getReleaseId()); diff --git a/src/Task/BuiltIn/Deploy/ReleaseTask.php b/src/Task/BuiltIn/Deploy/ReleaseTask.php index f3dbf82..ad0dd00 100644 --- a/src/Task/BuiltIn/Deploy/ReleaseTask.php +++ b/src/Task/BuiltIn/Deploy/ReleaseTask.php @@ -34,11 +34,11 @@ class ReleaseTask extends AbstractTask implements ExecuteOnRollbackInterface public function execute() { - if (!$this->runtime->getEnvParam('releases', false)) { + if (!$this->runtime->getEnvOption('releases', false)) { throw new ErrorException('This task is only available with releases enabled', 40); } - $hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/'); + $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/'); $releaseId = $this->runtime->getReleaseId(); $cmdLinkRelease = sprintf('cd %s && ln -snf releases/%s current', $hostPath, $releaseId); diff --git a/src/Task/BuiltIn/Deploy/RsyncTask.php b/src/Task/BuiltIn/Deploy/RsyncTask.php index 5efc9f8..b34df20 100644 --- a/src/Task/BuiltIn/Deploy/RsyncTask.php +++ b/src/Task/BuiltIn/Deploy/RsyncTask.php @@ -33,14 +33,14 @@ class RsyncTask extends AbstractTask public function execute() { - $flags = $this->runtime->getConfigOptions('rsync', '-avz'); + $flags = $this->runtime->getConfigOption('rsync', '-avz'); $sshConfig = $this->runtime->getSSHConfig(); - $user = $this->runtime->getEnvParam('user', $this->runtime->getCurrentUser()); + $user = $this->runtime->getEnvOption('user', $this->runtime->getCurrentUser()); $host = $this->runtime->getWorkingHost(); - $hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/'); + $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/'); $targetDir = rtrim($hostPath, '/'); - if ($this->runtime->getEnvParam('releases', false)) { + if ($this->runtime->getEnvOption('releases', false)) { throw new ErrorException('Can\'t be used with Releases, use "deploy/targz/copy"'); } @@ -54,7 +54,7 @@ class RsyncTask extends AbstractTask protected function getExcludes() { - $excludes = $this->runtime->getEnvParam('exclude', []); + $excludes = $this->runtime->getEnvOption('exclude', []); $excludes = array_merge(['.git'], $excludes); foreach ($excludes as &$exclude) { diff --git a/src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php b/src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php index da8618d..fbec04c 100644 --- a/src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php +++ b/src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php @@ -33,7 +33,7 @@ class CleanupTask extends AbstractTask public function execute() { - if (!$this->runtime->getEnvParam('releases', false)) { + if (!$this->runtime->getEnvOption('releases', false)) { throw new ErrorException('This task is only available with releases enabled', 40); } diff --git a/src/Task/BuiltIn/Deploy/TarGz/CopyTask.php b/src/Task/BuiltIn/Deploy/TarGz/CopyTask.php index 1e6e09c..2b34fee 100644 --- a/src/Task/BuiltIn/Deploy/TarGz/CopyTask.php +++ b/src/Task/BuiltIn/Deploy/TarGz/CopyTask.php @@ -33,14 +33,14 @@ class CopyTask extends AbstractTask public function execute() { - if (!$this->runtime->getEnvParam('releases', false)) { + if (!$this->runtime->getEnvOption('releases', false)) { throw new ErrorException('This task is only available with releases enabled', 40); } - $user = $this->runtime->getEnvParam('user', $this->runtime->getCurrentUser()); + $user = $this->runtime->getEnvOption('user', $this->runtime->getCurrentUser()); $host = $this->runtime->getWorkingHost(); $sshConfig = $sshConfig = $this->runtime->getSSHConfig(); - $hostPath = rtrim($this->runtime->getEnvParam('host_path'), '/'); + $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/'); $currentReleaseId = $this->runtime->getReleaseId(); $targetDir = sprintf('%s/releases/%s', $hostPath, $currentReleaseId); diff --git a/src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php b/src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php index 69e0de3..cf3e02a 100644 --- a/src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php +++ b/src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php @@ -33,7 +33,7 @@ class PrepareTask extends AbstractTask public function execute() { - if (!$this->runtime->getEnvParam('releases', false)) { + if (!$this->runtime->getEnvOption('releases', false)) { throw new ErrorException('This task is only available with releases enabled', 40); } @@ -50,7 +50,7 @@ class PrepareTask extends AbstractTask protected function getExcludes() { - $excludes = $this->runtime->getEnvParam('exclude', []); + $excludes = $this->runtime->getEnvOption('exclude', []); $excludes = array_merge(['.git'], $excludes); foreach ($excludes as &$exclude) { diff --git a/src/Task/BuiltIn/Git/ChangeBranchTask.php b/src/Task/BuiltIn/Git/ChangeBranchTask.php index 42d283b..172207c 100644 --- a/src/Task/BuiltIn/Git/ChangeBranchTask.php +++ b/src/Task/BuiltIn/Git/ChangeBranchTask.php @@ -70,7 +70,7 @@ class ChangeBranchTask extends AbstractTask protected function getOptions() { - $branch = $this->runtime->getEnvParam('branch', 'master'); + $branch = $this->runtime->getEnvOption('branch', 'master'); $options = array_merge( ['path' => 'git', 'branch' => $branch], $this->options diff --git a/src/Task/BuiltIn/Git/UpdateTask.php b/src/Task/BuiltIn/Git/UpdateTask.php index 4eaed2c..33aa8ac 100644 --- a/src/Task/BuiltIn/Git/UpdateTask.php +++ b/src/Task/BuiltIn/Git/UpdateTask.php @@ -43,7 +43,7 @@ class UpdateTask extends AbstractTask protected function getOptions() { - $branch = $this->runtime->getEnvParam('branch', 'master'); + $branch = $this->runtime->getEnvOption('branch', 'master'); $options = array_merge( ['path' => 'git', 'branch' => $branch], $this->options diff --git a/src/Task/BuiltIn/Symfony/AsseticDumpTask.php b/src/Task/BuiltIn/Symfony/AsseticDumpTask.php index 1fe6e21..4c4404c 100644 --- a/src/Task/BuiltIn/Symfony/AsseticDumpTask.php +++ b/src/Task/BuiltIn/Symfony/AsseticDumpTask.php @@ -43,8 +43,8 @@ class AsseticDumpTask extends AbstractTask protected function getOptions() { - $userGlobalOptions = $this->runtime->getConfigOptions('symfony', []); - $userEnvOptions = $this->runtime->getEnvParam('symfony', []); + $userGlobalOptions = $this->runtime->getConfigOption('symfony', []); + $userEnvOptions = $this->runtime->getEnvOption('symfony', []); $options = array_merge( ['console' => 'bin/console', 'env' => 'dev', 'flags' => ''], (is_array($userGlobalOptions) ? $userGlobalOptions : []), diff --git a/src/Task/BuiltIn/Symfony/AssetsInstallTask.php b/src/Task/BuiltIn/Symfony/AssetsInstallTask.php index 3eb162a..a6a63c4 100644 --- a/src/Task/BuiltIn/Symfony/AssetsInstallTask.php +++ b/src/Task/BuiltIn/Symfony/AssetsInstallTask.php @@ -43,8 +43,8 @@ class AssetsInstallTask extends AbstractTask protected function getOptions() { - $userGlobalOptions = $this->runtime->getConfigOptions('symfony', []); - $userEnvOptions = $this->runtime->getEnvParam('symfony', []); + $userGlobalOptions = $this->runtime->getConfigOption('symfony', []); + $userEnvOptions = $this->runtime->getEnvOption('symfony', []); $options = array_merge( ['console' => 'bin/console', 'env' => 'dev', 'target' => 'web', 'flags' => '--symlink --relative'], (is_array($userGlobalOptions) ? $userGlobalOptions : []), diff --git a/src/Task/BuiltIn/Symfony/CacheClearTask.php b/src/Task/BuiltIn/Symfony/CacheClearTask.php index 511ed32..bd5b77a 100644 --- a/src/Task/BuiltIn/Symfony/CacheClearTask.php +++ b/src/Task/BuiltIn/Symfony/CacheClearTask.php @@ -43,8 +43,8 @@ class CacheClearTask extends AbstractTask protected function getOptions() { - $userGlobalOptions = $this->runtime->getConfigOptions('symfony', []); - $userEnvOptions = $this->runtime->getEnvParam('symfony', []); + $userGlobalOptions = $this->runtime->getConfigOption('symfony', []); + $userEnvOptions = $this->runtime->getEnvOption('symfony', []); $options = array_merge( ['console' => 'bin/console', 'env' => 'dev', 'flags' => ''], (is_array($userGlobalOptions) ? $userGlobalOptions : []), diff --git a/src/Task/BuiltIn/Symfony/CacheWarmupTask.php b/src/Task/BuiltIn/Symfony/CacheWarmupTask.php index cf6f707..a2e30f0 100644 --- a/src/Task/BuiltIn/Symfony/CacheWarmupTask.php +++ b/src/Task/BuiltIn/Symfony/CacheWarmupTask.php @@ -43,8 +43,8 @@ class CacheWarmupTask extends AbstractTask protected function getOptions() { - $userGlobalOptions = $this->runtime->getConfigOptions('symfony', []); - $userEnvOptions = $this->runtime->getEnvParam('symfony', []); + $userGlobalOptions = $this->runtime->getConfigOption('symfony', []); + $userEnvOptions = $this->runtime->getEnvOption('symfony', []); $options = array_merge( ['console' => 'bin/console', 'env' => 'dev', 'flags' => ''], (is_array($userGlobalOptions) ? $userGlobalOptions : []), diff --git a/tests/Deploy/StrategyTest.php b/tests/Deploy/StrategyTest.php index 62dd6a6..fd3997d 100644 --- a/tests/Deploy/StrategyTest.php +++ b/tests/Deploy/StrategyTest.php @@ -10,8 +10,8 @@ namespace Mage\Tests\Deploy; -use Mage\Deploy\Strategy\Releases\ReleasesStrategy; -use Mage\Deploy\Strategy\Rsync\RsyncStrategy; +use Mage\Deploy\Strategy\ReleasesStrategy; +use Mage\Deploy\Strategy\RsyncStrategy; use Mage\Runtime\Exception\RuntimeException; use Mage\Runtime\Runtime; use Exception; diff --git a/tests/Runtime/RuntimeTest.php b/tests/Runtime/RuntimeTest.php index bdb0ca1..a7a5004 100644 --- a/tests/Runtime/RuntimeTest.php +++ b/tests/Runtime/RuntimeTest.php @@ -40,26 +40,6 @@ class RuntimeTest extends TestCase $this->assertLessThanOrEqual(2, $dateDiff->s); } - public function testEmptyEnvironmentConfig() - { - $runtime = new Runtime(); - $config = $runtime->getEnvironmentConfig(); - - $this->assertTrue(is_array($config)); - $this->assertEquals(0, count($config)); - } - - public function testInvalidEnvironmentConfig() - { - $runtime = new RuntimeMockup(); - $runtime->setConfiguration(['environments' => ['valid' => []]]); - $runtime->setInvalidEnvironment('invalid'); - $config = $runtime->getEnvironmentConfig(); - - $this->assertTrue(is_array($config)); - $this->assertEquals(0, count($config)); - } - public function testInvalidEnvironments() { try {