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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 344399129c3b5b86e4aebdd632e78cdb0715e728
4
- data.tar.gz: f2b83ab2a53760295ff5f6f77c2c4532c8b80465
3
+ metadata.gz: 74b8eb08a58894b414fa18f4606c28d484e33fe3
4
+ data.tar.gz: 9748e2ca46f3dee5317501278f6b53c1fc57ffa0
5
5
  SHA512:
6
- metadata.gz: dfd31278c9052ff607afef102fa6ca1d1c6b3bd9929e168b0def36c0d0fd9489e2568c0cfbfcfe64018a7612cd5b66763f7a44903415bb4549c4a9cdff6a3db1
7
- data.tar.gz: bfb1b6053309c7ddeceba8c26ab779d9886d7d135955d1b91788c5447598c9066eb287d54785506bf0be9f6f157eadbd534b384709c3beaeed0c8eb17982b7aa
6
+ metadata.gz: 647ec0a0781443343560a2fcc0339d11da6d28c8c337775519461a84e811fecaea883c26edfb496eb3d7fd382ca2dab23f9bfc1973e59bb2da9fcc24cc30c314
7
+ data.tar.gz: d0babc17feeab3f6a8350284057de3cffcd0e296ccc5c109f05b90ed9487e6b0656b353373c050fe7d4e0d516c4ec0da6ae9c3a63efe380180a13ff4139c8f67
@@ -1,8 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0
4
+
5
+ - Http calls no longer being made from system cURL
6
+
3
7
  ## 2.2.0
4
8
 
5
- - Allow deploy from specific branch.
9
+ - Allow deploy from specific branch
6
10
 
7
11
  ## 2.1.0
8
12
 
@@ -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 - Object used for outputting to screen
27
- # (optional).
28
- # :notifiers - Array of objects interested in being
29
- # notified of steps in deployment process
30
- # (optional).
31
- # :heroku - Object wrapper around heroku-api (optional).
32
- # :tag - String name to be used as a git reference
33
- # point for deploying from specific tag
34
- # (optional).
35
- # :match_tag - String name of git reference point to match
36
- # :tag to (optional).
37
- # :branch - String name to be used as a git reference
38
- # point for deploying from specific branch
39
- # (optional).
40
- # :system_caller - Object responsible for calling system
41
- # commands (optional).
42
- # :protocol - String web protocol to be used when pinging
43
- # application (optional, default: 'http').
44
- # :deployment_host - String host name to be used in git URL
45
- # (optional, default: 'heroku.com').
46
- # :migration_check - Object responsible for checking pending
47
- # migrations (optional).
48
- # :api_key - String version of heroku api key.
49
- # (default: looks in local Netrc file).
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
- system_call "curl -Il #{protocol}://#{app_url}"
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
- # * cURL'ing application URL to warm Heroku dyno
176
+ # * Accessing application URL to warm Heroku dyno
172
177
  #
173
178
  # Alias: #deploy
174
179
  def default_deploy
@@ -0,0 +1,13 @@
1
+ module Paratrooper
2
+ class HttpClientWrapper
3
+ attr_reader :http_client
4
+
5
+ def initialize(options = {})
6
+ @http_client= options[:http_client] || Excon
7
+ end
8
+
9
+ def get(url)
10
+ http_client.get(url)
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Paratrooper
2
- VERSION = "2.2.0".freeze
2
+ VERSION = "2.3.0".freeze
3
3
  end
@@ -25,4 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency 'heroku-api', '~> 0.3'
26
26
  gem.add_dependency 'rendezvous', '~> 0.0.1'
27
27
  gem.add_dependency 'netrc', '~> 0.7'
28
+ gem.add_dependency 'excon'
28
29
  end
@@ -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
- expected_call = 'curl -Il http://application_url'
375
- system_caller.should_receive(:execute).with(expected_call)
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
- expected_call = 'curl -Il https://application_url'
384
- system_caller.should_receive(:execute).with(expected_call)
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.2.0
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-24 00:00:00.000000000 Z
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