Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Add deploy:teardown to remove the application from remote servers
Browse files Browse the repository at this point in the history
  • Loading branch information
Anahkiasen committed Jun 22, 2013
1 parent bd74fd5 commit e00423c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions src/Rocketeer/Commands/DeployTeardownCommand.php
@@ -0,0 +1,37 @@
<?php
namespace Rocketeer\Commands;

class DeployTeardownCommand extends BaseDeployCommand
{

/**
* The console command name.
*
* @var string
*/
protected $name = 'deploy:teardown';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Removes the remote applications and existing caches';

/**
* The tasks to execute
*
* @return array
*/
public function fire()
{
$this->remote->run(array(
$this->removeFolder(),
));

$this->getDeploymentsManager()->deleteDeploymentsFile();

$this->info('The application was successfully removed from the remote servers');
}

}
10 changes: 10 additions & 0 deletions src/Rocketeer/DeploymentsManager.php
Expand Up @@ -101,4 +101,14 @@ protected function getDeploymentsFile()
return $deployments;
}

/**
* Deletes the deployments file
*
* @return boolean
*/
public function deleteDeploymentsFile()
{
return $this->files->delete($this->deploymentsFilepath);
}

}
6 changes: 5 additions & 1 deletion src/Rocketeer/RocketeerServiceProvider.php
Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit e00423c

Please sign in to comment.