diff --git a/CHANGELOG.md b/CHANGELOG.md index e3cbd53d9..e44367938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 0.1.0 ----- +- Add `deploy:teardown` to remove the application from remote servers - Add support for the connections defined in the remote config file - Add `deploy:rollback` and `deploy:current` commands - Add `deploy:cleanup` command diff --git a/README.md b/README.md index ae3956d06..40700f3ad 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ deploy deploy:current Displays what the current release is deploy:rollback {release} Rollback to a specific release deploy:rollback Rollback to the previous release + deploy:teardown Removes the remote applications and existing caches ``` ## Example config file diff --git a/src/Rocketeer/Commands/DeployTeardownCommand.php b/src/Rocketeer/Commands/DeployTeardownCommand.php new file mode 100644 index 000000000..a44de98db --- /dev/null +++ b/src/Rocketeer/Commands/DeployTeardownCommand.php @@ -0,0 +1,37 @@ +remote->run(array( + $this->removeFolder(), + )); + + $this->getDeploymentsManager()->deleteDeploymentsFile(); + + $this->info('The application was successfully removed from the remote servers'); + } + +} diff --git a/src/Rocketeer/DeploymentsManager.php b/src/Rocketeer/DeploymentsManager.php index 57bc8eb0b..f7ab88442 100644 --- a/src/Rocketeer/DeploymentsManager.php +++ b/src/Rocketeer/DeploymentsManager.php @@ -101,4 +101,14 @@ protected function getDeploymentsFile() return $deployments; } + /** + * Deletes the deployments file + * + * @return boolean + */ + public function deleteDeploymentsFile() + { + return $this->files->delete($this->deploymentsFilepath); + } + } diff --git a/src/Rocketeer/RocketeerServiceProvider.php b/src/Rocketeer/RocketeerServiceProvider.php index 6a114bacf..9fee19cba 100644 --- a/src/Rocketeer/RocketeerServiceProvider.php +++ b/src/Rocketeer/RocketeerServiceProvider.php @@ -74,11 +74,15 @@ protected function registerCommands() return new Commands\DeployRollbackCommand($app); }); + $this->app->bind('deploy.teardown', function($app) { + return new Commands\DeployTeardownCommand($app); + }); + $this->app->bind('deploy.current', function($app) { return new Commands\DeployCurrentCommand($app); }); - $this->commands('deploy', 'deploy.setup', 'deploy.deploy', 'deploy.cleanup', 'deploy.rollback', 'deploy.current'); + $this->commands('deploy', 'deploy.setup', 'deploy.deploy', 'deploy.cleanup', 'deploy.rollback', 'deploy.teardown', 'deploy.current'); } /**