README.md in paratrooper-1.4.2 vs README.md in paratrooper-2.0.0.beta1
- old
+ new
@@ -40,10 +40,18 @@
```ruby
Paratrooper::Deploy.new('amazing-app', tag: 'staging')
```
+or alternatively:
+
+```ruby
+Paratrooper::Deploy.new('amazing-app') do |deploy|
+ deploy.tag = 'staging'
+end
+```
+
## Authentication
You can authenticate your Heroku account in a few ways:
* Provide an API Key
@@ -73,10 +81,18 @@
```ruby
Paratrooper::Deploy.new('app', deployment_host: 'HOST')
```
+or alternatively:
+
+```ruby
+Paratrooper::Deploy.new('amazing-app') do |deploy|
+ deploy.deployment_host = 'HOST'
+end
+```
+
This also works if you're using the [heroku-accounts](https://github.com/ddollar/heroku-accounts) plugin:
```ruby
Paratrooper::Deploy.new('app', deployment_host: 'heroku.ACCOUNT_NAME')
```
@@ -95,13 +111,22 @@
### Production example
```ruby
Paratrooper::Deploy.new("amazing-production-app",
tag: 'production',
- match_tag_to: 'staging'
+ match_tag: 'staging'
)
```
+
+or alternatively:
+
+```ruby
+Paratrooper::Deploy.new('amazing-production-app') do |deploy|
+ deploy.tag = 'production'
+ deploy.match_tag = 'staging'
+end
+```
This will create/update a `production` git tag at `staging` and deploy the `production` tag.
## Sensible Default Deployment
You can use the object's methods any way you'd like, but we've provided a sensible default at `Paratrooper#deploy`.
@@ -131,58 +156,67 @@
deployment.deploy
end
desc 'Deploy app in production environment'
task :production do
- deployment = Paratrooper::Deploy.new("amazing-production-app",
- tag: 'production',
- match_tag_to: 'staging'
+ deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
+ deploy.tag = 'production',
+ deploy.match_tag = 'staging',
+ deploy.maintenance_mode = !ENV['NO_MAINTENANCE']
)
deployment.deploy
end
end
```
## Bucking the Norm
Our default deploy gets us most of the way, but maybe it's not for you--we've
-got you covered. Every deployment method sends a notification that can be
-captured and used in almost any way you can imagine.
+got you covered. Every deployment method has a set of callback instructions that can be
+utilized in almost any way you can imagine.
-For example, say you want to let [New Relic][] know that you are deploying and
-to disable your application monitoring.
+The `add_callback` method allows for the execution of arbitrary code within different steps of the deploy process.
+There are 'before' and 'after' hooks for each of the following:
+
+* setup
+* activate_maintenance_mode
+* update_repo_tag
+* push_repo
+* run_migrations
+* app_restart
+* deactivate_maintenance_mode
+* warm_instance
+* teardown
+
### Example Usage
-```ruby
-# Gemfile
-gem 'paratrooper-newrelic'
+For example, say you want to let [New Relic][] know that you are deploying and
+to disable your application monitoring.
+```ruby
# lib/tasks/deploy.rake
require 'paratrooper'
namespace :deploy do
desc 'Deploy app in production environment'
task :production do
- deployment = Paratrooper::Deploy.new("amazing-production-app",
- tag: 'production',
- match_tag_to: 'staging',
- notifiers: [
- Paratrooper::Notifiers::ScreenNotifier.new,
- Paratrooper::Newrelic::Notifier.new('api_key', 'account_id', 'application_id')
- ]
- )
+ deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
+ deploy.tag = 'production'
+ deploy.match_tag = 'staging'
+ deploy.add_callback(:before_setup) do
+ system %Q[curl https://rpm.newrelic.com/accounts/ACCOUNT_ID/applications/APPLICATION_ID/ping_targets/disable -X POST -H "X-Api-Key: API_KEY"]
+ end
+ deploy.add_callback(:after_teardown) do
+ system %Q[curl https://rpm.newrelic.com/accounts/ACCOUNT_ID/applications/APPLICATION_ID/ping_targets/enable -X POST -H "X-Api-Key: API_KEY"]
+ end
+ end
+
+ deployment.deploy
end
end
```
-
-* The `ScreenNotifier` is added by default so when you override the `notifiers`
- option you need to manually add it to continue receiving screen output.
-
-To make your own notifier, take a look at [`Paratrooper::Notifier`][] to see
-what methods are available for override.
-
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`).