socialcast-git-extensions 3.1.30 → 3.1.31
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/lib/socialcast-git-extensions.rb +1 -0
- data/lib/socialcast-git-extensions/git.rb +1 -1
- data/lib/socialcast-git-extensions/version.rb +1 -1
- data/socialcast-git-extensions.gemspec +1 -1
- data/spec/cli_spec.rb +31 -36
- data/spec/spec_helper.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e2a34c6c10c6b97d6535baa8b29e999d0dca40cd
|
|
4
|
+
data.tar.gz: 490cc52f1cd874d264ef7766e92cba28073f4a15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1312bc274de4e14fe7e36963779ec40689e5bcbff75027e9fc9c82892f106b03a0c846d0282816cf01346e6495c2d0cce2abb579eedcb6623e8c5425d2d9b162
|
|
7
|
+
data.tar.gz: f2ee71b4967ff4f311a16c70afa31110b9e5bb4e1ff383b0b3553a5cf745eacbf98cc9697eea9e8a251e6f3f42a04d499584fc67ed72cde87e2e404cdd594229
|
|
@@ -15,6 +15,7 @@ module Socialcast
|
|
|
15
15
|
|
|
16
16
|
# execute a shell command and raise an error if non-zero exit code is returned
|
|
17
17
|
def run_cmd(cmd)
|
|
18
|
+
raise "Unstubbed git command #{cmd}" if ENV['SCGITX_TEST'] == 'true'
|
|
18
19
|
say "\n$ "
|
|
19
20
|
say cmd.gsub("'", ''), :red
|
|
20
21
|
raise "#{cmd} failed" unless system cmd
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.add_runtime_dependency 'rest-client', '~> 1.7'
|
|
21
21
|
s.add_runtime_dependency 'thor', '~> 0.19.1'
|
|
22
22
|
s.add_runtime_dependency 'rake', '~> 10.3'
|
|
23
|
-
s.add_development_dependency 'rspec', '~> 3.0
|
|
23
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
|
24
24
|
s.add_development_dependency 'pry', '~> 0.9.12.6'
|
|
25
25
|
s.add_development_dependency 'webmock', '~> 1.21'
|
|
26
26
|
|
data/spec/cli_spec.rb
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Socialcast::Gitx::CLI do
|
|
4
|
-
|
|
5
|
-
class Socialcast::Gitx::CLI
|
|
6
|
-
class << self
|
|
7
|
-
attr_accessor :stubbed_executed_commands
|
|
8
|
-
end
|
|
9
|
-
private
|
|
10
|
-
# stub out command execution and record commands for test inspection
|
|
11
|
-
def run_cmd(cmd)
|
|
12
|
-
self.class.stubbed_executed_commands << cmd
|
|
13
|
-
end
|
|
14
|
-
end
|
|
4
|
+
let(:stubbed_executed_commands) { [] }
|
|
15
5
|
|
|
16
6
|
def stub_message(message_body, params = {})
|
|
17
7
|
expect(Socialcast::CommandLine::Message).to receive(:create).with(params.merge(:body => message_body)).and_return(double(:permalink_url => 'https://community.socialcast.com/messages/1234'))
|
|
@@ -21,8 +11,13 @@ describe Socialcast::Gitx::CLI do
|
|
|
21
11
|
Socialcast::Gitx::CLI.instance_eval do # to supress warning from stubbing ldap_config
|
|
22
12
|
@no_tasks = @no_commands = true
|
|
23
13
|
end
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:run_cmd) do |_instance, cmd|
|
|
15
|
+
stubbed_executed_commands << cmd
|
|
16
|
+
end
|
|
17
|
+
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:'`') do |_instance, cmd|
|
|
18
|
+
raise "Unstubbed backticks detected"
|
|
19
|
+
end
|
|
20
|
+
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:current_repo).and_return('socialcast/socialcast-git-extensions')
|
|
26
21
|
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:say)
|
|
27
22
|
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:current_branch).and_return('FOO')
|
|
28
23
|
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:current_user).and_return('wireframe')
|
|
@@ -36,7 +31,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
36
31
|
end
|
|
37
32
|
it 'should not post message to socialcast' do end # see expectations
|
|
38
33
|
it 'should run expected commands' do
|
|
39
|
-
expect(
|
|
34
|
+
expect(stubbed_executed_commands).to eq([
|
|
40
35
|
'git pull origin FOO',
|
|
41
36
|
'git pull origin master',
|
|
42
37
|
'git push origin HEAD'
|
|
@@ -53,7 +48,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
53
48
|
end
|
|
54
49
|
it 'should post message to socialcast' do end # see expectations
|
|
55
50
|
it 'should default to prototype' do
|
|
56
|
-
expect(
|
|
51
|
+
expect(stubbed_executed_commands).to eq([
|
|
57
52
|
"git pull origin FOO",
|
|
58
53
|
"git pull origin master",
|
|
59
54
|
"git push origin HEAD",
|
|
@@ -77,7 +72,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
77
72
|
end
|
|
78
73
|
it 'should post message to socialcast' do end # see expectations
|
|
79
74
|
it 'should default to prototype' do
|
|
80
|
-
expect(
|
|
75
|
+
expect(stubbed_executed_commands).to eq([
|
|
81
76
|
"git pull origin FOO",
|
|
82
77
|
"git pull origin master",
|
|
83
78
|
"git push origin HEAD",
|
|
@@ -99,7 +94,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
99
94
|
end
|
|
100
95
|
it 'should post message to socialcast' do end # see expectations
|
|
101
96
|
it 'should run expected commands' do
|
|
102
|
-
expect(
|
|
97
|
+
expect(stubbed_executed_commands).to eq([
|
|
103
98
|
"git pull origin FOO",
|
|
104
99
|
"git pull origin master",
|
|
105
100
|
"git push origin HEAD",
|
|
@@ -121,7 +116,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
121
116
|
end
|
|
122
117
|
it 'should post message to socialcast' do end # see expectations
|
|
123
118
|
it 'should also integrate into prototype and run expected commands' do
|
|
124
|
-
expect(
|
|
119
|
+
expect(stubbed_executed_commands).to eq([
|
|
125
120
|
"git pull origin FOO",
|
|
126
121
|
"git pull origin master",
|
|
127
122
|
"git push origin HEAD",
|
|
@@ -163,7 +158,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
163
158
|
Socialcast::Gitx::CLI.start ['release']
|
|
164
159
|
end
|
|
165
160
|
it 'does not try and release the branch' do
|
|
166
|
-
expect(
|
|
161
|
+
expect(stubbed_executed_commands).to eq(["git branch -D last_known_good_staging", "git fetch origin", "git checkout last_known_good_staging", "git checkout FOO"])
|
|
167
162
|
end
|
|
168
163
|
end
|
|
169
164
|
context 'when user confirms release' do
|
|
@@ -176,7 +171,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
176
171
|
end
|
|
177
172
|
it 'should post message to socialcast' do end # see expectations
|
|
178
173
|
it 'should run expected commands' do
|
|
179
|
-
expect(
|
|
174
|
+
expect(stubbed_executed_commands).to eq([
|
|
180
175
|
"git branch -D last_known_good_staging",
|
|
181
176
|
"git fetch origin",
|
|
182
177
|
"git checkout last_known_good_staging",
|
|
@@ -219,7 +214,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
219
214
|
Socialcast::Gitx::CLI.start ['release']
|
|
220
215
|
end
|
|
221
216
|
it 'should run expected commands' do
|
|
222
|
-
expect(
|
|
217
|
+
expect(stubbed_executed_commands).to eq([
|
|
223
218
|
"git pull origin FOO",
|
|
224
219
|
"git pull origin master",
|
|
225
220
|
"git push origin HEAD",
|
|
@@ -266,7 +261,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
266
261
|
expect(Socialcast::Gitx::CLI.new.send(:reserved_branches)).to include 'special-master'
|
|
267
262
|
end
|
|
268
263
|
it 'should run expected commands' do
|
|
269
|
-
expect(
|
|
264
|
+
expect(stubbed_executed_commands).to eq([
|
|
270
265
|
"git branch -D last_known_good_staging",
|
|
271
266
|
"git fetch origin",
|
|
272
267
|
"git checkout last_known_good_staging",
|
|
@@ -306,7 +301,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
306
301
|
end
|
|
307
302
|
it 'should post message to socialcast' do end # see expectations
|
|
308
303
|
it 'should run expected commands' do
|
|
309
|
-
expect(
|
|
304
|
+
expect(stubbed_executed_commands).to eq([
|
|
310
305
|
"git branch -D last_known_good_staging",
|
|
311
306
|
"git fetch origin",
|
|
312
307
|
"git checkout last_known_good_staging",
|
|
@@ -347,7 +342,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
347
342
|
end
|
|
348
343
|
it 'should post message to socialcast' do end # see expectations
|
|
349
344
|
it 'should run expected commands' do
|
|
350
|
-
expect(
|
|
345
|
+
expect(stubbed_executed_commands).to eq([
|
|
351
346
|
"git branch -D last_known_good_staging",
|
|
352
347
|
"git fetch origin",
|
|
353
348
|
"git checkout last_known_good_staging",
|
|
@@ -371,14 +366,14 @@ describe Socialcast::Gitx::CLI do
|
|
|
371
366
|
end
|
|
372
367
|
|
|
373
368
|
describe '#nuke' do
|
|
369
|
+
before { allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:branches).and_return([]) }
|
|
374
370
|
context 'when target branch == staging and --destination == last_known_good_staging' do
|
|
375
371
|
before do
|
|
376
372
|
stub_message "#worklog resetting staging branch to last_known_good_staging in socialcast/socialcast-git-extensions #scgitx\n/cc @SocialcastDevelopers"
|
|
377
|
-
|
|
378
373
|
Socialcast::Gitx::CLI.start ['nuke', 'staging', '--destination', 'last_known_good_staging']
|
|
379
374
|
end
|
|
380
375
|
it 'should run expected commands' do
|
|
381
|
-
expect(
|
|
376
|
+
expect(stubbed_executed_commands).to eq([
|
|
382
377
|
"git checkout master",
|
|
383
378
|
"git branch -D last_known_good_staging",
|
|
384
379
|
"git fetch origin",
|
|
@@ -387,7 +382,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
387
382
|
"git push origin --delete staging",
|
|
388
383
|
"git checkout -b staging",
|
|
389
384
|
"git push origin staging",
|
|
390
|
-
"git branch
|
|
385
|
+
"git branch --track origin/staging",
|
|
391
386
|
"git checkout master"
|
|
392
387
|
])
|
|
393
388
|
end
|
|
@@ -400,7 +395,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
400
395
|
Socialcast::Gitx::CLI.start ['nuke', 'qa']
|
|
401
396
|
end
|
|
402
397
|
it 'defaults to last_known_good_qa and should run expected commands' do
|
|
403
|
-
expect(
|
|
398
|
+
expect(stubbed_executed_commands).to eq([
|
|
404
399
|
"git checkout master",
|
|
405
400
|
"git branch -D last_known_good_qa",
|
|
406
401
|
"git fetch origin",
|
|
@@ -409,7 +404,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
409
404
|
"git push origin --delete qa",
|
|
410
405
|
"git checkout -b qa",
|
|
411
406
|
"git push origin qa",
|
|
412
|
-
"git branch
|
|
407
|
+
"git branch --track origin/qa",
|
|
413
408
|
"git checkout master"
|
|
414
409
|
])
|
|
415
410
|
end
|
|
@@ -422,7 +417,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
422
417
|
Socialcast::Gitx::CLI.start ['nuke', 'qa']
|
|
423
418
|
end
|
|
424
419
|
it 'should run expected commands' do
|
|
425
|
-
expect(
|
|
420
|
+
expect(stubbed_executed_commands).to eq([
|
|
426
421
|
"git checkout master",
|
|
427
422
|
"git branch -D last_known_good_master",
|
|
428
423
|
"git fetch origin",
|
|
@@ -431,7 +426,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
431
426
|
"git push origin --delete qa",
|
|
432
427
|
"git checkout -b qa",
|
|
433
428
|
"git push origin qa",
|
|
434
|
-
"git branch
|
|
429
|
+
"git branch --track origin/qa",
|
|
435
430
|
"git checkout master",
|
|
436
431
|
"git checkout master",
|
|
437
432
|
"git branch -D last_known_good_master",
|
|
@@ -441,7 +436,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
441
436
|
"git push origin --delete last_known_good_qa",
|
|
442
437
|
"git checkout -b last_known_good_qa",
|
|
443
438
|
"git push origin last_known_good_qa",
|
|
444
|
-
"git branch
|
|
439
|
+
"git branch --track origin/last_known_good_qa",
|
|
445
440
|
"git checkout master"
|
|
446
441
|
])
|
|
447
442
|
end
|
|
@@ -931,7 +926,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
931
926
|
it 'should create github pull request' do end # see expectations
|
|
932
927
|
it 'should post socialcast message' do end # see expectations
|
|
933
928
|
it 'should run expected commands' do
|
|
934
|
-
expect(
|
|
929
|
+
expect(stubbed_executed_commands).to eq([
|
|
935
930
|
"git pull origin FOO",
|
|
936
931
|
"git pull origin master",
|
|
937
932
|
"git push origin HEAD"
|
|
@@ -957,7 +952,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
957
952
|
it 'should create github pull request' do end # see expectations
|
|
958
953
|
it 'should post socialcast message' do end # see expectations
|
|
959
954
|
it 'should run expected commands' do
|
|
960
|
-
expect(
|
|
955
|
+
expect(stubbed_executed_commands).to eq([
|
|
961
956
|
"git pull origin FOO",
|
|
962
957
|
"git pull origin master",
|
|
963
958
|
"git push origin HEAD"
|
|
@@ -993,7 +988,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
993
988
|
Socialcast::Gitx::CLI.start ['promote']
|
|
994
989
|
end
|
|
995
990
|
it 'should integrate into staging' do
|
|
996
|
-
expect(
|
|
991
|
+
expect(stubbed_executed_commands).to eq([
|
|
997
992
|
"git pull origin FOO",
|
|
998
993
|
"git pull origin master",
|
|
999
994
|
"git push origin HEAD",
|
|
@@ -1021,7 +1016,7 @@ describe Socialcast::Gitx::CLI do
|
|
|
1021
1016
|
Socialcast::Gitx::CLI.start ['cleanup']
|
|
1022
1017
|
end
|
|
1023
1018
|
it 'should only cleanup non-reserved branches' do
|
|
1024
|
-
expect(
|
|
1019
|
+
expect(stubbed_executed_commands).to eq([
|
|
1025
1020
|
"git checkout master",
|
|
1026
1021
|
"git pull",
|
|
1027
1022
|
"git remote prune origin",
|
data/spec/spec_helper.rb
CHANGED
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.
|
|
4
|
+
version: 3.1.31
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Sonnek
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-06-
|
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: grit
|
|
@@ -100,14 +100,14 @@ dependencies:
|
|
|
100
100
|
requirements:
|
|
101
101
|
- - "~>"
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 3.0
|
|
103
|
+
version: '3.0'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 3.0
|
|
110
|
+
version: '3.0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: pry
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
208
|
version: '0'
|
|
209
209
|
requirements: []
|
|
210
210
|
rubyforge_project: socialcast-git-extensions
|
|
211
|
-
rubygems_version: 2.4.
|
|
211
|
+
rubygems_version: 2.4.8
|
|
212
212
|
signing_key:
|
|
213
213
|
specification_version: 4
|
|
214
214
|
summary: git extension scripts for socialcast workflow
|