gitcycle 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -29,7 +29,7 @@ Branch From Ticket
29
29
 
30
30
  First, checkout the branch that you will eventually merge your code into:
31
31
 
32
- gitc checkout <branch>
32
+ gitc checkout [BRANCH]
33
33
 
34
34
  Type `gitc branch` + your ticket URL to create a new branch:
35
35
 
@@ -81,55 +81,49 @@ Code Review
81
81
 
82
82
  Periodically check for "Pending Review" issues on GitHub.
83
83
 
84
- Once reviewed, label the issue as reviewed:
84
+ ### Pass
85
+
86
+ gitc review pass [GITHUB ISSUE #] [...]
87
+
88
+ Label the issue "Pending QA".
85
89
 
86
- gitc reviewed [GITHUB ISSUE #] [...]
90
+ ### Fail
91
+
92
+ gitc review fail [GITHUB ISSUE #] [...]
93
+
94
+ Label the issue "Fail".
87
95
 
88
96
  Quality Assurance
89
97
  -----------------
90
98
 
91
99
  Periodically check for "Pending QA" issues on Github.
92
100
 
93
- To create a new QA branch:
101
+ ### Create QA Branch
94
102
 
95
103
  gitc qa [GITHUB ISSUE #] [...]
96
104
 
97
105
  Now you have a QA branch containing all commits from the specified Github issue numbers.
98
106
 
99
- QA Fail
100
- -------
101
-
102
- If a feature does not pass QA:
103
-
104
- gitc qa fail [GITHUB ISSUE #] [...]
105
-
106
- To fail all issues:
107
-
108
- gitc qa fail
109
-
110
- This adds a "fail" label to the issue.
107
+ ### Fail
111
108
 
112
- QA Pass
113
- -------
109
+ gitc qa fail [GITHUB ISSUE #]
114
110
 
115
- If a feature passes QA:
111
+ Label the issue with "Fail" and regenerate the QA branch without the failing issue.
116
112
 
117
- gitc qa pass [GITHUB ISSUE #] [...]
118
-
119
- To pass all issues:
113
+ ### Pass
120
114
 
121
115
  gitc qa pass
122
116
 
123
- This adds a "pass" label to the issue and completes the pull request by merging the feature branch into the target branch.
117
+ Label all issues "Pass" and the merge the QA branch into target branch.
124
118
 
125
- More
126
- ----
119
+ ### Status
127
120
 
128
- ### Checkout Upstream Branch
121
+ See who is QA'ing what:
129
122
 
130
- If you are working in a fork, it is easy to checkout upstream branches:
123
+ gitc qa
131
124
 
132
- gitc checkout [BRANCH]
125
+ Checkout
126
+ --------
133
127
 
134
128
  ### Collaborate
135
129
 
@@ -137,35 +131,30 @@ Checkout branches from other forks:
137
131
 
138
132
  gitc checkout [USER] [BRANCH]
139
133
 
140
- ### QA Status
134
+ ### From Ticket
141
135
 
142
- See who is QA'ing what:
136
+ Checkout a branch from a ticket URL:
143
137
 
144
- gitc qa
138
+ gitc checkout [TICKET URL]
145
139
 
146
- ### Redo Branch
140
+ ### Upstream Branch
147
141
 
148
- If you associate the wrong branch with a ticket, use `gitc redo` to fix it.
142
+ Gitcycle automatically knows if you are checking out an upstream branch:
149
143
 
150
- gitc redo https://xxx.lighthouseapp.com/projects/0000/tickets/0000-my-ticket
144
+ gitc checkout [BRANCH]
151
145
 
152
146
  Todo
153
147
  ----
154
148
 
155
149
  * Label issues with ticket milestone
156
- * Add ability to associate multiple branches/pull requests with one Lighthouse ticket
150
+ * Issues aren't assigned to people
157
151
  * Add comment on lighthouse with issue URL
158
- * gitc discuss should tag issue with 'Discuss'
159
152
  * On pass or fail, send email to Github email
160
- * Note you can use gitc with a string
153
+ * Note you can use gitc with a string (and get this working)
161
154
  * gitc qa pass, should not set ticket to pending-approval if its already resolved
162
155
  * If gitc redo happens on branch with Github issue, close the existing issue
163
- * Add comment on lighthouse with issue URL
164
156
  * Instead of detecting CONFLICT, use error status $? != 0
165
- * gitc qa pass # since we're changing this to pass all the tickets, we need to loop through all the merged issues and update the lighthouse state to pending-qa
166
- * There's still a Tagging Issue I tried to fix parseLabel http://d.pr/8eOS , Pass should remove Pending *, but remove the Branch Name. Also, when I gitc reviewed failed [issue number] it marks it pending-qa and failed.. not correct. I'll take a look at this over the weekend -Tung
167
- * gitc discuss should tag issue with 'Discuss'
168
157
  * gitc ready - possibly do syntax checks
169
158
  $ gitc st - shortcut
170
- * issues aren't assigned to people
171
- * There's still a Tagging Issue I tried to fix parseLabel http://d.pr/8eOS , Pass should remove Pending, but remove the Branch Name
159
+ * There's still a Tagging Issue I tried to fix parseLabel http://d.pr/8eOS , Pass should remove Pending *, but remove the Branch Name. Also, when I gitc reviewed failed [issue number] it marks it pending-qa and failed.. not correct. I'll take a look at this over the weekend -Tung
160
+ * gitc qa pass # since we're changing this to pass all the tickets, we need to loop through all the merged issues and update the lighthouse state to pending-qa
@@ -62,31 +62,9 @@ Scenario: Feature branch
62
62
  """
63
63
  And redis entries valid
64
64
 
65
- Scenario: Redo feature branch
66
- Given a fresh set of repositories
67
- When I cd to the user repo
68
- And I execute gitcycle redo with the Lighthouse ticket URL
69
- And I enter "y"
70
- And I enter "y"
71
- Then gitcycle runs
72
- And output includes
73
- """
74
- Retrieving branch information from gitcycle.
75
- Your work will eventually merge into 'master'. Is this correct? (y/n)
76
- Would you like to name your branch 'ticket.id'? (y/n)
77
- Adding remote repo 'config.owner/config.repo'.
78
- Fetching remote 'config.owner'.
79
- Checking out remote branch 'ticket.id' from 'config.owner/config.repo/master'.
80
- Fetching remote 'origin'.
81
- Pulling 'origin/ticket.id'.
82
- Pushing 'origin/ticket.id'.
83
- Sending branch information to gitcycle.
84
- """
85
- And redis entries valid
86
-
87
65
  Scenario: Checkout via ticket w/ existing branch
88
66
  When I cd to the user repo
89
- And I execute gitcycle branch with the Lighthouse ticket URL
67
+ And I execute gitcycle checkout with the Lighthouse ticket URL
90
68
  Then gitcycle runs
91
69
  And output includes
92
70
  """
@@ -98,7 +76,7 @@ Scenario: Checkout via ticket w/ existing branch
98
76
  Scenario: Checkout via ticket w/ fresh repo
99
77
  Given a fresh set of repositories
100
78
  When I cd to the user repo
101
- And I execute gitcycle branch with the Lighthouse ticket URL
79
+ And I execute gitcycle checkout with the Lighthouse ticket URL
102
80
  Then gitcycle runs
103
81
  And output includes
104
82
  """
@@ -147,6 +125,7 @@ Scenario: Discuss commits w/ no parameters and something committed
147
125
  """
148
126
  Retrieving branch information from gitcycle.
149
127
  Creating GitHub pull request.
128
+ Labeling issue as 'Discuss'.
150
129
  """
151
130
  And output includes "Opening issue" with URL
152
131
  And URL is a valid issue
@@ -190,13 +169,13 @@ Scenario: Ready issue w/ parameters
190
169
  Scenario: Reviewed issue w/ no parameters
191
170
  When I cd to the user repo
192
171
  And I checkout ticket.id
193
- And I execute gitcycle with "reviewed"
172
+ And I execute gitcycle with "review pass"
194
173
  Then gitcycle runs
195
174
  And output includes "Labeling issue as 'Pending QA'."
196
175
 
197
176
  Scenario: Reviewed issue w/ parameters
198
177
  When I cd to the user repo
199
- And I execute gitcycle with "reviewed issue.id"
178
+ And I execute gitcycle with "review pass issue.id"
200
179
  Then gitcycle runs
201
180
  And output includes "Labeling issues as 'Pending QA'."
202
181
 
@@ -140,12 +140,8 @@ When /^I execute gitcycle setup$/ do
140
140
  ].join(' ')
141
141
  end
142
142
 
143
- When /^I execute gitcycle branch with the Lighthouse ticket URL$/ do
144
- $execute << "branch #{$ticket.url}"
145
- end
146
-
147
- When /^I execute gitcycle redo with the Lighthouse ticket URL$/ do
148
- $execute << "redo #{$ticket.url}"
143
+ When /^I execute gitcycle (.*) with the Lighthouse ticket URL$/ do |cmd|
144
+ $execute << "#{cmd} #{$ticket.url}"
149
145
  end
150
146
 
151
147
  When /^I cd to the (.*) repo$/ do |user|
data/gitcycle.gemspec CHANGED
@@ -6,7 +6,7 @@ $:.unshift lib unless $:.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "gitcycle"
9
- s.version = '0.2.12'
9
+ s.version = '0.2.13'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = [ 'Winton Welsh' ]
12
12
  s.email = [ 'mail@wintoni.us' ]
data/lib/gitcycle.rb CHANGED
@@ -65,34 +65,29 @@ class Gitcycle
65
65
  exec_git(:branch, args)
66
66
  end
67
67
 
68
- params['reset'] = '1' if args.include?('--redo')
69
-
70
68
  puts "\nRetrieving branch information from gitcycle.\n".green
71
69
  branch = get('branch', params)
72
70
  name = branch['name']
73
71
 
74
72
  begin
75
73
  owner, repo = branch['repo'].split(':')
74
+ branch['home'] = @git_login
76
75
 
77
- unless branch['exists']
78
- branch['home'] = @git_login
79
-
80
- unless yes?("\nYour work will eventually merge into '#{branch['source']}'. Is this correct?")
81
- branch['source'] = q("What branch would you like to eventually merge into?")
82
- end
83
-
84
- unless yes?("Would you like to name your branch '#{name}'?")
85
- name = q("\nWhat would you like to name your branch?")
86
- name = name.gsub(/[\s\W]/, '-')
87
- end
76
+ unless yes?("\nYour work will eventually merge into '#{branch['source']}'. Is this correct?")
77
+ branch['source'] = q("What branch would you like to eventually merge into?")
78
+ end
88
79
 
89
- checkout_remote_branch(
90
- :owner => owner,
91
- :repo => repo,
92
- :branch => branch['source'],
93
- :target => name
94
- )
80
+ unless yes?("Would you like to name your branch '#{name}'?")
81
+ name = q("\nWhat would you like to name your branch?")
82
+ name = name.gsub(/[\s\W]/, '-')
95
83
  end
84
+
85
+ checkout_remote_branch(
86
+ :owner => owner,
87
+ :repo => repo,
88
+ :branch => branch['source'],
89
+ :target => name
90
+ )
96
91
  rescue SystemExit, Interrupt
97
92
  puts "\nDeleting branch from gitcycle.\n".green
98
93
  branch = get('branch',
@@ -102,17 +97,13 @@ class Gitcycle
102
97
  )
103
98
  end
104
99
 
105
- if branch['exists']
106
- checkout_or_track(:name => name, :remote => 'origin')
107
- else
108
- puts "Sending branch information to gitcycle.".green
109
- get('branch',
110
- 'branch[home]' => branch['home'],
111
- 'branch[name]' => branch['name'],
112
- 'branch[rename]' => name != branch['name'] ? name : nil,
113
- 'branch[source]' => branch['source']
114
- )
115
- end
100
+ puts "Sending branch information to gitcycle.".green
101
+ get('branch',
102
+ 'branch[home]' => branch['home'],
103
+ 'branch[name]' => branch['name'],
104
+ 'branch[rename]' => name != branch['name'] ? name : nil,
105
+ 'branch[source]' => branch['source']
106
+ )
116
107
 
117
108
  puts "\n"
118
109
  end
@@ -124,39 +115,45 @@ class Gitcycle
124
115
 
125
116
  require_git && require_config
126
117
 
127
- remote, branch = args
128
- remote, branch = nil, remote if branch.nil?
118
+ if args.length == 1 && args[0] =~ /^https?:\/\//
119
+ puts "\nRetrieving branch information from gitcycle.\n".green
120
+ branch = get('branch', 'branch[lighthouse_url]' => args[0])
121
+ checkout_or_track(:name => branch['name'], :remote => 'origin')
122
+ else
123
+ remote, branch = args
124
+ remote, branch = nil, remote if branch.nil?
129
125
 
130
- unless branches(:match => branch)
131
- collab = branch && remote
126
+ unless branches(:match => branch)
127
+ collab = branch && remote
132
128
 
133
- unless collab
134
- puts "\nRetrieving repo information from gitcycle.\n".green
135
- repo = get('repo')
136
- remote = repo['owner']
137
- end
138
-
139
- add_remote_and_fetch(
140
- :owner => remote,
141
- :repo => @git_repo
142
- )
143
-
144
- puts "Creating branch '#{branch}' from '#{remote}/#{branch}'.\n".green
145
- run("git branch --no-track #{branch} #{remote}/#{branch}")
146
-
147
- if collab
148
- puts "Sending branch information to gitcycle.".green
149
- get('branch',
150
- 'branch[home]' => remote,
151
- 'branch[name]' => branch,
152
- 'branch[collab]' => 1,
153
- 'create' => 1
129
+ unless collab
130
+ puts "\nRetrieving repo information from gitcycle.\n".green
131
+ repo = get('repo')
132
+ remote = repo['owner']
133
+ end
134
+
135
+ add_remote_and_fetch(
136
+ :owner => remote,
137
+ :repo => @git_repo
154
138
  )
139
+
140
+ puts "Creating branch '#{branch}' from '#{remote}/#{branch}'.\n".green
141
+ run("git branch --no-track #{branch} #{remote}/#{branch}")
142
+
143
+ if collab
144
+ puts "Sending branch information to gitcycle.".green
145
+ get('branch',
146
+ 'branch[home]' => remote,
147
+ 'branch[name]' => branch,
148
+ 'branch[collab]' => 1,
149
+ 'create' => 1
150
+ )
151
+ end
155
152
  end
156
- end
157
153
 
158
- puts "Checking out '#{branch}'.\n".green
159
- run("git checkout #{branch}")
154
+ puts "Checking out '#{branch}'.\n".green
155
+ run("git checkout #{branch}")
156
+ end
160
157
  end
161
158
  alias :co :checkout
162
159
 
@@ -202,6 +199,12 @@ class Gitcycle
202
199
  if branch == false
203
200
  puts "Branch not found.\n".red
204
201
  elsif branch['issue_url']
202
+ puts "\nLabeling issue as 'Discuss'.\n".green
203
+ get('label',
204
+ 'branch[name]' => branch['name'],
205
+ 'labels' => [ 'Discuss' ]
206
+ )
207
+
205
208
  puts "Opening issue: #{branch['issue_url']}\n".green
206
209
  Launchy.open(branch['issue_url'])
207
210
  else
@@ -403,7 +406,7 @@ class Gitcycle
403
406
  elsif branch['issue_url']
404
407
  puts "\nLabeling issue as 'Pending Review'.\n".green
405
408
  get('label',
406
- 'branch[name]' => branches(:current => true),
409
+ 'branch[name]' => branch['name'],
407
410
  'labels' => [ 'Pending Review' ]
408
411
  )
409
412
 
@@ -422,19 +425,12 @@ class Gitcycle
422
425
  end
423
426
  end
424
427
 
425
- def redo(*args)
426
- args << "--redo"
427
- branch(*args)
428
- end
429
-
430
- def reviewed(*issues)
428
+ def review(pass_fail, *issues)
431
429
  require_git && require_config
432
430
 
433
- if issues.include?("fail")
434
- issues = issues.reject{|x| x=='fail'}
431
+ if pass_fail == 'fail'
435
432
  label = 'Fail'
436
433
  else
437
- issues = issues.reject{|x| x=='pass'}
438
434
  label = 'Pending QA'
439
435
  end
440
436
 
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: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 12
10
- version: 0.2.12
9
+ - 13
10
+ version: 0.2.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Winton Welsh