socialcast-git-extensions 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTMxY2JlODhkMDhlYTE4YzkzMDg5MTExYzRiMGI2MzRmOWJjMzM3MA==
4
+ MzZjNmVjNmM0YTQ5ZGVkYTAxY2U2ZTdiZDkyMWM0ZGEyYTRlZTI5YQ==
5
5
  data.tar.gz: !binary |-
6
- YTk4YTgyNDc4ZGRlMzU2NWJhMWEzNzYxYmNhN2Y3ZDcyMDgxNGQzMQ==
6
+ MjNiYjI4NmViN2NlM2Y1Y2M1NjQzZDBlMjhiM2FlZGUwODUxMDM0OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzVkOTkxMmRjOTY1Yzg3ZjlhMTAzMWMwZTBmMzUxYzY3MmFmN2ExZmVmZTk2
10
- MGQ1MGMzZTFhMzFhMDdlYTNhYTNlMDVmYTJlOTM3NzcxOTMwZjljNDgwODA0
11
- ZDAwM2ZiOGEyNmFiMGQyNWQ2NjNhYzE1OGM4Y2ViYjYwMmJlNzc=
9
+ MWQwODRiOTQxOGMwZTkwYmU3NGI2NGQ5YjgzZGM5NDAzZTRhODc2YzZhYmU4
10
+ OWI3Nzc1MmEyNmRiMWViMTUwYzliNjVmYzU0ODUzMzc2MTQ0OWFhMDJlMGM3
11
+ ZjA5OTBkZGI2NjkxNzE1MTc0NTMwMzdlMTI3NDJkZjA5M2M1NWE=
12
12
  data.tar.gz: !binary |-
13
- YjQxZTRmMTE5MTEzMzk1ZDBmY2I1OGI1ZjJiM2YwMjdkMWQ2YzA0NjE5YTQ5
14
- MGEzMGZjYjA2MWVlODdmZGY3OTAxMWNkYTRjZDRlOTI1MDlhMDc0NjEwZTJm
15
- YmE3MjliMTNjMWE3YTcwN2EyZTYzNjU2ZWUyYmIyNTEyNGQwYzA=
13
+ YTMzY2E5ZTc0ODk3M2MwMTQxNmJiOTAzZDg5OWIxYTNjMWZmMGFkOTgzNTQ0
14
+ NDBjMDdhMTU3OWNkYTI4YjgxYTlkODA2YWNlYWEyYjMwNzdjYTRjMTJhNjhk
15
+ MzhiNDA0ZjhlOGVmYzYzZjc3MmRjYzQ4OTI4ZGI3OGMwOTlkOTk=
@@ -174,7 +174,7 @@ module Socialcast
174
174
  end
175
175
 
176
176
  def base_branch
177
- config['base_branch'] || Socialcast::Gitx::DEFAULT_BASE_BRANCH
177
+ ENV['BASE_BRANCH'] || config['base_branch'] || Socialcast::Gitx::DEFAULT_BASE_BRANCH
178
178
  end
179
179
 
180
180
  def staging_branch
@@ -190,7 +190,7 @@ module Socialcast
190
190
  end
191
191
 
192
192
  def reserved_branches
193
- @reserved_branches ||= %w{ HEAD master next_release } + [base_branch] + aggregate_branches
193
+ @reserved_branches ||= %w{ HEAD master next_release } + [base_branch, config['base_branch']].compact.uniq + aggregate_branches
194
194
  end
195
195
  end
196
196
  end
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "3.1.8"
3
+ VERSION = "3.1.9"
4
4
  end
5
5
  end
data/spec/cli_spec.rb CHANGED
@@ -175,14 +175,92 @@ describe Socialcast::Gitx::CLI do
175
175
  end
176
176
  end
177
177
 
178
- context 'with alternative base branch' do
178
+ context 'with alternative base branch via config file' do
179
179
  before do
180
180
  Socialcast::Gitx::CLI.any_instance.should_receive(:post).with("#worklog releasing FOO to special-master #scgitx")
