thegarage-gitx 1.5.1 → 1.5.2
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.
- checksums.yaml +4 -4
- data/lib/thegarage/gitx/cli.rb +1 -1
- data/lib/thegarage/gitx/github.rb +6 -8
- data/lib/thegarage/gitx/version.rb +1 -1
- data/spec/thegarage/gitx/cli_spec.rb +3 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f049b47c5c5ff2de03b895f9f186cb034df5e6
|
4
|
+
data.tar.gz: e2719e6ea97ae55bdbd63cc617c66056d3dff533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b377cfd0e9e8f2c67c9d0e68a57a5c4e20e7c41424a45bbe1e57ad95ce94ef4e671c2076cfcb446fcb5d59047978dfe7a976aa60f8ca1c9e45653c22348a71c
|
7
|
+
data.tar.gz: f2b8723bd283559acef6b2fa0f2593fc0e8db2db6833ba4f262ba721133c5b9c785782fdde46ee04c1b4d375c7fe1967d11e98db368e838a42b08e73d3d62350
|
data/lib/thegarage/gitx/cli.rb
CHANGED
@@ -26,11 +26,11 @@ module Thegarage
|
|
26
26
|
method_option :open, :type => :boolean, :aliases => '-o', :desc => 'open the pull request in a web browser'
|
27
27
|
# @see http://developer.github.com/v3/pulls/
|
28
28
|
def reviewrequest
|
29
|
-
update
|
30
29
|
fail 'Github authorization token not found' unless github.authorization_token
|
31
30
|
|
32
31
|
pull_request = github.find_pull_request(current_branch)
|
33
32
|
if pull_request.nil?
|
33
|
+
update
|
34
34
|
changelog = run_cmd "git log #{Thegarage::Gitx::BASE_BRANCH}...#{current_branch} --no-merges --pretty=format:'* %s%n%b'"
|
35
35
|
pull_request = github.create_pull_request(current_branch, changelog, options)
|
36
36
|
say 'Pull request created: '
|
@@ -102,11 +102,11 @@ module Thegarage
|
|
102
102
|
# @returns nil if no pull request found
|
103
103
|
def find_pull_request(branch)
|
104
104
|
head_reference = [remote_origin_name.split('/').first, branch].join(':')
|
105
|
-
|
105
|
+
params = {
|
106
106
|
head: head_reference,
|
107
|
-
state: open
|
108
|
-
}
|
109
|
-
response = RestClient::Request.new(:url => pull_request_url, :method => "GET", :payload => payload, :headers => request_headers).execute
|
107
|
+
state: 'open'
|
108
|
+
}
|
109
|
+
response = RestClient::Request.new(:url => pull_request_url, :method => "GET", :payload => payload, :headers => request_headers.merge(params: params)).execute
|
110
110
|
data = JSON.parse(response.body)
|
111
111
|
data.first
|
112
112
|
rescue RestClient::Exception => e
|
@@ -148,8 +148,7 @@ module Thegarage
|
|
148
148
|
|
149
149
|
def pull_request_body(changelog, description = nil)
|
150
150
|
description_template = []
|
151
|
-
description_template << description if description
|
152
|
-
description_template << "\n"
|
151
|
+
description_template << "#{description}\n" if description
|
153
152
|
description_template << '### Changelog'
|
154
153
|
description_template << changelog
|
155
154
|
description_template << PULL_REQUEST_FOOTER
|
@@ -175,8 +174,7 @@ module Thegarage
|
|
175
174
|
end
|
176
175
|
pid = fork { exec([editor, flags, f.path].join(' ')) }
|
177
176
|
Process.waitpid(pid)
|
178
|
-
|
179
|
-
contents.chomp.strip
|
177
|
+
File.read(f.path)
|
180
178
|
end
|
181
179
|
end
|
182
180
|
end
|
@@ -286,10 +286,6 @@ describe Thegarage::Gitx::CLI do
|
|
286
286
|
end
|
287
287
|
before do
|
288
288
|
allow(cli).to receive(:github).and_return(github)
|
289
|
-
|
290
|
-
expect(cli).to receive(:run).with("git pull origin feature-branch", capture: true).ordered
|
291
|
-
expect(cli).to receive(:run).with("git pull origin master", capture: true).ordered
|
292
|
-
expect(cli).to receive(:run).with("git push origin HEAD", capture: true).ordered
|
293
289
|
end
|
294
290
|
context 'when pull request does not exist' do
|
295
291
|
let(:authorization_token) { '123123' }
|
@@ -299,6 +295,9 @@ describe Thegarage::Gitx::CLI do
|
|
299
295
|
expect(github).to receive(:find_pull_request).and_return(nil)
|
300
296
|
expect(github).to receive(:create_pull_request).and_return(pull_request)
|
301
297
|
|
298
|
+
expect(cli).to receive(:run).with("git pull origin feature-branch", capture: true).ordered
|
299
|
+
expect(cli).to receive(:run).with("git pull origin master", capture: true).ordered
|
300
|
+
expect(cli).to receive(:run).with("git push origin HEAD", capture: true).ordered
|
302
301
|
expect(cli).to receive(:run).with("git log master...feature-branch --no-merges --pretty=format:'* %s%n%b'", capture: true).and_return("2013-01-01 did some stuff").ordered
|
303
302
|
cli.reviewrequest
|
304
303
|
end
|