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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b7b516a0d18c8e4e6d1d6de3135759b4458b972
4
- data.tar.gz: 681ab0705b28dd8d424cba86f14b521e430ad686
3
+ metadata.gz: 410362d7ac00deb0a6d77c47b68d147b68fb8865
4
+ data.tar.gz: 0058698a8877213f584926400c349ab063782696
5
5
  SHA512:
6
- metadata.gz: b4a3c256b073b50946687a9a4233af371700072ba6b2d30dc0ffba0faa6e0c0ea7cb584b34fa2c2074ed9f3fca6dd35b050f2b3992af6ca5eaf3961240b33c50
7
- data.tar.gz: 7ce24654c188fec8c98e25cfcad858549ab9e35bfbc14aeec96061233f9ed1c9a0aeb34620a32481e0256c6cebce42184002b71e6b34b6c1a374976984e43b9b
6
+ metadata.gz: eada1e483d9c5d98e2261cf9fd5bdcb7be476add7c95259758f353931f8342d9d4ecaf944d12592c68eb148133cb9c3a797057574829631e7d3c0a675d876de6
7
+ data.tar.gz: d8278b08c8037ab5aaa5adbd4924e697dd72b02d81c477cdb4864b7c5768d375acafe29ce8c217b998dee20bdb38aa9b3fb1c57a205ffd1635cfa724e5b27928
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0
4
+
5
+ - Run remote tasks on your application
6
+
7
+ ## 2.0.0
8
+
9
+ - Updated README with callback output
10
+
3
11
  ## 2.0.0.beta2
4
12
 
5
13
  - Added license.txt
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
@@ -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
- data = heroku_api.post_ps(app_name, 'rake db:migrate', attach: 'true').body
35
- rendezvous.start(:url => data['rendezvous_url'])
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
@@ -1,3 +1,3 @@
1
1
  module Paratrooper
2
- VERSION = "2.0.0".freeze
2
+ VERSION = "2.1.0".freeze
3
3
  end
@@ -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.0.0
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-20 00:00:00.000000000 Z
12
+ date: 2014-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake