paratrooper 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +23 -8
- data/lib/paratrooper/deploy.rb +8 -0
- data/lib/paratrooper/heroku_wrapper.rb +6 -2
- data/lib/paratrooper/version.rb +1 -1
- data/spec/paratrooper/deploy_spec.rb +7 -0
- data/spec/paratrooper/heroku_wrapper_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 410362d7ac00deb0a6d77c47b68d147b68fb8865
|
4
|
+
data.tar.gz: 0058698a8877213f584926400c349ab063782696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eada1e483d9c5d98e2261cf9fd5bdcb7be476add7c95259758f353931f8342d9d4ecaf944d12592c68eb148133cb9c3a797057574829631e7d3c0a675d876de6
|
7
|
+
data.tar.gz: d8278b08c8037ab5aaa5adbd4924e697dd72b02d81c477cdb4864b7c5768d375acafe29ce8c217b998dee20bdb38aa9b3fb1c57a205ffd1635cfa724e5b27928
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -103,9 +103,7 @@ By providing tag options for Paratrooper, your code can be tagged and deployed f
|
|
103
103
|
|
104
104
|
### Staging example
|
105
105
|
```ruby
|
106
|
-
Paratrooper::Deploy.new("staging-app",
|
107
|
-
tag: 'staging'
|
108
|
-
)
|
106
|
+
Paratrooper::Deploy.new("staging-app", tag: 'staging')
|
109
107
|
```
|
110
108
|
This will create/update a `staging` git tag at `HEAD`.
|
111
109
|
|
@@ -149,9 +147,7 @@ require 'paratrooper'
|
|
149
147
|
namespace :deploy do
|
150
148
|
desc 'Deploy app in staging environment'
|
151
149
|
task :staging do
|
152
|
-
deployment = Paratrooper::Deploy.new("amazing-staging-app",
|
153
|
-
tag: 'staging'
|
154
|
-
)
|
150
|
+
deployment = Paratrooper::Deploy.new("amazing-staging-app", tag: 'staging')
|
155
151
|
|
156
152
|
deployment.deploy
|
157
153
|
end
|
@@ -162,7 +158,7 @@ namespace :deploy do
|
|
162
158
|
deploy.tag = 'production',
|
163
159
|
deploy.match_tag = 'staging',
|
164
160
|
deploy.maintenance_mode = !ENV['NO_MAINTENANCE']
|
165
|
-
|
161
|
+
end
|
166
162
|
|
167
163
|
deployment.deploy
|
168
164
|
end
|
@@ -196,7 +192,6 @@ to disable your application monitoring.
|
|
196
192
|
|
197
193
|
```ruby
|
198
194
|
# lib/tasks/deploy.rake
|
199
|
-
require 'paratrooper'
|
200
195
|
|
201
196
|
namespace :deploy do
|
202
197
|
desc 'Deploy app in production environment'
|
@@ -219,6 +214,26 @@ namespace :deploy do
|
|
219
214
|
end
|
220
215
|
```
|
221
216
|
|
217
|
+
Or maybe you just want to run a rake task on your application
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
# lib/tasks/deploy.rake
|
221
|
+
|
222
|
+
namespace :deploy do
|
223
|
+
desc 'Deploy app in production environment'
|
224
|
+
task :production do
|
225
|
+
deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
|
226
|
+
deploy.add_callback(:after_teardown) do |output|
|
227
|
+
output.display("Running some task that needs to run")
|
228
|
+
deploy.add_remote_task("rake some:task:to:run")
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
deployment.deploy
|
233
|
+
end
|
234
|
+
end
|
235
|
+
```
|
236
|
+
|
222
237
|
## Contributing
|
223
238
|
|
224
239
|
1. Fork it
|
data/lib/paratrooper/deploy.rb
CHANGED
@@ -175,6 +175,14 @@ module Paratrooper
|
|
175
175
|
end
|
176
176
|
alias_method :deploy, :default_deploy
|
177
177
|
|
178
|
+
# Public: Runs task on your heroku instance.
|
179
|
+
#
|
180
|
+
# task_name - String name of task to run on heroku instance
|
181
|
+
#
|
182
|
+
def add_remote_task(task_name)
|
183
|
+
heroku.run_task(task_name)
|
184
|
+
end
|
185
|
+
|
178
186
|
private
|
179
187
|
def app_url
|
180
188
|
heroku.app_url
|
@@ -31,8 +31,12 @@ module Paratrooper
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def run_migrations
|
34
|
-
|
35
|
-
|
34
|
+
run_task('rake db:migrate')
|
35
|
+
end
|
36
|
+
|
37
|
+
def run_task(task_name)
|
38
|
+
data = heroku_api.post_ps(app_name, task_name, attach: 'true').body
|
39
|
+
rendezvous.start(url: data['rendezvous_url'])
|
36
40
|
end
|
37
41
|
|
38
42
|
def last_deploy_commit
|
data/lib/paratrooper/version.rb
CHANGED
@@ -382,5 +382,12 @@ describe Paratrooper::Deploy do
|
|
382
382
|
end
|
383
383
|
end
|
384
384
|
end
|
385
|
+
|
386
|
+
describe "#add_remote_task" do
|
387
|
+
it "makes call to heroku to run task" do
|
388
|
+
expect(heroku).to receive(:run_task).with("rake some:task:to:run")
|
389
|
+
deployer.add_remote_task("rake some:task:to:run")
|
390
|
+
end
|
391
|
+
end
|
385
392
|
end
|
386
393
|
end
|
@@ -132,4 +132,12 @@ describe Paratrooper::HerokuWrapper do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
135
|
+
|
136
|
+
describe "#run_task" do
|
137
|
+
it 'calls into the heroku api' do
|
138
|
+
task = 'rake some:task:to:run'
|
139
|
+
expect(heroku_api).to receive(:post_ps).with(app_name, task, attach: 'true').and_return(double(body: ''))
|
140
|
+
wrapper.run_task(task)
|
141
|
+
end
|
142
|
+
end
|
135
143
|
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: 2.
|
4
|
+
version: 2.1.0
|
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: 2014-02-
|
12
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|