paratrooper 1.4.2 → 2.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -1
- data/README.md +60 -26
- data/Rakefile +4 -1
- data/lib/paratrooper/callbacks.rb +21 -0
- data/lib/paratrooper/deploy.rb +91 -53
- data/lib/paratrooper/version.rb +1 -1
- data/spec/paratrooper/deploy_spec.rb +112 -14
- metadata +6 -5
- data/Gemfile.lock +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cdee8a2553bcc4297a5201449429d4be4c9075e
|
4
|
+
data.tar.gz: 95a19b97249116f577655ab60298af1d396c3a92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c617517de7e35016f00629f22e5567ac6d57129bcdecb07ce1c6545e32f25d06245d207c53143c8f1df3c0dade39dbfa69b006248b8f001b207ca8a7b16e12e2
|
7
|
+
data.tar.gz: 939942fc3004f1deb0134ded9e71b515ce11bd324fc347b2a8df9d52ef380212ec1aabad287eddea0cb852139ae0ab4963d832d2c91fa43ce92bafd09cdabc11
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/README.md
CHANGED
@@ -42,6 +42,14 @@ You can also provide a tag:
|
|
42
42
|
Paratrooper::Deploy.new('amazing-app', tag: 'staging')
|
43
43
|
```
|
44
44
|
|
45
|
+
or alternatively:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
Paratrooper::Deploy.new('amazing-app') do |deploy|
|
49
|
+
deploy.tag = 'staging'
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
45
53
|
## Authentication
|
46
54
|
|
47
55
|
You can authenticate your Heroku account in a few ways:
|
@@ -75,6 +83,14 @@ If you use multiple SSH keys for managing multiple accounts, for example in your
|
|
75
83
|
Paratrooper::Deploy.new('app', deployment_host: 'HOST')
|
76
84
|
```
|
77
85
|
|
86
|
+
or alternatively:
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
Paratrooper::Deploy.new('amazing-app') do |deploy|
|
90
|
+
deploy.deployment_host = 'HOST'
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
78
94
|
This also works if you're using the [heroku-accounts](https://github.com/ddollar/heroku-accounts) plugin:
|
79
95
|
|
80
96
|
```ruby
|
@@ -97,9 +113,18 @@ This will create/update a `staging` git tag at `HEAD`.
|
|
97
113
|
```ruby
|
98
114
|
Paratrooper::Deploy.new("amazing-production-app",
|
99
115
|
tag: 'production',
|
100
|
-
|
116
|
+
match_tag: 'staging'
|
101
117
|
)
|
102
118
|
```
|
119
|
+
|
120
|
+
or alternatively:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
Paratrooper::Deploy.new('amazing-production-app') do |deploy|
|
124
|
+
deploy.tag = 'production'
|
125
|
+
deploy.match_tag = 'staging'
|
126
|
+
end
|
127
|
+
```
|
103
128
|
This will create/update a `production` git tag at `staging` and deploy the `production` tag.
|
104
129
|
|
105
130
|
## Sensible Default Deployment
|
@@ -133,9 +158,10 @@ namespace :deploy do
|
|
133
158
|
|
134
159
|
desc 'Deploy app in production environment'
|
135
160
|
task :production do
|
136
|
-
deployment = Paratrooper::Deploy.new("amazing-production-app"
|
137
|
-
tag
|
138
|
-
|
161
|
+
deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
|
162
|
+
deploy.tag = 'production',
|
163
|
+
deploy.match_tag = 'staging',
|
164
|
+
deploy.maintenance_mode = !ENV['NO_MAINTENANCE']
|
139
165
|
)
|
140
166
|
|
141
167
|
deployment.deploy
|
@@ -146,43 +172,51 @@ end
|
|
146
172
|
## Bucking the Norm
|
147
173
|
|
148
174
|
Our default deploy gets us most of the way, but maybe it's not for you--we've
|
149
|
-
got you covered. Every deployment method
|
150
|
-
|
175
|
+
got you covered. Every deployment method has a set of callback instructions that can be
|
176
|
+
utilized in almost any way you can imagine.
|
151
177
|
|
152
|
-
|
153
|
-
|
178
|
+
The `add_callback` method allows for the execution of arbitrary code within different steps of the deploy process.
|
179
|
+
|
180
|
+
There are 'before' and 'after' hooks for each of the following:
|
181
|
+
|
182
|
+
* setup
|
183
|
+
* activate_maintenance_mode
|
184
|
+
* update_repo_tag
|
185
|
+
* push_repo
|
186
|
+
* run_migrations
|
187
|
+
* app_restart
|
188
|
+
* deactivate_maintenance_mode
|
189
|
+
* warm_instance
|
190
|
+
* teardown
|
154
191
|
|
155
192
|
### Example Usage
|
156
193
|
|
157
|
-
|
158
|
-
|
159
|
-
gem 'paratrooper-newrelic'
|
194
|
+
For example, say you want to let [New Relic][] know that you are deploying and
|
195
|
+
to disable your application monitoring.
|
160
196
|
|
197
|
+
```ruby
|
161
198
|
# lib/tasks/deploy.rake
|
162
199
|
require 'paratrooper'
|
163
200
|
|
164
201
|
namespace :deploy do
|
165
202
|
desc 'Deploy app in production environment'
|
166
203
|
task :production do
|
167
|
-
deployment = Paratrooper::Deploy.new("amazing-production-app"
|
168
|
-
tag
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
204
|
+
deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
|
205
|
+
deploy.tag = 'production'
|
206
|
+
deploy.match_tag = 'staging'
|
207
|
+
deploy.add_callback(:before_setup) do
|
208
|
+
system %Q[curl https://rpm.newrelic.com/accounts/ACCOUNT_ID/applications/APPLICATION_ID/ping_targets/disable -X POST -H "X-Api-Key: API_KEY"]
|
209
|
+
end
|
210
|
+
deploy.add_callback(:after_teardown) do
|
211
|
+
system %Q[curl https://rpm.newrelic.com/accounts/ACCOUNT_ID/applications/APPLICATION_ID/ping_targets/enable -X POST -H "X-Api-Key: API_KEY"]
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
deployment.deploy
|
175
216
|
end
|
176
217
|
end
|
177
218
|
```
|
178
219
|
|
179
|
-
* The `ScreenNotifier` is added by default so when you override the `notifiers`
|
180
|
-
option you need to manually add it to continue receiving screen output.
|
181
|
-
|
182
|
-
To make your own notifier, take a look at [`Paratrooper::Notifier`][] to see
|
183
|
-
what methods are available for override.
|
184
|
-
|
185
|
-
|
186
220
|
## Contributing
|
187
221
|
|
188
222
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Paratrooper
|
2
|
+
module Callbacks
|
3
|
+
def callback(name, &block)
|
4
|
+
execute_callback("before_#{name}".to_sym)
|
5
|
+
block.call if block_given?
|
6
|
+
execute_callback("after_#{name}".to_sym)
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute_callback(name)
|
10
|
+
callbacks[name].each(&:call)
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_callback(name, &block)
|
14
|
+
callbacks[name] << block
|
15
|
+
end
|
16
|
+
|
17
|
+
def callbacks
|
18
|
+
@callbacks ||= Hash.new { |hash, key| hash[key] = [] }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/paratrooper/deploy.rb
CHANGED
@@ -2,83 +2,109 @@ require 'paratrooper/heroku_wrapper'
|
|
2
2
|
require 'paratrooper/system_caller'
|
3
3
|
require 'paratrooper/notifiers/screen_notifier'
|
4
4
|
require 'paratrooper/pending_migration_check'
|
5
|
+
require 'paratrooper/callbacks'
|
5
6
|
|
6
7
|
module Paratrooper
|
7
8
|
|
8
9
|
# Public: Entry point into the library.
|
9
10
|
#
|
10
11
|
class Deploy
|
11
|
-
|
12
|
-
|
12
|
+
include Callbacks
|
13
|
+
|
14
|
+
attr_accessor :app_name, :notifiers, :system_caller, :heroku, :tag_name,
|
15
|
+
:match_tag_name, :protocol, :deployment_host, :migration_check, :debug,
|
16
|
+
:maintenance_mode
|
17
|
+
|
18
|
+
alias_method :tag=, :tag_name=
|
19
|
+
alias_method :match_tag=, :match_tag_name=
|
13
20
|
|
14
21
|
# Public: Initializes a Deploy
|
15
22
|
#
|
16
23
|
# app_name - A String naming the Heroku application to be interacted with.
|
17
24
|
# options - The Hash options is used to provide additional functionality.
|
18
|
-
# :notifiers
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# :heroku
|
22
|
-
# :tag
|
23
|
-
#
|
24
|
-
# :match_tag_to
|
25
|
-
#
|
26
|
-
# :system_caller
|
27
|
-
#
|
28
|
-
# :protocol
|
29
|
-
#
|
30
|
-
# :deployment_host
|
31
|
-
#
|
32
|
-
# :migration_check
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
@
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
25
|
+
# :notifiers - Array of objects interested in being
|
26
|
+
# notified of steps in deployment process
|
27
|
+
# (optional).
|
28
|
+
# :heroku - Object wrapper around heroku-api (optional).
|
29
|
+
# :tag - String name to be used as a git reference
|
30
|
+
# point (optional).
|
31
|
+
# :match_tag_to - String name of git reference point to match
|
32
|
+
# :tag to (optional).
|
33
|
+
# :system_caller - Object responsible for calling system
|
34
|
+
# commands (optional).
|
35
|
+
# :protocol - String web protocol to be used when pinging
|
36
|
+
# application (optional, default: 'http').
|
37
|
+
# :deployment_host - String host name to be used in git URL
|
38
|
+
# (optional, default: 'heroku.com').
|
39
|
+
# :migration_check - Object responsible for checking pending
|
40
|
+
# migrations (optional).
|
41
|
+
# :maintenance_mode - Boolean whether to trigger maintenance
|
42
|
+
# mode on and off during deployment
|
43
|
+
# (default: true)
|
44
|
+
# :api_key - String version of heroku api key.
|
45
|
+
# (default: looks in local Netrc file)
|
46
|
+
def initialize(app_name, options = {}, &block)
|
47
|
+
@app_name = app_name
|
48
|
+
@notifiers = options[:notifiers] || [Notifiers::ScreenNotifier.new]
|
49
|
+
@heroku = options[:heroku] || HerokuWrapper.new(app_name, options)
|
50
|
+
@tag_name = options[:tag]
|
51
|
+
@match_tag_name = options[:match_tag] || 'master'
|
52
|
+
@system_caller = options[:system_caller] || SystemCaller.new(debug)
|
53
|
+
@protocol = options[:protocol] || 'http'
|
54
|
+
@deployment_host = options[:deployment_host] || 'heroku.com'
|
55
|
+
@debug = options[:debug] || false
|
56
|
+
@maintenance_mode = options.fetch(:maintenance_mode, true)
|
44
57
|
self.migration_check = options[:migration_check]
|
58
|
+
block.call(self) if block_given?
|
45
59
|
end
|
46
60
|
|
47
|
-
def
|
48
|
-
|
61
|
+
def notify(step, options = {})
|
62
|
+
notifiers.each do |notifier|
|
63
|
+
notifier.notify(step, default_payload.merge(options))
|
64
|
+
end
|
49
65
|
end
|
50
66
|
|
51
|
-
def
|
52
|
-
|
67
|
+
def setup
|
68
|
+
callback(:setup) do
|
69
|
+
notify(:setup)
|
70
|
+
end
|
53
71
|
end
|
54
72
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
73
|
+
def teardown
|
74
|
+
callback(:teardown) do
|
75
|
+
notify(:teardown)
|
58
76
|
end
|
59
77
|
end
|
60
78
|
|
61
79
|
# Public: Activates Heroku maintenance mode.
|
62
80
|
#
|
63
81
|
def activate_maintenance_mode
|
64
|
-
|
65
|
-
|
82
|
+
return unless maintenance_mode?
|
83
|
+
callback(:activate_maintenance_mode) do
|
84
|
+
notify(:activate_maintenance_mode)
|
85
|
+
heroku.app_maintenance_on
|
86
|
+
end
|
66
87
|
end
|
67
88
|
|
68
89
|
# Public: Deactivates Heroku maintenance mode.
|
69
90
|
#
|
70
91
|
def deactivate_maintenance_mode
|
71
|
-
|
72
|
-
|
92
|
+
return unless maintenance_mode?
|
93
|
+
callback(:deactivate_maintenance_mode) do
|
94
|
+
notify(:deactivate_maintenance_mode)
|
95
|
+
heroku.app_maintenance_off
|
96
|
+
end
|
73
97
|
end
|
74
98
|
|
75
99
|
# Public: Creates a git tag and pushes it to repository.
|
76
100
|
#
|
77
101
|
def update_repo_tag
|
78
102
|
unless tag_name.nil? || tag_name.empty?
|
79
|
-
|
80
|
-
|
81
|
-
|
103
|
+
callback(:update_repo_tag) do
|
104
|
+
notify(:update_repo_tag)
|
105
|
+
system_call "git tag #{tag_name} #{match_tag_name} -f"
|
106
|
+
system_call "git push -f origin #{tag_name}"
|
107
|
+
end
|
82
108
|
end
|
83
109
|
end
|
84
110
|
|
@@ -86,31 +112,39 @@ module Paratrooper
|
|
86
112
|
#
|
87
113
|
def push_repo
|
88
114
|
reference_point = tag_name || 'master'
|
89
|
-
|
90
|
-
|
115
|
+
callback(:push_repo) do
|
116
|
+
notify(:push_repo, reference_point: reference_point)
|
117
|
+
system_call "git push -f #{deployment_remote} #{reference_point}:refs/heads/master"
|
118
|
+
end
|
91
119
|
end
|
92
120
|
|
93
121
|
# Public: Runs rails database migrations on your application.
|
94
122
|
#
|
95
123
|
def run_migrations
|
96
124
|
return unless pending_migrations?
|
97
|
-
|
98
|
-
|
125
|
+
callback(:run_migrations) do
|
126
|
+
notify(:run_migrations)
|
127
|
+
heroku.run_migrations
|
128
|
+
end
|
99
129
|
end
|
100
130
|
|
101
131
|
# Public: Restarts application on Heroku.
|
102
132
|
#
|
103
133
|
def app_restart
|
104
|
-
|
105
|
-
|
134
|
+
callback(:app_restart) do
|
135
|
+
notify(:app_restart)
|
136
|
+
heroku.app_restart
|
137
|
+
end
|
106
138
|
end
|
107
139
|
|
108
140
|
# Public: cURL for application URL to start your Heroku dyno.
|
109
141
|
#
|
110
142
|
def warm_instance(wait_time = 3)
|
111
|
-
|
112
|
-
|
113
|
-
|
143
|
+
callback(:warm_instance) do
|
144
|
+
notify(:warm_instance)
|
145
|
+
sleep wait_time
|
146
|
+
system_call "curl -Il #{protocol}://#{app_url}"
|
147
|
+
end
|
114
148
|
end
|
115
149
|
|
116
150
|
# Public: Execute common deploy steps.
|
@@ -138,6 +172,10 @@ module Paratrooper
|
|
138
172
|
end
|
139
173
|
alias_method :deploy, :default_deploy
|
140
174
|
|
175
|
+
def maintenance_mode?
|
176
|
+
!!@maintenance_mode
|
177
|
+
end
|
178
|
+
|
141
179
|
private
|
142
180
|
def app_url
|
143
181
|
heroku.app_url
|
@@ -149,7 +187,7 @@ module Paratrooper
|
|
149
187
|
app_url: app_url,
|
150
188
|
deployment_remote: deployment_remote,
|
151
189
|
tag_name: tag_name,
|
152
|
-
match_tag:
|
190
|
+
match_tag: match_tag_name
|
153
191
|
}
|
154
192
|
end
|
155
193
|
|
@@ -166,7 +204,7 @@ module Paratrooper
|
|
166
204
|
end
|
167
205
|
|
168
206
|
def migration_check=(obj)
|
169
|
-
@migration_check = obj || PendingMigrationCheck.new(
|
207
|
+
@migration_check = obj || PendingMigrationCheck.new(match_tag_name, heroku, system_caller)
|
170
208
|
@migration_check.last_deployed_commit
|
171
209
|
@migration_check
|
172
210
|
end
|
data/lib/paratrooper/version.rb
CHANGED
@@ -11,7 +11,8 @@ describe Paratrooper::Deploy do
|
|
11
11
|
heroku: heroku,
|
12
12
|
notifiers: [],
|
13
13
|
system_caller: system_caller,
|
14
|
-
migration_check: migration_check
|
14
|
+
migration_check: migration_check,
|
15
|
+
maintenance_mode: true
|
15
16
|
}
|
16
17
|
end
|
17
18
|
let(:options) { Hash.new }
|
@@ -32,6 +33,39 @@ describe Paratrooper::Deploy do
|
|
32
33
|
double(:domain_response, body: [{'domain' => 'application_url'}])
|
33
34
|
end
|
34
35
|
|
36
|
+
describe "tag=" do
|
37
|
+
specify "tag is set and @tag_name holds value" do
|
38
|
+
deployer.tag = "tag_name"
|
39
|
+
expect(deployer.tag_name).to eq("tag_name")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "match_tag_to=" do
|
44
|
+
specify "match_tag is set and @match_tag_name holds value" do
|
45
|
+
deployer.match_tag = "staging"
|
46
|
+
expect(deployer.match_tag_name).to eq("staging")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "passing a block to initialize" do
|
51
|
+
it "sets attributes on self" do
|
52
|
+
deployer = described_class.new(app_name, default_options) do |p|
|
53
|
+
p.match_tag = "staging"
|
54
|
+
p.tag = "production"
|
55
|
+
p.debug = true
|
56
|
+
p.maintenance_mode = true
|
57
|
+
p.deployment_host = "HOST"
|
58
|
+
p.protocol = "MOM"
|
59
|
+
end
|
60
|
+
expect(deployer.match_tag_name).to eq("staging")
|
61
|
+
expect(deployer.tag_name).to eq("production")
|
62
|
+
expect(deployer.debug).to be_true
|
63
|
+
expect(deployer.maintenance_mode).to be_true
|
64
|
+
expect(deployer.deployment_host).to eq("HOST")
|
65
|
+
expect(deployer.protocol).to eq("MOM")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
35
69
|
describe "options" do
|
36
70
|
context "accepts :tag" do
|
37
71
|
let(:options) { { tag: 'tag_name' } }
|
@@ -59,6 +93,15 @@ describe Paratrooper::Deploy do
|
|
59
93
|
end
|
60
94
|
end
|
61
95
|
|
96
|
+
context "accepts :maintenance_mode" do
|
97
|
+
let(:options) { { maintenance_mode: false } }
|
98
|
+
let(:notifiers) { double(:notifier) }
|
99
|
+
|
100
|
+
it "and responds to #notifiers" do
|
101
|
+
expect(deployer.maintenance_mode?).to eq(false)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
62
105
|
describe "protocol" do
|
63
106
|
context "accepts :protocol" do
|
64
107
|
let(:options) { { protocol: 'https' } }
|
@@ -85,26 +128,62 @@ describe Paratrooper::Deploy do
|
|
85
128
|
end
|
86
129
|
|
87
130
|
describe "#activate_maintenance_mode" do
|
88
|
-
|
89
|
-
|
90
|
-
|
131
|
+
context "when maintenance_mode option is 'true'" do
|
132
|
+
let(:options) { { maintenance_mode: true } }
|
133
|
+
|
134
|
+
it 'sends notification' do
|
135
|
+
deployer.should_receive(:notify).with(:activate_maintenance_mode).once
|
136
|
+
deployer.activate_maintenance_mode
|
137
|
+
end
|
138
|
+
|
139
|
+
it "makes call to heroku to turn on maintenance mode" do
|
140
|
+
heroku.should_receive(:app_maintenance_on)
|
141
|
+
deployer.activate_maintenance_mode
|
142
|
+
end
|
91
143
|
end
|
92
144
|
|
93
|
-
|
94
|
-
|
95
|
-
|
145
|
+
context "when maintenance_mode option is 'false'" do
|
146
|
+
let(:options) { { maintenance_mode: false } }
|
147
|
+
|
148
|
+
it 'does not send notification' do
|
149
|
+
deployer.should_not_receive(:notify).with(:activate_maintenance_mode)
|
150
|
+
deployer.activate_maintenance_mode
|
151
|
+
end
|
152
|
+
|
153
|
+
it "does not make a call to heroku to turn on maintenance mode" do
|
154
|
+
heroku.should_not_receive(:app_maintenance_on)
|
155
|
+
deployer.activate_maintenance_mode
|
156
|
+
end
|
96
157
|
end
|
97
158
|
end
|
98
159
|
|
99
160
|
describe "#deactivate_maintenance_mode" do
|
100
|
-
|
101
|
-
|
102
|
-
|
161
|
+
context "when maintenance_mode option is 'true'" do
|
162
|
+
let(:options) { { maintenance_mode: true } }
|
163
|
+
|
164
|
+
it 'sends notification' do
|
165
|
+
deployer.should_receive(:notify).with(:deactivate_maintenance_mode).once
|
166
|
+
deployer.deactivate_maintenance_mode
|
167
|
+
end
|
168
|
+
|
169
|
+
it "makes call to heroku to turn on maintenance mode" do
|
170
|
+
heroku.should_receive(:app_maintenance_off)
|
171
|
+
deployer.deactivate_maintenance_mode
|
172
|
+
end
|
103
173
|
end
|
104
174
|
|
105
|
-
|
106
|
-
|
107
|
-
|
175
|
+
context "when maintenance_mode option is 'false'" do
|
176
|
+
let(:options) { { maintenance_mode: false } }
|
177
|
+
|
178
|
+
it 'does not send notification' do
|
179
|
+
deployer.should_not_receive(:notify).with(:deactivate_maintenance_mode)
|
180
|
+
deployer.deactivate_maintenance_mode
|
181
|
+
end
|
182
|
+
|
183
|
+
it "does not make a call to heroku to turn on maintenance mode" do
|
184
|
+
heroku.should_not_receive(:app_maintenance_off)
|
185
|
+
deployer.deactivate_maintenance_mode
|
186
|
+
end
|
108
187
|
end
|
109
188
|
end
|
110
189
|
|
@@ -123,7 +202,7 @@ describe Paratrooper::Deploy do
|
|
123
202
|
|
124
203
|
context "when deploy_tag is available" do
|
125
204
|
before do
|
126
|
-
options.merge!(
|
205
|
+
options.merge!(match_tag: 'deploy_this')
|
127
206
|
end
|
128
207
|
|
129
208
|
it 'creates a git tag at deploy_tag reference point' do
|
@@ -244,5 +323,24 @@ describe Paratrooper::Deploy do
|
|
244
323
|
deployer.warm_instance(0)
|
245
324
|
end
|
246
325
|
end
|
326
|
+
|
327
|
+
describe "adding notification" do
|
328
|
+
after do
|
329
|
+
FileUtils.rm("spec/fixtures/test.txt")
|
330
|
+
end
|
331
|
+
|
332
|
+
it "adds notifier to #notifiers collection" do
|
333
|
+
callback = proc do
|
334
|
+
system("touch spec/fixtures/test.txt")
|
335
|
+
end
|
336
|
+
|
337
|
+
deployer = described_class.new(app_name, default_options) do |p|
|
338
|
+
p.add_callback(:before_setup, &callback)
|
339
|
+
end
|
340
|
+
deployer.setup
|
341
|
+
|
342
|
+
expect(deployer.callbacks[:before_setup]).to eq([callback])
|
343
|
+
end
|
344
|
+
end
|
247
345
|
end
|
248
346
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paratrooper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Polito
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -105,14 +105,15 @@ extra_rdoc_files: []
|
|
105
105
|
files:
|
106
106
|
- .bundle/config
|
107
107
|
- .gitignore
|
108
|
+
- .rspec
|
108
109
|
- .ruby-version
|
109
110
|
- CHANGELOG.md
|
110
111
|
- Gemfile
|
111
|
-
- Gemfile.lock
|
112
112
|
- LICENSE.txt
|
113
113
|
- README.md
|
114
114
|
- Rakefile
|
115
115
|
- lib/paratrooper.rb
|
116
|
+
- lib/paratrooper/callbacks.rb
|
116
117
|
- lib/paratrooper/deploy.rb
|
117
118
|
- lib/paratrooper/heroku_wrapper.rb
|
118
119
|
- lib/paratrooper/local_api_key_extractor.rb
|
@@ -144,9 +145,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
145
|
version: '0'
|
145
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
147
|
requirements:
|
147
|
-
- - '
|
148
|
+
- - '>'
|
148
149
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
150
|
+
version: 1.3.1
|
150
151
|
requirements: []
|
151
152
|
rubyforge_project:
|
152
153
|
rubygems_version: 2.0.3
|
data/Gemfile.lock
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
paratrooper (1.4.2)
|
5
|
-
heroku-api (~> 0.3)
|
6
|
-
netrc (~> 0.7)
|
7
|
-
rendezvous (~> 0.0.1)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
coderay (1.0.8)
|
13
|
-
diff-lcs (1.1.3)
|
14
|
-
excon (0.22.1)
|
15
|
-
heroku-api (0.3.11)
|
16
|
-
excon (~> 0.22.1)
|
17
|
-
method_source (0.8.1)
|
18
|
-
netrc (0.7.7)
|
19
|
-
pry (0.9.10)
|
20
|
-
coderay (~> 1.0.5)
|
21
|
-
method_source (~> 0.8)
|
22
|
-
slop (~> 3.3.1)
|
23
|
-
rake (10.0.3)
|
24
|
-
rendezvous (0.0.2)
|
25
|
-
rspec (2.12.0)
|
26
|
-
rspec-core (~> 2.12.0)
|
27
|
-
rspec-expectations (~> 2.12.0)
|
28
|
-
rspec-mocks (~> 2.12.0)
|
29
|
-
rspec-core (2.12.2)
|
30
|
-
rspec-expectations (2.12.1)
|
31
|
-
diff-lcs (~> 1.1.3)
|
32
|
-
rspec-mocks (2.12.1)
|
33
|
-
slop (3.3.3)
|
34
|
-
|
35
|
-
PLATFORMS
|
36
|
-
ruby
|
37
|
-
|
38
|
-
DEPENDENCIES
|
39
|
-
paratrooper!
|
40
|
-
pry
|
41
|
-
rake
|
42
|
-
rspec (~> 2.12)
|