paratrooper 2.2.0 → 2.3.0
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/CHANGELOG.md +5 -1
- data/lib/paratrooper/deploy.rb +32 -27
- data/lib/paratrooper/http_client_wrapper.rb +13 -0
- data/lib/paratrooper/version.rb +1 -1
- data/paratrooper.gemspec +1 -0
- data/spec/paratrooper/deploy_spec.rb +7 -5
- data/spec/paratrooper/http_client_wrapper_spec.rb +20 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74b8eb08a58894b414fa18f4606c28d484e33fe3
|
4
|
+
data.tar.gz: 9748e2ca46f3dee5317501278f6b53c1fc57ffa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 647ec0a0781443343560a2fcc0339d11da6d28c8c337775519461a84e811fecaea883c26edfb496eb3d7fd382ca2dab23f9bfc1973e59bb2da9fcc24cc30c314
|
7
|
+
data.tar.gz: d0babc17feeab3f6a8350284057de3cffcd0e296ccc5c109f05b90ed9487e6b0656b353373c050fe7d4e0d516c4ec0da6ae9c3a63efe380180a13ff4139c8f67
|
data/CHANGELOG.md
CHANGED
data/lib/paratrooper/deploy.rb
CHANGED
@@ -3,6 +3,7 @@ require 'paratrooper/system_caller'
|
|
3
3
|
require 'paratrooper/notifiers/screen_notifier'
|
4
4
|
require 'paratrooper/pending_migration_check'
|
5
5
|
require 'paratrooper/callbacks'
|
6
|
+
require 'paratrooper/http_client_wrapper'
|
6
7
|
|
7
8
|
module Paratrooper
|
8
9
|
|
@@ -13,7 +14,7 @@ module Paratrooper
|
|
13
14
|
|
14
15
|
attr_accessor :app_name, :notifiers, :system_caller, :heroku, :tag_name,
|
15
16
|
:match_tag_name, :protocol, :deployment_host, :migration_check, :debug,
|
16
|
-
:screen_notifier, :branch_name
|
17
|
+
:screen_notifier, :branch_name, :http_client
|
17
18
|
|
18
19
|
alias_method :tag=, :tag_name=
|
19
20
|
alias_method :match_tag=, :match_tag_name=
|
@@ -23,30 +24,33 @@ module Paratrooper
|
|
23
24
|
#
|
24
25
|
# app_name - A String naming the Heroku application to be interacted with.
|
25
26
|
# options - The Hash options is used to provide additional functionality.
|
26
|
-
# :screen_notifier
|
27
|
-
#
|
28
|
-
# :notifiers
|
29
|
-
#
|
30
|
-
#
|
31
|
-
# :heroku
|
32
|
-
# :tag
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# :match_tag
|
36
|
-
#
|
37
|
-
# :branch
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# :system_caller
|
41
|
-
#
|
42
|
-
# :protocol
|
43
|
-
#
|
44
|
-
# :deployment_host
|
45
|
-
#
|
46
|
-
# :migration_check
|
47
|
-
#
|
48
|
-
# :api_key
|
49
|
-
#
|
27
|
+
# :screen_notifier - Object used for outputting to screen
|
28
|
+
# (optional).
|
29
|
+
# :notifiers - Array of objects interested in being
|
30
|
+
# notified of steps in deployment process
|
31
|
+
# (optional).
|
32
|
+
# :heroku - Object wrapper around heroku-api (optional).
|
33
|
+
# :tag - String name to be used as a git reference
|
34
|
+
# point for deploying from specific tag
|
35
|
+
# (optional).
|
36
|
+
# :match_tag - String name of git reference point to match
|
37
|
+
# :tag to (optional).
|
38
|
+
# :branch - String name to be used as a git reference
|
39
|
+
# point for deploying from specific branch
|
40
|
+
# (optional).
|
41
|
+
# :system_caller - Object responsible for calling system
|
42
|
+
# commands (optional).
|
43
|
+
# :protocol - String web protocol to be used when pinging
|
44
|
+
# application (optional, default: 'http').
|
45
|
+
# :deployment_host - String host name to be used in git URL
|
46
|
+
# (optional, default: 'heroku.com').
|
47
|
+
# :migration_check - Object responsible for checking pending
|
48
|
+
# migrations (optional).
|
49
|
+
# :api_key - String version of heroku api key.
|
50
|
+
# (default: looks in local Netrc file).
|
51
|
+
# :http_client - Object responsible for making http calls
|
52
|
+
# (optional).
|
53
|
+
#
|
50
54
|
def initialize(app_name, options = {}, &block)
|
51
55
|
@app_name = app_name
|
52
56
|
@screen_notifier = options[:screen_notifier] || Notifiers::ScreenNotifier.new
|
@@ -60,6 +64,7 @@ module Paratrooper
|
|
60
64
|
@deployment_host = options[:deployment_host] || 'heroku.com'
|
61
65
|
@debug = options[:debug] || false
|
62
66
|
@migration_check = options[:migration_check] || PendingMigrationCheck.new(match_tag_name, heroku, system_caller)
|
67
|
+
@http_client = options[:http_client] || HttpClientWrapper.new
|
63
68
|
|
64
69
|
block.call(self) if block_given?
|
65
70
|
end
|
@@ -155,7 +160,7 @@ module Paratrooper
|
|
155
160
|
callback(:warm_instance) do
|
156
161
|
notify(:warm_instance)
|
157
162
|
sleep wait_time
|
158
|
-
|
163
|
+
http_client.get("#{protocol}://#{app_url}")
|
159
164
|
end
|
160
165
|
end
|
161
166
|
|
@@ -168,7 +173,7 @@ module Paratrooper
|
|
168
173
|
# * Running database migrations
|
169
174
|
# * Restarting application on Heroku
|
170
175
|
# * Deactivating maintenance page
|
171
|
-
# *
|
176
|
+
# * Accessing application URL to warm Heroku dyno
|
172
177
|
#
|
173
178
|
# Alias: #deploy
|
174
179
|
def default_deploy
|
data/lib/paratrooper/version.rb
CHANGED
data/paratrooper.gemspec
CHANGED
@@ -12,7 +12,8 @@ describe Paratrooper::Deploy do
|
|
12
12
|
notifiers: [],
|
13
13
|
system_caller: system_caller,
|
14
14
|
migration_check: migration_check,
|
15
|
-
screen_notifier: screen_notifier
|
15
|
+
screen_notifier: screen_notifier,
|
16
|
+
http_client: http_client
|
16
17
|
}
|
17
18
|
end
|
18
19
|
let(:options) { Hash.new }
|
@@ -33,6 +34,7 @@ describe Paratrooper::Deploy do
|
|
33
34
|
let(:domain_response) do
|
34
35
|
double(:domain_response, body: [{'domain' => 'application_url'}])
|
35
36
|
end
|
37
|
+
let(:http_client) { double(:http_client).as_null_object }
|
36
38
|
|
37
39
|
describe "tag=" do
|
38
40
|
specify "tag is set and @tag_name holds value" do
|
@@ -371,8 +373,8 @@ describe Paratrooper::Deploy do
|
|
371
373
|
end
|
372
374
|
|
373
375
|
it 'pings application url' do
|
374
|
-
|
375
|
-
|
376
|
+
expected_url = 'http://application_url'
|
377
|
+
expect(http_client).to receive(:get).with(expected_url)
|
376
378
|
deployer.warm_instance(0)
|
377
379
|
end
|
378
380
|
|
@@ -380,8 +382,8 @@ describe Paratrooper::Deploy do
|
|
380
382
|
let(:options) { { protocol: 'https' } }
|
381
383
|
|
382
384
|
it 'pings application url using the protocol' do
|
383
|
-
|
384
|
-
|
385
|
+
expected_url = 'https://application_url'
|
386
|
+
expect(http_client).to receive(:get).with(expected_url)
|
385
387
|
deployer.warm_instance(0)
|
386
388
|
end
|
387
389
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'paratrooper/http_client_wrapper'
|
3
|
+
|
4
|
+
describe Paratrooper::HttpClientWrapper do
|
5
|
+
let(:wrapper) { described_class.new(default_options) }
|
6
|
+
let(:default_options) do
|
7
|
+
{
|
8
|
+
http_client: http_client
|
9
|
+
}
|
10
|
+
end
|
11
|
+
let(:http_client) { double(:http_client) }
|
12
|
+
|
13
|
+
describe "GET a url" do
|
14
|
+
it "accepts a string url and makes a GET request for it" do
|
15
|
+
expected_url = "GO GET SOMETHING"
|
16
|
+
expect(http_client).to receive(:get).with(expected_url)
|
17
|
+
wrapper.get(expected_url)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
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.3.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-03
|
12
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0.7'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: excon
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
98
112
|
description: Library to create task for deployment to Heroku
|
99
113
|
email:
|
100
114
|
- matt.polito@gmail.com
|
@@ -116,6 +130,7 @@ files:
|
|
116
130
|
- lib/paratrooper/callbacks.rb
|
117
131
|
- lib/paratrooper/deploy.rb
|
118
132
|
- lib/paratrooper/heroku_wrapper.rb
|
133
|
+
- lib/paratrooper/http_client_wrapper.rb
|
119
134
|
- lib/paratrooper/local_api_key_extractor.rb
|
120
135
|
- lib/paratrooper/notifier.rb
|
121
136
|
- lib/paratrooper/notifiers/screen_notifier.rb
|
@@ -126,6 +141,7 @@ files:
|
|
126
141
|
- spec/fixtures/netrc
|
127
142
|
- spec/paratrooper/deploy_spec.rb
|
128
143
|
- spec/paratrooper/heroku_wrapper_spec.rb
|
144
|
+
- spec/paratrooper/http_client_wrapper_spec.rb
|
129
145
|
- spec/paratrooper/local_api_key_extractor_spec.rb
|
130
146
|
- spec/paratrooper/notifier_spec.rb
|
131
147
|
- spec/paratrooper/notifiers/screen_notifier_spec.rb
|
@@ -159,6 +175,7 @@ test_files:
|
|
159
175
|
- spec/fixtures/netrc
|
160
176
|
- spec/paratrooper/deploy_spec.rb
|
161
177
|
- spec/paratrooper/heroku_wrapper_spec.rb
|
178
|
+
- spec/paratrooper/http_client_wrapper_spec.rb
|
162
179
|
- spec/paratrooper/local_api_key_extractor_spec.rb
|
163
180
|
- spec/paratrooper/notifier_spec.rb
|
164
181
|
- spec/paratrooper/notifiers/screen_notifier_spec.rb
|