paratrooper 2.1.0 → 2.2.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 +4 -0
- data/lib/paratrooper/deploy.rb +20 -3
- data/lib/paratrooper/version.rb +1 -1
- data/spec/paratrooper/deploy_spec.rb +38 -4
- 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: 344399129c3b5b86e4aebdd632e78cdb0715e728
|
4
|
+
data.tar.gz: f2b83ab2a53760295ff5f6f77c2c4532c8b80465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfd31278c9052ff607afef102fa6ca1d1c6b3bd9929e168b0def36c0d0fd9489e2568c0cfbfcfe64018a7612cd5b66763f7a44903415bb4549c4a9cdff6a3db1
|
7
|
+
data.tar.gz: bfb1b6053309c7ddeceba8c26ab779d9886d7d135955d1b91788c5447598c9066eb287d54785506bf0be9f6f157eadbd534b384709c3beaeed0c8eb17982b7aa
|
data/CHANGELOG.md
CHANGED
data/lib/paratrooper/deploy.rb
CHANGED
@@ -13,10 +13,11 @@ module Paratrooper
|
|
13
13
|
|
14
14
|
attr_accessor :app_name, :notifiers, :system_caller, :heroku, :tag_name,
|
15
15
|
:match_tag_name, :protocol, :deployment_host, :migration_check, :debug,
|
16
|
-
:screen_notifier
|
16
|
+
:screen_notifier, :branch_name
|
17
17
|
|
18
18
|
alias_method :tag=, :tag_name=
|
19
19
|
alias_method :match_tag=, :match_tag_name=
|
20
|
+
alias_method :branch=, :branch_name=
|
20
21
|
|
21
22
|
# Public: Initializes a Deploy
|
22
23
|
#
|
@@ -29,9 +30,13 @@ module Paratrooper
|
|
29
30
|
# (optional).
|
30
31
|
# :heroku - Object wrapper around heroku-api (optional).
|
31
32
|
# :tag - String name to be used as a git reference
|
32
|
-
# point
|
33
|
+
# point for deploying from specific tag
|
34
|
+
# (optional).
|
33
35
|
# :match_tag - String name of git reference point to match
|
34
36
|
# :tag to (optional).
|
37
|
+
# :branch - String name to be used as a git reference
|
38
|
+
# point for deploying from specific branch
|
39
|
+
# (optional).
|
35
40
|
# :system_caller - Object responsible for calling system
|
36
41
|
# commands (optional).
|
37
42
|
# :protocol - String web protocol to be used when pinging
|
@@ -48,6 +53,7 @@ module Paratrooper
|
|
48
53
|
@notifiers = options[:notifiers] || [@screen_notifier]
|
49
54
|
@heroku = options[:heroku] || HerokuWrapper.new(app_name, options)
|
50
55
|
@tag_name = options[:tag]
|
56
|
+
@branch_name = options[:branch]
|
51
57
|
@match_tag_name = options[:match_tag] || 'master'
|
52
58
|
@system_caller = options[:system_caller] || SystemCaller.new(debug)
|
53
59
|
@protocol = options[:protocol] || 'http'
|
@@ -109,8 +115,11 @@ module Paratrooper
|
|
109
115
|
|
110
116
|
# Public: Pushes repository to Heroku.
|
111
117
|
#
|
118
|
+
# Based on the following precedence:
|
119
|
+
# branch_name / tag_name / 'master'
|
120
|
+
#
|
112
121
|
def push_repo
|
113
|
-
reference_point =
|
122
|
+
reference_point = git_branch_name || git_tag_name || 'master'
|
114
123
|
callback(:push_repo) do
|
115
124
|
notify(:push_repo, reference_point: reference_point)
|
116
125
|
system_call "git push -f #{deployment_remote} #{reference_point}:refs/heads/master"
|
@@ -208,6 +217,14 @@ module Paratrooper
|
|
208
217
|
"git@#{host}:#{name}.git"
|
209
218
|
end
|
210
219
|
|
220
|
+
def git_branch_name
|
221
|
+
"refs/heads/#{branch_name}" if branch_name
|
222
|
+
end
|
223
|
+
|
224
|
+
def git_tag_name
|
225
|
+
"refs/tags/#{tag_name}" if tag_name
|
226
|
+
end
|
227
|
+
|
211
228
|
def deployment_remote
|
212
229
|
git_remote(deployment_host, app_name)
|
213
230
|
end
|
data/lib/paratrooper/version.rb
CHANGED
@@ -48,6 +48,13 @@ describe Paratrooper::Deploy do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
describe "branch=" do
|
52
|
+
specify "branch is set and @branch_name holds value" do
|
53
|
+
deployer.branch = "branch_name"
|
54
|
+
expect(deployer.branch_name).to eq("branch_name")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
51
58
|
describe "passing a block to initialize" do
|
52
59
|
it "sets attributes on self" do
|
53
60
|
deployer = described_class.new(app_name, default_options) do |p|
|
@@ -252,11 +259,38 @@ describe Paratrooper::Deploy do
|
|
252
259
|
deployer.push_repo
|
253
260
|
end
|
254
261
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
262
|
+
context "when branch_name is available" do
|
263
|
+
before do
|
264
|
+
deployer.branch_name = "BRANCH_NAME"
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'pushes branch_name to heroku' do
|
268
|
+
expected_call = 'git push -f git@heroku.com:app.git refs/heads/BRANCH_NAME:refs/heads/master'
|
269
|
+
system_caller.should_receive(:execute).with(expected_call)
|
270
|
+
deployer.push_repo
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context "when tag_name with no branch_name is available" do
|
275
|
+
before do
|
276
|
+
deployer.tag_name = "TAG_NAME"
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'pushes branch_name to heroku' do
|
280
|
+
expected_call = 'git push -f git@heroku.com:app.git refs/tags/TAG_NAME:refs/heads/master'
|
281
|
+
system_caller.should_receive(:execute).with(expected_call)
|
282
|
+
deployer.push_repo
|
283
|
+
end
|
259
284
|
end
|
285
|
+
|
286
|
+
context "when no branch_name or tag_name" do
|
287
|
+
it 'pushes master repo to heroku' do
|
288
|
+
expected_call = 'git push -f git@heroku.com:app.git master:refs/heads/master'
|
289
|
+
system_caller.should_receive(:execute).with(expected_call)
|
290
|
+
deployer.push_repo
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
260
294
|
end
|
261
295
|
|
262
296
|
describe "#run_migrations" do
|
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.2.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-
|
12
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|