diff --git a/src/Mage/Command/BuiltIn/DeployCommand.php b/src/Mage/Command/BuiltIn/DeployCommand.php
index 33dfe27..b45295d 100644
--- a/src/Mage/Command/BuiltIn/DeployCommand.php
+++ b/src/Mage/Command/BuiltIn/DeployCommand.php
@@ -94,7 +94,6 @@ class DeployCommand extends AbstractCommand
$this->taskFactory = new TaskFactory($this->runtime);
$this->runDeployment($output);
-
} catch (RuntimeException $exception) {
$output->writeln('');
$output->writeln(sprintf('%s', $exception->getMessage()));
@@ -287,12 +286,10 @@ class DeployCommand extends AbstractCommand
$this->statusCode = 180;
$this->log(sprintf('Task %s (%s) finished with FAIL', $task->getDescription(), $task->getName()));
}
-
} catch (SkipException $exception) {
$succeededTasks++;
$output->writeln('SKIPPED>');
$this->log(sprintf('Task %s (%s) finished with SKIPPED, thrown SkipException', $task->getDescription(), $task->getName()));
-
} catch (ErrorException $exception) {
$output->writeln(sprintf('ERROR> [%s]', $exception->getTrimmedMessage()));
$this->log(sprintf('Task %s (%s) finished with FAIL, with Error "%s"', $task->getDescription(), $task->getName(), $exception->getMessage()));
diff --git a/src/Mage/Command/BuiltIn/Releases/ListCommand.php b/src/Mage/Command/BuiltIn/Releases/ListCommand.php
index 605b421..d935ac7 100644
--- a/src/Mage/Command/BuiltIn/Releases/ListCommand.php
+++ b/src/Mage/Command/BuiltIn/Releases/ListCommand.php
@@ -134,7 +134,6 @@ class ListCommand extends AbstractCommand
$output->writeln('');
}
}
-
} catch (RuntimeException $exception) {
$output->writeln(sprintf('%s', $exception->getMessage()));
$this->statusCode = $exception->getCode();
diff --git a/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php b/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
index 80768df..e954c9c 100644
--- a/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
+++ b/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
@@ -83,7 +83,6 @@ class RollbackCommand extends DeployCommand
$this->taskFactory = new TaskFactory($this->runtime);
$this->runDeployment($output);
-
} catch (RuntimeException $exception) {
$output->writeln(sprintf('%s', $exception->getMessage()));
$this->statusCode = $exception->getCode();
diff --git a/src/Mage/Task/BuiltIn/FS/CopyTask.php b/src/Mage/Task/BuiltIn/FS/CopyTask.php
index 4dc7bae..3c6049f 100644
--- a/src/Mage/Task/BuiltIn/FS/CopyTask.php
+++ b/src/Mage/Task/BuiltIn/FS/CopyTask.php
@@ -29,7 +29,6 @@ class CopyTask extends AbstractFileTask
{
try {
return sprintf('[FS] Copy "%s" to "%s"', $this->getFile('from'), $this->getFile('to'));
-
} catch (Exception $exception) {
return '[FS] Copy [missing parameters]';
}
diff --git a/src/Mage/Task/BuiltIn/FS/LinkTask.php b/src/Mage/Task/BuiltIn/FS/LinkTask.php
index 1ed5987..cde7641 100644
--- a/src/Mage/Task/BuiltIn/FS/LinkTask.php
+++ b/src/Mage/Task/BuiltIn/FS/LinkTask.php
@@ -29,7 +29,6 @@ class LinkTask extends AbstractFileTask
{
try {
return sprintf('[FS] Link "%s" to "%s"', $this->getFile('from'), $this->getFile('to'));
-
} catch (Exception $exception) {
return '[FS] Link [missing parameters]';
}
diff --git a/src/Mage/Task/BuiltIn/FS/MoveTask.php b/src/Mage/Task/BuiltIn/FS/MoveTask.php
index 48b44f5..388f8b6 100644
--- a/src/Mage/Task/BuiltIn/FS/MoveTask.php
+++ b/src/Mage/Task/BuiltIn/FS/MoveTask.php
@@ -29,7 +29,6 @@ class MoveTask extends AbstractFileTask
{
try {
return sprintf('[FS] Move "%s" to "%s"', $this->getFile('from'), $this->getFile('to'));
-
} catch (Exception $exception) {
return '[FS] Move [missing parameters]';
}
diff --git a/src/Mage/Task/BuiltIn/FS/RemoveTask.php b/src/Mage/Task/BuiltIn/FS/RemoveTask.php
index 443c536..c55c4a2 100644
--- a/src/Mage/Task/BuiltIn/FS/RemoveTask.php
+++ b/src/Mage/Task/BuiltIn/FS/RemoveTask.php
@@ -29,7 +29,6 @@ class RemoveTask extends AbstractFileTask
{
try {
return sprintf('[FS] Remove "%s"', $this->getFile('file'));
-
} catch (Exception $exception) {
return '[FS] Remove [missing parameters]';
}
diff --git a/src/Mage/Tests/Command/BuiltIn/DeployCommandMiscTest.php b/src/Mage/Tests/Command/BuiltIn/DeployCommandMiscTest.php
index d747d11..4e5b7ba 100644
--- a/src/Mage/Tests/Command/BuiltIn/DeployCommandMiscTest.php
+++ b/src/Mage/Tests/Command/BuiltIn/DeployCommandMiscTest.php
@@ -18,6 +18,25 @@ use PHPUnit_Framework_TestCase as TestCase;
class DeployCommandMiscTest extends TestCase
{
+ public function testDeploymentWithNoHosts()
+ {
+ $application = new MageApplicationMockup();
+ $application->configure(__DIR__ . '/../../Resources/no-hosts.yml');
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('deploy');
+ $this->assertTrue($command instanceof DeployCommand);
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName(), 'environment' => 'test']);
+
+ $this->assertContains('No hosts defined, skipping On Deploy tasks', $tester->getDisplay());
+ $this->assertContains('No hosts defined, skipping On Release tasks', $tester->getDisplay());
+ $this->assertContains('No hosts defined, skipping Post Release tasks', $tester->getDisplay());
+
+ $this->assertEquals(0, $tester->getStatusCode());
+ }
+
public function testDeploymentWithSudo()
{
$application = new MageApplicationMockup();
diff --git a/src/Mage/Tests/Command/BuiltIn/DeployCommandWithReleasesTest.php b/src/Mage/Tests/Command/BuiltIn/DeployCommandWithReleasesTest.php
index 67caf21..660d3a1 100644
--- a/src/Mage/Tests/Command/BuiltIn/DeployCommandWithReleasesTest.php
+++ b/src/Mage/Tests/Command/BuiltIn/DeployCommandWithReleasesTest.php
@@ -132,4 +132,20 @@ class DeployCommandWithReleasesTest extends TestCase
$this->assertContains('Copying files with TarGZ ... FAIL', $tester->getDisplay());
$this->assertNotEquals(0, $tester->getStatusCode());
}
+
+ public function testDeploymentWithoutReleasesForceRelease()
+ {
+ $application = new MageApplicationMockup();
+ $application->configure(__DIR__ . '/../../Resources/testhost-force-release.yml');
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('deploy');
+ $this->assertTrue($command instanceof DeployCommand);
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName(), 'environment' => 'test']);
+
+ $this->assertContains('This task is only available with releases enabled', $tester->getDisplay());
+ $this->assertNotEquals(0, $tester->getStatusCode());
+ }
}
diff --git a/src/Mage/Tests/Resources/no-hosts.yml b/src/Mage/Tests/Resources/no-hosts.yml
new file mode 100644
index 0000000..f2ce2ef
--- /dev/null
+++ b/src/Mage/Tests/Resources/no-hosts.yml
@@ -0,0 +1,23 @@
+magephp:
+ log_dir: /tmp
+ environments:
+ test:
+ user: tester
+ branch: test
+ host_path: /var/www/test
+ releases: 4
+ exclude:
+ - ./var/cache/*
+ - ./var/log/*
+ - ./web/app_dev.php
+ pre-deploy:
+ - git/update
+ - composer/install
+ - composer/dump-autoload
+ on-deploy:
+ - symfony/cache-warmup: { env: 'dev' }
+ - symfony/assets-install: { env: 'dev' }
+ - symfony/assetic-dump: { env: 'dev' }
+ on-release:
+ post-release:
+ post-deploy:
\ No newline at end of file
diff --git a/src/Mage/Tests/Resources/testhost-force-release.yml b/src/Mage/Tests/Resources/testhost-force-release.yml
new file mode 100644
index 0000000..c99f893
--- /dev/null
+++ b/src/Mage/Tests/Resources/testhost-force-release.yml
@@ -0,0 +1,15 @@
+magephp:
+ log_dir: /tmp
+ environments:
+ test:
+ user: tester
+ branch: test
+ host_path: /var/www/test
+ exclude:
+ - ./var/cache/*
+ - ./var/log/*
+ - ./web/app_dev.php
+ hosts:
+ - host2
+ on-release:
+ - deploy/release
\ No newline at end of file