socialcast-git-extensions 3.0.0.pre2 → 3.0.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +37 -3
- data/bin/{cleanup → git-cleanup} +1 -2
- data/bin/git-integrate +1 -2
- data/bin/git-nuke +1 -2
- data/bin/git-release +1 -2
- data/bin/git-reviewrequest +1 -2
- data/bin/git-share +1 -2
- data/bin/git-start +1 -2
- data/bin/git-track +1 -2
- data/lib/socialcast-git-extensions/cli.rb +5 -4
- data/lib/socialcast-git-extensions/git.rb +1 -1
- data/lib/socialcast-git-extensions/github.rb +7 -4
- data/lib/socialcast-git-extensions/version.rb +1 -1
- data/lib/socialcast-git-extensions.rb +1 -1
- data/spec/cli_spec.rb +18 -35
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,9 +1,43 @@
|
|
1
1
|
= socialcast-git-extensions
|
2
2
|
|
3
|
-
|
3
|
+
= Core Git Extensions
|
4
|
+
|
5
|
+
=== Options
|
6
|
+
* --quiet => supress posting message in Socialcast
|
7
|
+
|
8
|
+
== git start <new_branch_name (optional)>
|
9
|
+
|
10
|
+
update local repository with latest upstream changes and create a new feature branch
|
11
|
+
|
12
|
+
== git update
|
13
|
+
|
14
|
+
update the local feature branch with latest remote changes plus upstream released changes.
|
15
|
+
|
16
|
+
== git integrate <aggregate_branch_name (optional, default: prototype)>
|
17
|
+
|
18
|
+
integrate the current feature branch into an aggregate branch (ex: prototype, staging)
|
19
|
+
|
20
|
+
== git reviewrequest
|
21
|
+
|
22
|
+
create a pull request on github for peer review of the current branch.
|
23
|
+
|
24
|
+
== git release
|
25
|
+
|
26
|
+
release the current feature branch to master
|
27
|
+
|
28
|
+
= Extra Git Extensions
|
29
|
+
|
30
|
+
== git cleanup
|
31
|
+
|
32
|
+
delete released branches after they have been merged into master.
|
33
|
+
|
34
|
+
== git nuke <aggregate_branch_name>
|
35
|
+
|
36
|
+
reset an aggregate branch (ex: prototype, staging) back to a known good state.
|
37
|
+
|
4
38
|
|
5
39
|
== Note on Patches/Pull Requests
|
6
|
-
|
40
|
+
|
7
41
|
* Fork the project.
|
8
42
|
* Make your feature addition or bug fix.
|
9
43
|
* Add tests for it. This is important so I don't break it in a
|
@@ -14,4 +48,4 @@ Description goes here.
|
|
14
48
|
|
15
49
|
== Copyright
|
16
50
|
|
17
|
-
Copyright (c) 2010
|
51
|
+
Copyright (c) 2010 Socialcast, Inc. See LICENSE for details.
|
data/bin/{cleanup → git-cleanup}
RENAMED
data/bin/git-integrate
CHANGED
data/bin/git-nuke
CHANGED
data/bin/git-release
CHANGED
data/bin/git-reviewrequest
CHANGED
data/bin/git-share
CHANGED
data/bin/git-start
CHANGED
data/bin/git-track
CHANGED
@@ -41,7 +41,7 @@ module Socialcast
|
|
41
41
|
post review_message, {:url => url, :message_type => 'review_request'}
|
42
42
|
end
|
43
43
|
|
44
|
-
desc 'update', 'Update the current branch with latest
|
44
|
+
desc 'update', 'Update the current branch with latest changes from the remote feature branch and master'
|
45
45
|
def update
|
46
46
|
branch = current_branch
|
47
47
|
|
@@ -98,7 +98,7 @@ module Socialcast
|
|
98
98
|
post "#worklog starting work on #{branch_name} #scgitx"
|
99
99
|
end
|
100
100
|
|
101
|
-
desc 'share', '
|
101
|
+
desc 'share', 'Share the current branch in the remote repository'
|
102
102
|
def share
|
103
103
|
run_cmd "grb publish #{current_branch}"
|
104
104
|
end
|
@@ -118,8 +118,9 @@ module Socialcast
|
|
118
118
|
desc 'nuke', 'nuke the specified aggregate branch and reset it to a known good state'
|
119
119
|
method_option :destination, :type => :string, :aliases => '-d', :desc => 'destination branch to reset to'
|
120
120
|
def nuke(bad_branch)
|
121
|
-
|
122
|
-
good_branch =
|
121
|
+
default_good_branch = "last_known_good_#{bad_branch}"
|
122
|
+
good_branch = options[:destination] || ask("What branch do you want to reset #{bad_branch} to? (default: #{default_good_branch})")
|
123
|
+
good_branch = default_good_branch if good_branch.length == 0
|
123
124
|
good_branch = "last_known_good_#{good_branch}" unless good_branch.starts_with?('last_known_good_')
|
124
125
|
removed_branches = reset_branch(bad_branch, good_branch)
|
125
126
|
reset_branch("last_known_good_#{bad_branch}", good_branch) unless "last_known_good_#{bad_branch}" == good_branch
|
@@ -53,7 +53,7 @@ module Socialcast
|
|
53
53
|
run_cmd "git pull"
|
54
54
|
removed_branches = branches(:remote => true, :merged => "origin/#{branch}") - branches(:remote => true, :merged => "origin/#{head_branch}")
|
55
55
|
run_cmd "git branch -D #{branch}" rescue nil
|
56
|
-
run_cmd "git push origin
|
56
|
+
run_cmd "git push origin --delete #{branch}" rescue nil
|
57
57
|
run_cmd "git checkout -b #{branch}"
|
58
58
|
run_cmd "grb publish #{branch}"
|
59
59
|
run_cmd "git checkout #{head_branch}"
|
@@ -24,8 +24,7 @@ module Socialcast
|
|
24
24
|
Socialcast.credentials = credentials.merge(:scgitx_token => token)
|
25
25
|
token
|
26
26
|
rescue RestClient::Exception => e
|
27
|
-
|
28
|
-
say "Failed to obtain OAuth authorization token: #{data['message']}"
|
27
|
+
process_error e
|
29
28
|
throw e
|
30
29
|
end
|
31
30
|
|
@@ -42,10 +41,14 @@ module Socialcast
|
|
42
41
|
data = JSON.parse response.body
|
43
42
|
url = data['html_url']
|
44
43
|
rescue RestClient::Exception => e
|
45
|
-
|
46
|
-
say "Failed to create pull request: #{data['message']}"
|
44
|
+
process_error e
|
47
45
|
throw e
|
48
46
|
end
|
47
|
+
|
48
|
+
def process_error(e)
|
49
|
+
data = JSON.parse e.http_body
|
50
|
+
say "Failed to create pull request: #{data['message']}", :red
|
51
|
+
end
|
49
52
|
end
|
50
53
|
end
|
51
54
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -21,8 +21,7 @@ describe Socialcast::Gitx::CLI do
|
|
21
21
|
|
22
22
|
describe '#update' do
|
23
23
|
before do
|
24
|
-
|
25
|
-
@script.invoke :update
|
24
|
+
Socialcast::Gitx::CLI.start ['update']
|
26
25
|
end
|
27
26
|
it 'should run expected commands' do
|
28
27
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -37,8 +36,7 @@ describe Socialcast::Gitx::CLI do
|
|
37
36
|
describe '#integrate' do
|
38
37
|
context 'when target branch is ommitted' do
|
39
38
|
before do
|
40
|
-
|
41
|
-
@script.invoke :integrate
|
39
|
+
Socialcast::Gitx::CLI.start ['integrate']
|
42
40
|
end
|
43
41
|
it 'should default to prototype' do
|
44
42
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -57,8 +55,7 @@ describe Socialcast::Gitx::CLI do
|
|
57
55
|
end
|
58
56
|
context 'when target branch == prototype' do
|
59
57
|
before do
|
60
|
-
|
61
|
-
@script.invoke :integrate, ['prototype']
|
58
|
+
Socialcast::Gitx::CLI.start ['integrate', 'prototype']
|
62
59
|
end
|
63
60
|
it 'should run expected commands' do
|
64
61
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -77,8 +74,7 @@ describe Socialcast::Gitx::CLI do
|
|
77
74
|
end
|
78
75
|
context 'when target branch == staging' do
|
79
76
|
before do
|
80
|
-
|
81
|
-
@script.invoke :integrate, ['staging']
|
77
|
+
Socialcast::Gitx::CLI.start ['integrate', 'staging']
|
82
78
|
end
|
83
79
|
it 'should run expected commands' do
|
84
80
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -102,8 +98,9 @@ describe Socialcast::Gitx::CLI do
|
|
102
98
|
end
|
103
99
|
context 'when target branch != staging || prototype' do
|
104
100
|
it 'should raise an error' do
|
105
|
-
|
106
|
-
|
101
|
+
lambda {
|
102
|
+
Socialcast::Gitx::CLI.start ['integrate', 'asdfasdfasdf']
|
103
|
+
}.should raise_error(/Only aggregate branches are allowed for integration/)
|
107
104
|
end
|
108
105
|
end
|
109
106
|
end
|
@@ -112,8 +109,7 @@ describe Socialcast::Gitx::CLI do
|
|
112
109
|
context 'when user rejects release' do
|
113
110
|
before do
|
114
111
|
Socialcast::Gitx::CLI.any_instance.should_receive(:yes?).and_return(false)
|
115
|
-
|
116
|
-
@script.invoke :release
|
112
|
+
Socialcast::Gitx::CLI.start ['release']
|
117
113
|
end
|
118
114
|
it 'should run no commands' do
|
119
115
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == []
|
@@ -122,8 +118,7 @@ describe Socialcast::Gitx::CLI do
|
|
122
118
|
context 'when user confirms release' do
|
123
119
|
before do
|
124
120
|
Socialcast::Gitx::CLI.any_instance.should_receive(:yes?).and_return(true)
|
125
|
-
|
126
|
-
@script.invoke :release
|
121
|
+
Socialcast::Gitx::CLI.start ['release']
|
127
122
|
end
|
128
123
|
it 'should run expected commands' do
|
129
124
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -161,8 +156,7 @@ describe Socialcast::Gitx::CLI do
|
|
161
156
|
describe '#nuke' do
|
162
157
|
context 'when target branch == prototype and --destination == master' do
|
163
158
|
before do
|
164
|
-
|
165
|
-
@script.invoke :nuke, ['prototype'], {:destination => 'master'}
|
159
|
+
Socialcast::Gitx::CLI.start ['nuke', 'prototype', '--destination', 'master']
|
166
160
|
end
|
167
161
|
it 'should run expected commands' do
|
168
162
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -185,8 +179,7 @@ describe Socialcast::Gitx::CLI do
|
|
185
179
|
end
|
186
180
|
context 'when target branch == staging and --destination == last_known_good_staging' do
|
187
181
|
before do
|
188
|
-
|
189
|
-
@script.invoke :nuke, ['staging'], {:destination => 'last_known_good_staging'}
|
182
|
+
Socialcast::Gitx::CLI.start ['nuke', 'staging', '--destination', 'last_known_good_staging']
|
190
183
|
end
|
191
184
|
it 'should run expected commands' do
|
192
185
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -196,40 +189,31 @@ describe Socialcast::Gitx::CLI do
|
|
196
189
|
"git push origin :staging",
|
197
190
|
"git checkout -b staging",
|
198
191
|
"grb publish staging",
|
199
|
-
"git checkout last_known_good_staging"
|
192
|
+
"git checkout last_known_good_staging"
|
200
193
|
]
|
201
194
|
end
|
202
195
|
end
|
203
196
|
context 'when target branch == prototype and destination prompt == nil' do
|
204
197
|
before do
|
205
198
|
Socialcast::Gitx::CLI.any_instance.should_receive(:ask).and_return('')
|
206
|
-
|
207
|
-
@script.invoke :nuke, ['prototype']
|
199
|
+
Socialcast::Gitx::CLI.start ['nuke', 'prototype']
|
208
200
|
end
|
209
|
-
it 'defaults to
|
201
|
+
it 'defaults to last_known_good_prototype and should run expected commands' do
|
210
202
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
211
|
-
"git checkout
|
203
|
+
"git checkout last_known_good_prototype",
|
212
204
|
"git pull",
|
213
205
|
"git branch -D prototype",
|
214
206
|
"git push origin :prototype",
|
215
207
|
"git checkout -b prototype",
|
216
208
|
"grb publish prototype",
|
217
|
-
"git checkout
|
218
|
-
"git checkout last_known_good_master",
|
219
|
-
"git pull",
|
220
|
-
"git branch -D last_known_good_prototype",
|
221
|
-
"git push origin :last_known_good_prototype",
|
222
|
-
"git checkout -b last_known_good_prototype",
|
223
|
-
"grb publish last_known_good_prototype",
|
224
|
-
"git checkout last_known_good_master"
|
209
|
+
"git checkout last_known_good_prototype"
|
225
210
|
]
|
226
211
|
end
|
227
212
|
end
|
228
213
|
context 'when target branch == prototype and destination prompt = master' do
|
229
214
|
before do
|
230
215
|
Socialcast::Gitx::CLI.any_instance.should_receive(:ask).and_return('master')
|
231
|
-
|
232
|
-
@script.invoke :nuke, ['prototype']
|
216
|
+
Socialcast::Gitx::CLI.start ['nuke', 'prototype']
|
233
217
|
end
|
234
218
|
it 'should run expected commands' do
|
235
219
|
Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
|
@@ -254,8 +238,7 @@ describe Socialcast::Gitx::CLI do
|
|
254
238
|
it 'should raise error' do
|
255
239
|
lambda {
|
256
240
|
Socialcast::Gitx::CLI.any_instance.should_receive(:ask).and_return('master')
|
257
|
-
|
258
|
-
@script.invoke :nuke, ['asdfasdf']
|
241
|
+
Socialcast::Gitx::CLI.start ['nuke', 'asdfasdf']
|
259
242
|
}.should raise_error /Only aggregate branches are allowed to be reset/
|
260
243
|
end
|
261
244
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialcast-git-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.pre4
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -175,7 +175,7 @@ description: GIT it done!
|
|
175
175
|
email:
|
176
176
|
- ryan@socialcast.com
|
177
177
|
executables:
|
178
|
-
- cleanup
|
178
|
+
- git-cleanup
|
179
179
|
- git-integrate
|
180
180
|
- git-nuke
|
181
181
|
- git-release
|
@@ -195,7 +195,7 @@ files:
|
|
195
195
|
- LICENSE
|
196
196
|
- README.rdoc
|
197
197
|
- Rakefile
|
198
|
-
- bin/cleanup
|
198
|
+
- bin/git-cleanup
|
199
199
|
- bin/git-integrate
|
200
200
|
- bin/git-nuke
|
201
201
|
- bin/git-release
|
@@ -228,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
segments:
|
230
230
|
- 0
|
231
|
-
hash:
|
231
|
+
hash: 3452558432038293622
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
none: false
|
234
234
|
requirements:
|