gitcycle 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +95 -6
- data/features/gitcycle.feature +17 -17
- data/features/steps/gitcycle_steps.rb +2 -2
- data/gitcycle.gemspec +1 -1
- data/lib/gitcycle.rb +109 -34
- metadata +4 -4
data/README.md
CHANGED
@@ -3,14 +3,103 @@ Gitcycle
|
|
3
3
|
|
4
4
|
Tame your development cycle.
|
5
5
|
|
6
|
-
|
6
|
+
Get Started
|
7
|
+
-----------
|
8
|
+
|
9
|
+
Visit [gitcycle.com](http://gitcycle.com) to set up your environment.
|
10
|
+
|
11
|
+
Create Branch
|
12
|
+
-------------
|
13
|
+
|
14
|
+
Checkout the branch that you will eventually merge your feature into:
|
15
|
+
|
16
|
+
git checkout master
|
17
|
+
|
18
|
+
Type `gitc` + your ticket URL to create a new branch:
|
19
|
+
|
20
|
+
gitc https://xxx.lighthouseapp.com/projects/0000/tickets/0000-my-ticket
|
21
|
+
|
22
|
+
Pull Changes from Upstream
|
23
|
+
--------------------------
|
24
|
+
|
25
|
+
When you're developing, you may need to pull new changes from the upstream branch that you will eventually merge your feature into:
|
26
|
+
|
27
|
+
gitc pull
|
28
|
+
|
29
|
+
Discuss Code
|
7
30
|
------------
|
8
31
|
|
9
|
-
|
10
|
-
gem install gitcycle
|
11
|
-
</pre>
|
32
|
+
After pushing one or two commits, put the code up for discussion:
|
12
33
|
|
13
|
-
|
34
|
+
gitc discuss
|
35
|
+
|
36
|
+
Mark as Ready
|
37
|
+
-------------
|
38
|
+
|
39
|
+
When the branch is ready for merging, mark it as ready:
|
40
|
+
|
41
|
+
gitc ready
|
42
|
+
|
43
|
+
This will mark the pull request as "Pending Review".
|
44
|
+
|
45
|
+
Code Review
|
14
46
|
-----------
|
15
47
|
|
16
|
-
|
48
|
+
Managers will periodically check for "Pending Review" issues on GitHub.
|
49
|
+
|
50
|
+
Once reviewed, they will mark the issue as reviewed:
|
51
|
+
|
52
|
+
gitc reviewed 0000
|
53
|
+
|
54
|
+
Where 0000 is the Github issue number.
|
55
|
+
|
56
|
+
Quality Assurance
|
57
|
+
-----------------
|
58
|
+
|
59
|
+
QA engineers will periodically check for "Pending QA" issues on Github.
|
60
|
+
|
61
|
+
To create a new QA branch:
|
62
|
+
|
63
|
+
gitc qa 0000 0001
|
64
|
+
|
65
|
+
This will create a new QA branch containing the commits from the related Github issue numbers.
|
66
|
+
|
67
|
+
This branch can be deployed to a staging environment for QA.
|
68
|
+
|
69
|
+
QA Fail
|
70
|
+
-------
|
71
|
+
|
72
|
+
If a feature does not pass QA:
|
73
|
+
|
74
|
+
gitc qa fail 0000
|
75
|
+
|
76
|
+
Where 0000 is the Github issue number.
|
77
|
+
|
78
|
+
To fail all issues:
|
79
|
+
|
80
|
+
gitc qa fail
|
81
|
+
|
82
|
+
This will add a "fail" label to the issue.
|
83
|
+
|
84
|
+
QA Pass
|
85
|
+
-------
|
86
|
+
|
87
|
+
If a feature passes QA:
|
88
|
+
|
89
|
+
gitc qa pass 0000
|
90
|
+
|
91
|
+
Where 0000 is the Github issue number.
|
92
|
+
|
93
|
+
To pass all issues:
|
94
|
+
|
95
|
+
gitc qa pass
|
96
|
+
|
97
|
+
This will add a "pass" label to the issue and will complete the pull request by merging the feature branch into the target branch.
|
98
|
+
|
99
|
+
Todo
|
100
|
+
----
|
101
|
+
|
102
|
+
* Label issues with ticket milestone?
|
103
|
+
* Add confirmation when creating new dev branch for branch that it is based off of
|
104
|
+
* If confirmation is a no, allow user to specify branch to base off of
|
105
|
+
* bug with branch rename on Jimmy's machine
|
data/features/gitcycle.feature
CHANGED
@@ -154,20 +154,20 @@ Scenario: Reviewed issue w/ parameters
|
|
154
154
|
Then gitcycle runs
|
155
155
|
And output includes "Labeling issues as 'Pending QA'."
|
156
156
|
|
157
|
-
Scenario: QA issue
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
157
|
+
# Scenario: QA issue
|
158
|
+
# When I cd to the owner repo
|
159
|
+
# And I checkout master
|
160
|
+
# And I execute gitcycle with "qa issue.id"
|
161
|
+
# Then gitcycle runs
|
162
|
+
# And output includes
|
163
|
+
# """
|
164
|
+
# Retrieving branch information from gitcycle.
|
165
|
+
# Deleting old QA branch 'qa_master'.
|
166
|
+
# Creating QA branch 'qa_master'.
|
167
|
+
# Adding remote repo 'br/gitcycle_test'.
|
168
|
+
# Fetching remote branch '200-test-ticket'.
|
169
|
+
# Merging remote branch '200-test-ticket' from 'br/gitcycle_test'.
|
170
|
+
# Pushing QA branch 'qa_master'.
|
171
|
+
# Type 'gitc qa pass' to approve all issues in this branch.
|
172
|
+
# Type 'gitc qa fail' to reject all issues in this branch.
|
173
|
+
# """
|
@@ -202,7 +202,7 @@ end
|
|
202
202
|
|
203
203
|
Then /^output does not include \"([^\"]*)"$/ do |expected|
|
204
204
|
expected = gsub_variables(expected)
|
205
|
-
@output.include?(expected).should == false
|
205
|
+
@output.gsub(/\n+/, "\n").include?(expected).should == false
|
206
206
|
end
|
207
207
|
|
208
208
|
Then /^redis entries valid$/ do
|
@@ -221,7 +221,7 @@ Then /^redis entries valid$/ do
|
|
221
221
|
should = {
|
222
222
|
'lighthouse_url' => $ticket.url,
|
223
223
|
'body' => "<div><p>test</p></div>\n\n#{$ticket.url}",
|
224
|
-
'home' => '
|
224
|
+
'home' => ENV['REPO'] == 'owner' ? config['owner'] : config['user'],
|
225
225
|
'name' => $ticket.attributes['id'] + add,
|
226
226
|
'id' => $ticket.attributes['id'] + add,
|
227
227
|
'title' => $ticket.title,
|
data/gitcycle.gemspec
CHANGED
data/lib/gitcycle.rb
CHANGED
@@ -61,6 +61,14 @@ class Gitcycle
|
|
61
61
|
branch['home'] = @git_login
|
62
62
|
branch['source'] = branches(:current => true)
|
63
63
|
|
64
|
+
unless yes?("Would you like to eventually merge this feature into #{branch['source']}?")
|
65
|
+
branch['source'] = q("What branch would you like to eventually merge this feature into?")
|
66
|
+
end
|
67
|
+
|
68
|
+
unless branches(:match => branch['source'])
|
69
|
+
|
70
|
+
end
|
71
|
+
|
64
72
|
unless yes?("Would you like to name your branch '#{name}'?")
|
65
73
|
name = q("\nWhat would you like to name your branch?")
|
66
74
|
name = name.gsub(/[\s\W]/, '-')
|
@@ -99,22 +107,8 @@ class Gitcycle
|
|
99
107
|
def discuss(*issues)
|
100
108
|
require_git && require_config
|
101
109
|
|
102
|
-
puts "\nRetrieving branch information from gitcycle.\n".green
|
103
|
-
|
104
110
|
if issues.empty?
|
105
|
-
branch =
|
106
|
-
'branch[name]' => branches(:current => true),
|
107
|
-
'create' => 0
|
108
|
-
)
|
109
|
-
|
110
|
-
if branch && !branch['issue_url']
|
111
|
-
puts "Creating GitHub pull request.\n".green
|
112
|
-
branch = get('branch',
|
113
|
-
'branch[create_pull_request]' => true,
|
114
|
-
'branch[name]' => branch['name'],
|
115
|
-
'create' => 0
|
116
|
-
)
|
117
|
-
end
|
111
|
+
branch = create_pull_request
|
118
112
|
|
119
113
|
if branch == false
|
120
114
|
puts "Branch not found.\n".red
|
@@ -125,6 +119,8 @@ class Gitcycle
|
|
125
119
|
puts "You must push code before opening a pull request.\n".red
|
126
120
|
end
|
127
121
|
else
|
122
|
+
puts "\nRetrieving branch information from gitcycle.\n".green
|
123
|
+
|
128
124
|
get('branch', 'issues' => issues, 'scope' => 'repo').each do |branch|
|
129
125
|
if branch['issue_url']
|
130
126
|
puts "Opening issue: #{branch['issue_url']}\n".green
|
@@ -178,23 +174,52 @@ class Gitcycle
|
|
178
174
|
puts "Checking out #{qa_branch['source']}.".green
|
179
175
|
run("git checkout #{qa_branch['source']}")
|
180
176
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
177
|
+
if issues[1..-1].empty?
|
178
|
+
if issues.first = 'pass'
|
179
|
+
puts "Merging '#{branch}' into '#{qa_branch['source']}'.\n".green
|
180
|
+
run("git merge #{branch}")
|
181
|
+
run("git push origin #{qa_branch['source']}")
|
182
|
+
end
|
183
|
+
|
184
|
+
puts "\nLabeling all issues as '#{label}'.\n".green
|
185
|
+
get('label',
|
186
|
+
'qa_branch[source]' => branch.gsub(/^qa_/, ''),
|
187
|
+
'labels' => [ label ]
|
188
|
+
)
|
189
|
+
|
190
|
+
branches = qa_branch['branches']
|
191
|
+
else
|
192
|
+
issues = [1..-1]
|
193
|
+
|
194
|
+
branches = qa_branch['branches'].select do |b|
|
195
|
+
issues.include?(b['issue'])
|
196
|
+
end
|
197
|
+
|
198
|
+
branches.each do |branch|
|
199
|
+
if issues.first = 'pass'
|
200
|
+
merge_remote_branch(
|
201
|
+
:user => branch['user'],
|
202
|
+
:repo => branch['repo'].split(':'),
|
203
|
+
:branch => branch['branch']
|
204
|
+
)
|
205
|
+
end
|
190
206
|
|
191
|
-
|
207
|
+
puts "\nLabeling issue #{branch['issue']} as '#{label}'.\n".green
|
208
|
+
get('label',
|
209
|
+
'qa_branch[source]' => branch.gsub(/^qa_/, ''),
|
210
|
+
'issue' => branch['issue'],
|
211
|
+
'labels' => [ label ]
|
212
|
+
)
|
213
|
+
end
|
214
|
+
end
|
192
215
|
|
193
|
-
|
194
|
-
|
195
|
-
|
216
|
+
if issues.first = 'pass'
|
217
|
+
puts "\nMarking Lighthouse tickets as 'pending-approval'.\n".green
|
218
|
+
branches = branches.collect do |b|
|
219
|
+
{ :name => b['branch'], :repo => b['repo'], :user => b['user'] }
|
220
|
+
end
|
221
|
+
get('ticket_resolve', 'branches' => Yajl::Encoder.encode(branches))
|
196
222
|
end
|
197
|
-
get('ticket_resolve', 'branches' => Yajl::Encoder.encode(branches))
|
198
223
|
else
|
199
224
|
puts "\nYou are not in a QA branch.\n".red
|
200
225
|
end
|
@@ -239,11 +264,20 @@ class Gitcycle
|
|
239
264
|
require_git && require_config
|
240
265
|
|
241
266
|
if issues.empty?
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
267
|
+
branch = create_pull_request
|
268
|
+
|
269
|
+
if branch == false
|
270
|
+
puts "Branch not found.\n".red
|
271
|
+
elsif branch['issue_url']
|
272
|
+
puts "\nLabeling issue as 'Pending Review'.\n".green
|
273
|
+
get('label',
|
274
|
+
'branch[name]' => branches(:current => true),
|
275
|
+
'labels' => [ 'Pending Review' ]
|
276
|
+
)
|
277
|
+
|
278
|
+
puts "Opening issue: #{branch['issue_url']}\n".green
|
279
|
+
Launchy.open(branch['issue_url'])
|
280
|
+
end
|
247
281
|
else
|
248
282
|
puts "\nLabeling issues as 'Pending Review'.\n".green
|
249
283
|
get('label',
|
@@ -306,6 +340,47 @@ class Gitcycle
|
|
306
340
|
end
|
307
341
|
end
|
308
342
|
|
343
|
+
def checkout_remote_branch(options={})
|
344
|
+
owner = options[:owner]
|
345
|
+
repo = options[:repo]
|
346
|
+
branch = options[:branch]
|
347
|
+
|
348
|
+
$remotes ||= {}
|
349
|
+
|
350
|
+
unless $remotes[owner]
|
351
|
+
$remotes[owner] = true
|
352
|
+
puts "Adding remote repo '#{owner}/#{repo}'.\n".green
|
353
|
+
run("git remote rm #{owner}") if remotes(:match => owner)
|
354
|
+
run("git remote add #{owner} git@github.com:#{owner}/#{repo}.git")
|
355
|
+
end
|
356
|
+
|
357
|
+
puts "\nFetching remote branch '#{branch}'.\n".green
|
358
|
+
run("git fetch #{owner}")
|
359
|
+
|
360
|
+
puts "\nMerging remote branch '#{branch}' from '#{owner}/#{repo}'.\n".green
|
361
|
+
run("git merge #{owner}/#{branch}")
|
362
|
+
end
|
363
|
+
|
364
|
+
def create_pull_request
|
365
|
+
puts "\nRetrieving branch information from gitcycle.\n".green
|
366
|
+
|
367
|
+
branch = get('branch',
|
368
|
+
'branch[name]' => branches(:current => true),
|
369
|
+
'create' => 0
|
370
|
+
)
|
371
|
+
|
372
|
+
if branch && !branch['issue_url']
|
373
|
+
puts "Creating GitHub pull request.\n".green
|
374
|
+
branch = get('branch',
|
375
|
+
'branch[create_pull_request]' => true,
|
376
|
+
'branch[name]' => branch['name'],
|
377
|
+
'create' => 0
|
378
|
+
)
|
379
|
+
end
|
380
|
+
|
381
|
+
branch
|
382
|
+
end
|
383
|
+
|
309
384
|
def create_qa_branch(options)
|
310
385
|
issues = options[:issues]
|
311
386
|
range = options[:range] || (0..-1)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitcycle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Winton Welsh
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-18 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|