181
181
  Socialcast::Gitx::CLI.any_instance.should_receive(:yes?).and_return(true)
182
- Socialcast::Gitx::CLI.any_instance.stub(:base_branch).and_return('special-master')
182
+ Socialcast::Gitx::CLI.any_instance.stub(:config).and_return( { 'base_branch' => 'special-master' })
183
183
  Socialcast::Gitx::CLI.start ['release']
184
184
  end
185
185
  it 'should post message to socialcast' do end # see expectations
186
+ it "treats the alternative base branch as reserved" do
187
+ Socialcast::Gitx::CLI.new.send(:reserved_branches).should include 'special-master'
188
+ end
189
+ it 'should run expected commands' do
190
+ Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
191
+ "git pull origin FOO",
192
+ "git pull origin special-master",
193
+ "git push origin HEAD",
194
+ "git checkout special-master",
195
+ "git pull origin special-master",
196
+ "git pull . FOO",
197
+ "git push origin HEAD",
198
+ "git branch -D staging",
199
+ "git fetch origin",
200
+ "git checkout staging",
201
+ "git pull . special-master",
202
+ "git push origin HEAD",
203
+ "git checkout special-master",
204
+ "git checkout special-master",
205
+ "git pull",
206
+ "git remote prune origin"
207
+ ]
208
+ end
209
+ end
210
+
211
+ context 'with alternative base branch via environment variable' do
212
+ before do
213
+ Socialcast::Gitx::CLI.any_instance.should_receive(:post).with("#worklog releasing FOO to special-master #scgitx")
214
+ Socialcast::Gitx::CLI.any_instance.should_receive(:yes?).and_return(true)
215
+ Socialcast::Gitx::CLI.any_instance.stub(:config).and_return({})
216
+ ENV['BASE_BRANCH'] = 'special-master'
217
+ Socialcast::Gitx::CLI.start ['release']
218
+ end
219
+ after do
220
+ ENV.delete('BASE_BRANCH')
221
+ end
222
+ it "treats the alternative base branch as reserved" do
223
+ Socialcast::Gitx::CLI.new.send(:reserved_branches).should include 'special-master'
224
+ end
225
+ it 'should post message to socialcast' do end # see expectations
226
+ it 'should run expected commands' do
227
+ Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
228
+ "git pull origin FOO",
229
+ "git pull origin special-master",
230
+ "git push origin HEAD",
231
+ "git checkout special-master",
232
+ "git pull origin special-master",
233
+ "git pull . FOO",
234
+ "git push origin HEAD",
235
+ "git branch -D staging",
236
+ "git fetch origin",
237
+ "git checkout staging",
238
+ "git pull . special-master",
239
+ "git push origin HEAD",
240
+ "git checkout special-master",
241
+ "git checkout special-master",
242
+ "git pull",
243
+ "git remote prune origin"
244
+ ]
245
+ end
246
+ end
247
+
248
+ context 'with alternative base branch via environment variable overriding base branch in config' do
249
+ before do
250
+ Socialcast::Gitx::CLI.any_instance.should_receive(:post).with("#worklog releasing FOO to special-master #scgitx")
251
+ Socialcast::Gitx::CLI.any_instance.should_receive(:yes?).and_return(true)
252
+ Socialcast::Gitx::CLI.any_instance.stub(:config).and_return({ 'base_branch' => 'extra-special-master' })
253
+ ENV['BASE_BRANCH'] = 'special-master'
254
+ Socialcast::Gitx::CLI.start ['release']
255
+ end
256
+ after do
257
+ ENV.delete('BASE_BRANCH')
258
+ end
259
+ it "treats the alternative base branch as reserved" do
260
+ Socialcast::Gitx::CLI.new.send(:reserved_branches).should include 'special-master'
261
+ Socialcast::Gitx::CLI.new.send(:reserved_branches).should include 'extra-special-master'
262
+ end
263
+ it 'should post message to socialcast' do end # see expectations
186
264
  it 'should run expected commands' do
187
265
  Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
188
266
  "git pull origin FOO",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.8
4
+ version: 3.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grit