paratrooper 2.1.0 → 2.2.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: 410362d7ac00deb0a6d77c47b68d147b68fb8865
4
- data.tar.gz: 0058698a8877213f584926400c349ab063782696
3
+ metadata.gz: 344399129c3b5b86e4aebdd632e78cdb0715e728
4
+ data.tar.gz: f2b83ab2a53760295ff5f6f77c2c4532c8b80465
5
5
  SHA512:
6
- metadata.gz: eada1e483d9c5d98e2261cf9fd5bdcb7be476add7c95259758f353931f8342d9d4ecaf944d12592c68eb148133cb9c3a797057574829631e7d3c0a675d876de6
7
- data.tar.gz: d8278b08c8037ab5aaa5adbd4924e697dd72b02d81c477cdb4864b7c5768d375acafe29ce8c217b998dee20bdb38aa9b3fb1c57a205ffd1635cfa724e5b27928
6
+ metadata.gz: dfd31278c9052ff607afef102fa6ca1d1c6b3bd9929e168b0def36c0d0fd9489e2568c0cfbfcfe64018a7612cd5b66763f7a44903415bb4549c4a9cdff6a3db1
7
+ data.tar.gz: bfb1b6053309c7ddeceba8c26ab779d9886d7d135955d1b91788c5447598c9066eb287d54785506bf0be9f6f157eadbd534b384709c3beaeed0c8eb17982b7aa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+
5
+ - Allow deploy from specific branch.
6
+
3
7
  ## 2.1.0
4
8
 
5
9
  - Run remote tasks on your application
@@ -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 (optional).
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 = tag_name || 'master'
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
@@ -1,3 +1,3 @@
1
1
  module Paratrooper
2
- VERSION = "2.1.0".freeze
2
+ VERSION = "2.2.0".freeze
3
3
  end
@@ -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
- it 'pushes repo to heroku' do
256
- expected_call = 'git push -f git@heroku.com:app.git master:refs/heads/master'
257
- system_caller.should_receive(:execute).with(expected_call)
258
- deployer.push_repo
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.1.0
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-02-28 00:00:00.000000000 Z
12
+ date: 2014-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake