git-review 1.0.7 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git-review.rb +15 -17
- metadata +59 -73
data/lib/git-review.rb
CHANGED
@@ -107,7 +107,7 @@ class GitReview
|
|
107
107
|
def approve
|
108
108
|
return unless request_exists?
|
109
109
|
comment = 'Reviewed and approved.'
|
110
|
-
response =
|
110
|
+
response = @github.add_comment source_repo, @current_request['number'], comment
|
111
111
|
if response[:body] == comment
|
112
112
|
puts 'Successfully approved request.'
|
113
113
|
else
|
@@ -118,7 +118,7 @@ class GitReview
|
|
118
118
|
# Close a specified request.
|
119
119
|
def close
|
120
120
|
return unless request_exists?
|
121
|
-
|
121
|
+
@github.close_issue source_repo, @current_request['number']
|
122
122
|
puts 'Successfully closed request.' unless request_exists?('open', @current_request['number'])
|
123
123
|
end
|
124
124
|
|
@@ -170,7 +170,7 @@ class GitReview
|
|
170
170
|
# TODO: Insert commit messages (that are not yet in master) into body (since this will be displayed inside the mail that is sent out).
|
171
171
|
body = 'Please review the following changes:'
|
172
172
|
# Create the actual pull request.
|
173
|
-
|
173
|
+
@github.create_pull_request target_repo, target_branch, source_branch, title, body
|
174
174
|
# Switch back to target_branch and check for success.
|
175
175
|
git_call "checkout #{target_branch}"
|
176
176
|
update
|
@@ -273,7 +273,7 @@ class GitReview
|
|
273
273
|
@current_request = @current_requests.find{ |req| req['number'] == request_id }
|
274
274
|
unless @current_request
|
275
275
|
# Additional try to get an older request from Github by specifying the number.
|
276
|
-
request =
|
276
|
+
request = @github.pull_request source_repo, request_id
|
277
277
|
@current_request = request if request.state == state
|
278
278
|
end
|
279
279
|
if @current_request
|
@@ -287,7 +287,7 @@ class GitReview
|
|
287
287
|
|
288
288
|
# Get latest changes from GitHub.
|
289
289
|
def update(state = 'open')
|
290
|
-
@current_requests =
|
290
|
+
@current_requests = @github.pull_requests source_repo, state
|
291
291
|
repos = @current_requests.collect do |req|
|
292
292
|
repo = req['head']['repository']
|
293
293
|
"#{repo['owner']}/#{repo['name']}" unless repo.nil?
|
@@ -384,14 +384,12 @@ class GitReview
|
|
384
384
|
output
|
385
385
|
end
|
386
386
|
|
387
|
-
# Convenience method that uses Octokit to access a repo through Github's API.
|
388
|
-
def repo_call(method, path, options = {})
|
389
|
-
Octokit.send(method, "/repos/#{Octokit::Repository.new(source_repo)}/#{path}", options, 3)
|
390
|
-
end
|
391
|
-
|
392
387
|
# Show current discussion for @current_request.
|
393
388
|
def discussion
|
394
|
-
request =
|
389
|
+
request = @github.pull_request source_repo, @current_request['number']
|
390
|
+
# FIXME:
|
391
|
+
puts 'This needs to be updated to work with API v3.'
|
392
|
+
return
|
395
393
|
result = request['discussion'].collect do |entry|
|
396
394
|
user = entry['user'] || entry['author']
|
397
395
|
name = user['login'].empty? ? user['name'] : user['login']
|
@@ -455,7 +453,7 @@ class GitReview
|
|
455
453
|
# Returns a string that specifies the target branch.
|
456
454
|
def target_branch
|
457
455
|
# TODO: Enable possibility to manually override this and set arbitrary branches.
|
458
|
-
'master'
|
456
|
+
ENV['TARGET_BRANCH'] || 'master'
|
459
457
|
end
|
460
458
|
|
461
459
|
# Returns a string consisting of target repo and branch.
|
@@ -476,12 +474,12 @@ class GitReview
|
|
476
474
|
# Uses Octokit to access GitHub.
|
477
475
|
def configure_github_access
|
478
476
|
if git_config['github.login'] and git_config['github.password']
|
479
|
-
Octokit.
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
end
|
477
|
+
@github = Octokit::Client.new(
|
478
|
+
:login => git_config['github.login'],
|
479
|
+
:password => git_config['github.password']
|
480
|
+
)
|
484
481
|
true
|
482
|
+
@github.login
|
485
483
|
else
|
486
484
|
puts 'Please update your git config and provide your GitHub login and password.'
|
487
485
|
puts
|
metadata
CHANGED
@@ -1,110 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-review
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 7
|
10
|
-
version: 1.0.7
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Dominik Bamberger
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-06-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: launchy
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: octokit
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
25
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: octokit
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
48
38
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: yajl-ruby
|
52
39
|
prerelease: false
|
53
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
41
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: yajl-ruby
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
62
54
|
type: :runtime
|
63
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
64
62
|
description: Manage review workflow for projects hosted on GitHub (using pull requests).
|
65
63
|
email: bamberger.dominik@gmail.com
|
66
|
-
executables:
|
64
|
+
executables:
|
67
65
|
- git-review
|
68
66
|
extensions: []
|
69
|
-
|
70
67
|
extra_rdoc_files: []
|
71
|
-
|
72
|
-
files:
|
68
|
+
files:
|
73
69
|
- LICENSE
|
74
70
|
- lib/git-review.rb
|
75
71
|
- bin/git-review
|
76
72
|
homepage: http://github.com/b4mboo/git-review
|
77
73
|
licenses: []
|
78
|
-
|
79
74
|
post_install_message:
|
80
75
|
rdoc_options: []
|
81
|
-
|
82
|
-
require_paths:
|
76
|
+
require_paths:
|
83
77
|
- lib
|
84
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
79
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
|
91
|
-
- 0
|
92
|
-
version: "0"
|
93
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
85
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
version: "0"
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
102
90
|
requirements: []
|
103
|
-
|
104
91
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.8.
|
92
|
+
rubygems_version: 1.8.24
|
106
93
|
signing_key:
|
107
94
|
specification_version: 3
|
108
95
|
summary: facilitates GitHub code reviews
|
109
96
|
test_files: []
|
110
|
-
|