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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ca247018abf7dcebd68cf0f1db75c0d28efd2a8
4
- data.tar.gz: 6c28961ed17891bdf9c684c36b4354ac87c88144
3
+ metadata.gz: 26f049b47c5c5ff2de03b895f9f186cb034df5e6
4
+ data.tar.gz: e2719e6ea97ae55bdbd63cc617c66056d3dff533
5
5
  SHA512:
6
- metadata.gz: 33a1f377085a090f14b3cfc85a7f890336ee66970dfed1b0cafa96d103fdcdf6c34b50c06b87fc0ce51bada64a2b6d83bf5d80019773547499964aa1e6fc1e40
7
- data.tar.gz: fc3c002f80c9c67315f9b5dd164806c929215f2f40d178aa5a7ce509dee418f47476ef1b82b2228052abc1fce7809af8ceef83e679ee68c6a4e63b647457898f
6
+ metadata.gz: 3b377cfd0e9e8f2c67c9d0e68a57a5c4e20e7c41424a45bbe1e57ad95ce94ef4e671c2076cfcb446fcb5d59047978dfe7a976aa60f8ca1c9e45653c22348a71c
7
+ data.tar.gz: f2b8723bd283559acef6b2fa0f2593fc0e8db2db6833ba4f262ba721133c5b9c785782fdde46ee04c1b4d375c7fe1967d11e98db368e838a42b08e73d3d62350
@@ -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
- payload = {
105
+ params = {
106
106
  head: head_reference,
107
- state: open
108
- }.to_json
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
- contents = File.read(f.path)
179
- contents.chomp.strip
177
+ File.read(f.path)
180
178
  end
181
179
  end
182
180
  end
@@ -1,5 +1,5 @@
1
1
  module Thegarage
2
2
  module Gitx
3
- VERSION = '1.5.1'
3
+ VERSION = '1.5.2'
4
4
  end
5
5
  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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thegarage-gitx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek