git_reflow 0.2 → 0.2.1
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.
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/git_reflow/version.rb +1 -1
- data/lib/git_reflow.rb +24 -8
- metadata +4 -4
data/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/*
|
data/Gemfile.lock
CHANGED
data/lib/git_reflow/version.rb
CHANGED
data/lib/git_reflow.rb
CHANGED
@@ -13,7 +13,7 @@ module GitReflow
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
gh_user = ask "Please enter your GitHub username: "
|
16
|
-
gh_password = ask
|
16
|
+
gh_password = ask("Please enter your GitHub password (we do NOT store this): ") { |q| q.echo = false }
|
17
17
|
puts "\nYour GitHub account was successfully setup!"
|
18
18
|
github = Github.new :basic_auth => "#{gh_user}:#{gh_password}"
|
19
19
|
authorization = github.oauth.create 'scopes' => ['repo']
|
@@ -40,6 +40,19 @@ module GitReflow
|
|
40
40
|
if error_message =~ /request already exists/i
|
41
41
|
existing_pull_request = find_pull_request( :from => current_branch, :to => options['base'] )
|
42
42
|
puts "Existing pull request at: #{existing_pull_request[:html_url]}"
|
43
|
+
|
44
|
+
# check for needed lgtm's
|
45
|
+
pull_comments = pull_request_comments(existing_pull_request)
|
46
|
+
if pull_comments.any?
|
47
|
+
open_comment_authors = find_authors_of_open_pull_request_comments(existing_pull_request)
|
48
|
+
last_committed_at = Time.parse existing_pull_request.head.repo.updated_at
|
49
|
+
lgtm_authors = comment_authors_for_pull_request(existing_pull_request, :with => LGTM, :after => last_committed_at)
|
50
|
+
puts "[review] LGTM given by: #{lgtm_authors.join(', ')}" if lgtm_authors.any?
|
51
|
+
puts "[notice] You still need a LGTM from: #{open_comment_authors.join(', ')}" if open_comment_authors.any?
|
52
|
+
else
|
53
|
+
puts "[notice] No one has reviewed your pull request..."
|
54
|
+
end
|
55
|
+
|
43
56
|
ask_to_open_in_browser(existing_pull_request.html_url)
|
44
57
|
else
|
45
58
|
puts error_message
|
@@ -81,7 +94,7 @@ module GitReflow
|
|
81
94
|
if deploy_and_cleanup =~ /^y/i
|
82
95
|
puts `git push origin #{options['base']}`
|
83
96
|
puts `git push origin :#{feature_branch}`
|
84
|
-
puts `git
|
97
|
+
puts `git branch -D #{feature_branch}`
|
85
98
|
puts "Nice job buddy."
|
86
99
|
end
|
87
100
|
else
|
@@ -177,11 +190,15 @@ module GitReflow
|
|
177
190
|
existing_pull_request
|
178
191
|
end
|
179
192
|
|
180
|
-
def
|
181
|
-
# first we'll gather all the authors that have commented on the pull request
|
193
|
+
def pull_request_comments(pull_request)
|
182
194
|
comments = github.issues.comments.all remote_user, remote_repo_name, pull_request[:number]
|
183
195
|
review_comments = github.pull_requests.comments.all remote_user, remote_repo_name, pull_request[:number]
|
184
|
-
|
196
|
+
comments + review_comments
|
197
|
+
end
|
198
|
+
|
199
|
+
def find_authors_of_open_pull_request_comments(pull_request)
|
200
|
+
# first we'll gather all the authors that have commented on the pull request
|
201
|
+
all_comments = pull_request_comments(pull_request)
|
185
202
|
comment_authors = comment_authors_for_pull_request(pull_request)
|
186
203
|
|
187
204
|
# now we need to check that all the commented authors have given a lgtm after the last commit
|
@@ -202,12 +219,11 @@ module GitReflow
|
|
202
219
|
end
|
203
220
|
|
204
221
|
def comment_authors_for_pull_request(pull_request, options = {})
|
205
|
-
|
206
|
-
review_comments = github.pull_requests.comments.all remote_user, remote_repo_name, pull_request[:number]
|
207
|
-
all_comments = comments + review_comments
|
222
|
+
all_comments = pull_request_comments(pull_request)
|
208
223
|
comment_authors = []
|
209
224
|
|
210
225
|
all_comments.each do |comment|
|
226
|
+
next if options[:after] and Time.parse(comment.created_at) < options[:after]
|
211
227
|
comment_authors << comment.user.login if !comment_authors.include?(comment.user.login) and (options[:with].nil? or comment.body =~ options[:with])
|
212
228
|
end
|
213
229
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_reflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-08-
|
14
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -250,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
250
|
version: '0'
|
251
251
|
segments:
|
252
252
|
- 0
|
253
|
-
hash:
|
253
|
+
hash: -1057923408803391323
|
254
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
255
|
none: false
|
256
256
|
requirements:
|
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
version: '0'
|
260
260
|
segments:
|
261
261
|
- 0
|
262
|
-
hash:
|
262
|
+
hash: -1057923408803391323
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
265
|
rubygems_version: 1.8.24
|