diff --git a/src/Deploy/Strategy/ReleasesStrategy.php b/src/Deploy/Strategy/ReleasesStrategy.php index 0ae0bdf..ec34118 100644 --- a/src/Deploy/Strategy/ReleasesStrategy.php +++ b/src/Deploy/Strategy/ReleasesStrategy.php @@ -14,7 +14,7 @@ use Mage\Runtime\Exception\RuntimeException; use Mage\Runtime\Runtime; /** - * Strategy for Deployment with Releases, using TarGz and SCP + * Strategy for Deployment with Releases, using Tar and SCP * * @author Andrés Montañez */ @@ -44,8 +44,8 @@ class ReleasesStrategy implements StrategyInterface array_unshift($tasks, 'git/change-branch'); } - if (!$this->runtime->inRollback() && !in_array('deploy/targz/prepare', $tasks)) { - array_push($tasks, 'deploy/targz/prepare'); + if (!$this->runtime->inRollback() && !in_array('deploy/tar/prepare', $tasks)) { + array_push($tasks, 'deploy/tar/prepare'); } return $tasks; @@ -56,8 +56,8 @@ class ReleasesStrategy implements StrategyInterface $this->checkStage(Runtime::ON_DEPLOY); $tasks = $this->runtime->getTasks(); - if (!$this->runtime->inRollback() && !in_array('deploy/targz/copy', $tasks)) { - array_unshift($tasks, 'deploy/targz/copy'); + if (!$this->runtime->inRollback() && !in_array('deploy/tar/copy', $tasks)) { + array_unshift($tasks, 'deploy/tar/copy'); } if (!$this->runtime->inRollback() && !in_array('deploy/release/prepare', $tasks)) { @@ -96,8 +96,8 @@ class ReleasesStrategy implements StrategyInterface $this->checkStage(Runtime::POST_DEPLOY); $tasks = $this->runtime->getTasks(); - if (!$this->runtime->inRollback() && !in_array('deploy/targz/cleanup', $tasks)) { - array_unshift($tasks, 'deploy/targz/cleanup'); + if (!$this->runtime->inRollback() && !in_array('deploy/tar/cleanup', $tasks)) { + array_unshift($tasks, 'deploy/tar/cleanup'); } if ($this->runtime->getBranch() && !$this->runtime->inRollback() && !in_array('git/change-branch', $tasks)) { diff --git a/src/Task/BuiltIn/Deploy/RsyncTask.php b/src/Task/BuiltIn/Deploy/RsyncTask.php index 70a58a7..f3343b6 100644 --- a/src/Task/BuiltIn/Deploy/RsyncTask.php +++ b/src/Task/BuiltIn/Deploy/RsyncTask.php @@ -41,7 +41,7 @@ class RsyncTask extends AbstractTask $targetDir = rtrim($hostPath, '/'); if ($this->runtime->getEnvOption('releases', false)) { - throw new ErrorException('Can\'t be used with Releases, use "deploy/targz/copy"'); + throw new ErrorException('Can\'t be used with Releases, use "deploy/tar/copy"'); } $excludes = $this->getExcludes(); diff --git a/src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php b/src/Task/BuiltIn/Deploy/Tar/CleanupTask.php similarity index 76% rename from src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php rename to src/Task/BuiltIn/Deploy/Tar/CleanupTask.php index fbec04c..f538271 100644 --- a/src/Task/BuiltIn/Deploy/TarGz/CleanupTask.php +++ b/src/Task/BuiltIn/Deploy/Tar/CleanupTask.php @@ -8,14 +8,14 @@ * file that was distributed with this source code. */ -namespace Mage\Task\BuiltIn\Deploy\TarGz; +namespace Mage\Task\BuiltIn\Deploy\Tar; use Mage\Task\Exception\ErrorException; use Symfony\Component\Process\Process; use Mage\Task\AbstractTask; /** - * TarGz Task - Delete temporal Tar + * Tar Task - Delete temporal Tar * * @author Andrés Montañez */ @@ -23,12 +23,12 @@ class CleanupTask extends AbstractTask { public function getName() { - return 'deploy/targz/cleanup'; + return 'deploy/tar/cleanup'; } public function getDescription() { - return '[Deploy] Cleanup TarGZ file'; + return '[Deploy] Cleanup Tar file'; } public function execute() @@ -37,12 +37,12 @@ class CleanupTask extends AbstractTask throw new ErrorException('This task is only available with releases enabled', 40); } - $tarGzLocal = $this->runtime->getVar('targz_local'); + $tarLocal = $this->runtime->getVar('tar_local'); - $cmdDeleteTarGz = sprintf('rm %s', $tarGzLocal); + $cmdDeleteTar = sprintf('rm %s', $tarLocal); /** @var Process $process */ - $process = $this->runtime->runLocalCommand($cmdDeleteTarGz); + $process = $this->runtime->runLocalCommand($cmdDeleteTar); return $process->isSuccessful(); } } diff --git a/src/Task/BuiltIn/Deploy/TarGz/CopyTask.php b/src/Task/BuiltIn/Deploy/Tar/CopyTask.php similarity index 83% rename from src/Task/BuiltIn/Deploy/TarGz/CopyTask.php rename to src/Task/BuiltIn/Deploy/Tar/CopyTask.php index fa62086..0609452 100644 --- a/src/Task/BuiltIn/Deploy/TarGz/CopyTask.php +++ b/src/Task/BuiltIn/Deploy/Tar/CopyTask.php @@ -8,14 +8,14 @@ * file that was distributed with this source code. */ -namespace Mage\Task\BuiltIn\Deploy\TarGz; +namespace Mage\Task\BuiltIn\Deploy\Tar; use Mage\Task\Exception\ErrorException; use Symfony\Component\Process\Process; use Mage\Task\AbstractTask; /** - * TarGz Task - Copy Tar + * Tar Task - Copy Tar * * @author Andrés Montañez */ @@ -23,12 +23,12 @@ class CopyTask extends AbstractTask { public function getName() { - return 'deploy/targz/copy'; + return 'deploy/tar/copy'; } public function getDescription() { - return '[Deploy] Copying files with TarGZ'; + return '[Deploy] Copying files with Tar'; } public function execute() @@ -46,18 +46,18 @@ class CopyTask extends AbstractTask $flags = $this->runtime->getEnvOption('tar_extract', 'xfzop'); $targetDir = sprintf('%s/releases/%s', $hostPath, $currentReleaseId); - $tarGzLocal = $this->runtime->getVar('targz_local'); - $tarGzRemote = basename($tarGzLocal); + $tarLocal = $this->runtime->getVar('tar_local'); + $tarRemote = basename($tarLocal); - $cmdCopy = sprintf('scp -P %d %s %s %s@%s:%s/%s', $sshConfig['port'], $sshConfig['flags'], $tarGzLocal, $user, $host, $targetDir, $tarGzRemote); + $cmdCopy = sprintf('scp -P %d %s %s %s@%s:%s/%s', $sshConfig['port'], $sshConfig['flags'], $tarLocal, $user, $host, $targetDir, $tarRemote); /** @var Process $process */ $process = $this->runtime->runLocalCommand($cmdCopy, 300); if ($process->isSuccessful()) { - $cmdUnTar = sprintf('cd %s && tar %s %s', $targetDir, $flags, $tarGzRemote); + $cmdUnTar = sprintf('cd %s && tar %s %s', $targetDir, $flags, $tarRemote); $process = $this->runtime->runRemoteCommand($cmdUnTar, false, 600); if ($process->isSuccessful()) { - $cmdDelete = sprintf('rm %s/%s', $targetDir, $tarGzRemote); + $cmdDelete = sprintf('rm %s/%s', $targetDir, $tarRemote); $process = $this->runtime->runRemoteCommand($cmdDelete, false); return $process->isSuccessful(); } diff --git a/src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php b/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php similarity index 75% rename from src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php rename to src/Task/BuiltIn/Deploy/Tar/PrepareTask.php index f4d1cdf..d6f04b1 100644 --- a/src/Task/BuiltIn/Deploy/TarGz/PrepareTask.php +++ b/src/Task/BuiltIn/Deploy/Tar/PrepareTask.php @@ -8,14 +8,14 @@ * file that was distributed with this source code. */ -namespace Mage\Task\BuiltIn\Deploy\TarGz; +namespace Mage\Task\BuiltIn\Deploy\Tar; use Mage\Task\Exception\ErrorException; use Symfony\Component\Process\Process; use Mage\Task\AbstractTask; /** - * TarGz Task - Create temporal Tar + * Tar Task - Create temporal Tar * * @author Andrés Montañez */ @@ -23,12 +23,12 @@ class PrepareTask extends AbstractTask { public function getName() { - return 'deploy/targz/prepare'; + return 'deploy/tar/prepare'; } public function getDescription() { - return '[Deploy] Preparing TarGz file'; + return '[Deploy] Preparing Tar file'; } public function execute() @@ -37,15 +37,15 @@ class PrepareTask extends AbstractTask throw new ErrorException('This task is only available with releases enabled', 40); } - $tarGzLocal = $this->runtime->getTempFile(); - $this->runtime->setVar('targz_local', $tarGzLocal); + $tarLocal = $this->runtime->getTempFile(); + $this->runtime->setVar('tar_local', $tarLocal); $excludes = $this->getExcludes(); $flags = $this->runtime->getEnvOption('tar_create', 'cfzop'); - $cmdTarGz = sprintf('tar %s %s %s ./', $flags, $tarGzLocal, $excludes); + $cmdTar = sprintf('tar %s %s %s ./', $flags, $tarLocal, $excludes); /** @var Process $process */ - $process = $this->runtime->runLocalCommand($cmdTarGz, 300); + $process = $this->runtime->runLocalCommand($cmdTar, 300); return $process->isSuccessful(); } diff --git a/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php b/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php index 9ff6170..554c56d 100644 --- a/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php +++ b/tests/Command/BuiltIn/DeployCommandWithReleasesTest.php @@ -129,7 +129,7 @@ class DeployCommandWithReleasesTest extends TestCase $tester = new CommandTester($command); $tester->execute(['command' => $command->getName(), 'environment' => 'test']); - $this->assertContains('Copying files with TarGZ ... FAIL', $tester->getDisplay()); + $this->assertContains('Copying files with Tar ... FAIL', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -187,7 +187,7 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Deploy] Copying files with TarGZ ... FAIL', $tester->getDisplay()); + $this->assertContains('Running [Deploy] Copying files with Tar ... FAIL', $tester->getDisplay()); $this->assertContains('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -229,7 +229,7 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Deploy] Copying files with TarGZ ... FAIL', $tester->getDisplay()); + $this->assertContains('Running [Deploy] Copying files with Tar ... FAIL', $tester->getDisplay()); $this->assertContains('Stage "On Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } @@ -283,7 +283,7 @@ class DeployCommandWithReleasesTest extends TestCase $this->assertEquals($command, $ranCommands[$index]); } - $this->assertContains('Running [Deploy] Cleanup TarGZ file ... FAIL', $tester->getDisplay()); + $this->assertContains('Running [Deploy] Cleanup Tar file ... FAIL', $tester->getDisplay()); $this->assertContains('Stage "Post Deploy" did not finished successfully, halting command.', $tester->getDisplay()); $this->assertNotEquals(0, $tester->getStatusCode()); } diff --git a/tests/Resources/testhost-force-tar1.yml b/tests/Resources/testhost-force-tar1.yml index deca757..61a1a5a 100644 --- a/tests/Resources/testhost-force-tar1.yml +++ b/tests/Resources/testhost-force-tar1.yml @@ -12,4 +12,4 @@ magephp: hosts: - host2 pre-deploy: - - deploy/targz/prepare \ No newline at end of file + - deploy/tar/prepare \ No newline at end of file diff --git a/tests/Resources/testhost-force-tar2.yml b/tests/Resources/testhost-force-tar2.yml index 595a921..db26ad0 100644 --- a/tests/Resources/testhost-force-tar2.yml +++ b/tests/Resources/testhost-force-tar2.yml @@ -12,4 +12,4 @@ magephp: hosts: - host2 on-deploy: - - deploy/targz/copy \ No newline at end of file + - deploy/tar/copy \ No newline at end of file diff --git a/tests/Resources/testhost-force-tar3.yml b/tests/Resources/testhost-force-tar3.yml index 26f0c90..cd2eeee 100644 --- a/tests/Resources/testhost-force-tar3.yml +++ b/tests/Resources/testhost-force-tar3.yml @@ -12,4 +12,4 @@ magephp: hosts: - host2 post-deploy: - - deploy/targz/cleanup \ No newline at end of file + - deploy/tar/cleanup \ No newline at end of file diff --git a/tests/Resources/testhost-with-postdeploy-error.yml b/tests/Resources/testhost-with-postdeploy-error.yml index 26e13a2..c2e2956 100644 --- a/tests/Resources/testhost-with-postdeploy-error.yml +++ b/tests/Resources/testhost-with-postdeploy-error.yml @@ -20,4 +20,4 @@ magephp: on-release: post-release: post-deploy: - - deploy/targz/cleanup \ No newline at end of file + - deploy/tar/cleanup \ No newline at end of file