thegarage-gitx 1.2.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a44d5b6d944ad83cefaf44b1bef94c182321e80
4
- data.tar.gz: 79f0b6b3fcede708628605d02276ac3854259e68
3
+ metadata.gz: 80aafd556ae6dca4c266fe24a0bdfb5800b35f14
4
+ data.tar.gz: 3832c3bc543af63458d8e3aa903c01f4b6cda9ba
5
5
  SHA512:
6
- metadata.gz: 84ecc83c73103cc2a0a847f1582a460deb17d400c2a43fecb126dc6ee4a1a56eb8e20f3eb490ea7e23dfe95c407dd2164066a12d023c3bc51fd725760ec76f85
7
- data.tar.gz: 64fba4122a8ac716a6e231ab43ed408e9893d04e7de1f5a0aa25f3b7f65507083f5c6351e7040ef7eb9dd171d6a8ec62aaa0d17dcbd691c999d2088a14fbeadb
6
+ metadata.gz: 63a56af292e550422d1cce4160cf4dd85185cb3a7ea0af4c8a56c4f200644e386a3317d17c9c59fc546f937ad207ec38c1f93480a3c582d568bfaa286c07c129
7
+ data.tar.gz: 37c2ce8e2a6919ab9f9ea8ab7581e1af0f86d436862763cd59fe68d1703ea0357ef052297c3551d5fc6a9bff2ae09132365edc7372bec1b03ebcecdc0905ab18
data/.travis.yml CHANGED
@@ -1,8 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '2.0.0'
4
-
5
- after_success:
6
- - git config --global user.email "builds@travis-ci.com"
7
- - git config --global user.name "Travis CI"
8
- - git buildtag
3
+ - '2.0.0'
@@ -25,7 +25,7 @@ module Thegarage
25
25
  # ex: git@github.com:socialcast/thegarage/gitx.git OR https://github.com/socialcast/thegarage/gitx.git
26
26
  def current_remote_repo
27
27
  repo = current_repo.config['remote.origin.url']
28
- repo.gsub(/\.git$/,'').split(/[:\/]/).last(2).join('/')
28
+ repo.to_s.gsub(/\.git$/,'').split(/[:\/]/).last(2).join('/')
29
29
  end
30
30
 
31
31
  # @returns [String] github username (ex: 'wireframe') of the current github.user
@@ -19,9 +19,8 @@ module Thegarage
19
19
  auth_token = github_auth_token
20
20
  return auth_token unless auth_token.to_s.blank?
21
21
 
22
- username = current_user
23
- raise "Github user not configured. Run: `git config --global github.user 'me@email.com'`" if username.empty?
24
- password = ask("Github password for #{username}: ", :echo => false)
22
+ raise "Github user not configured. Run: `git config --global github.user 'me@email.com'`" unless current_user
23
+ password = ask("Github password for #{current_user}: ", :echo => false)
25
24
 
26
25
  payload = {
27
26
  :scopes => ['repo'],
@@ -31,7 +30,7 @@ module Thegarage
31
30
  response = RestClient::Request.new({
32
31
  :url => "https://api.github.com/authorizations",
33
32
  :method => "POST",
34
- :user => username,
33
+ :user => current_user,
35
34
  :password => password,
36
35
  :payload => payload,
37
36
  :headers => {
@@ -1,5 +1,5 @@
1
1
  module Thegarage
2
2
  module Gitx
3
- VERSION = '1.2.0'
3
+ VERSION = '1.2.1'
4
4
  end
5
5
  end
@@ -276,6 +276,57 @@ describe Thegarage::Gitx::CLI do
276
276
  end
277
277
 
278
278
  describe '#reviewrequest' do
279
+ context 'when github.user is not configured' do
280
+ it 'raises error' do
281
+ expect(cli).to receive(:run).with("git pull origin feature-branch", capture: true).ordered
282
+ expect(cli).to receive(:run).with("git pull origin master", capture: true).ordered
283
+ expect(cli).to receive(:run).with("git push origin HEAD", capture: true).ordered
284
+
285
+ expect do
286
+ cli.reviewrequest
287
+ end.to raise_error /Github user not configured/
288
+ end
289
+ end
290
+ context 'when authorization_token is nil' do
291
+ let(:options) { {description: 'testing'} }
292
+ let(:current_user) { 'ryan@codecrate.com' }
293
+ let(:github_password) { 'secretz' }
294
+ let(:authorization_token) { 'auth_token' }
295
+ let(:expected_auth_body) do
296
+ JSON.dump({
297
+ scopes: ["repo"],
298
+ note: "The Garage Git eXtensions",
299
+ note_url: "https://github.com/thegarage/thegarage-gitx"
300
+ })
301
+ end
302
+ before do
303
+ stub_request(:post, "https://#{current_user}:#{github_password}@api.github.com/authorizations").
304
+ with(:body => expected_auth_body).
305
+ to_return(:status => 200, :body => JSON.dump(token: authorization_token), :headers => {})
306
+
307
+ stub_request(:post, "https://api.github.com/repos/thegarage/thegarage-gitx/pulls").
308
+ to_return(:status => 200, :body => %q({"html_url": "http://github.com/repo/project/pulls/1"}), :headers => {})
309
+
310
+ allow(cli).to receive(:current_user).and_return(current_user)
311
+ expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ', {:echo => false}).and_return(github_password)
312
+ expect(cli).to receive(:github_auth_token=).with(authorization_token)
313
+
314
+ expect(cli).to receive(:run).with("git pull origin feature-branch", capture: true).ordered
315
+ expect(cli).to receive(:run).with("git pull origin master", capture: true).ordered
316
+ expect(cli).to receive(:run).with("git push origin HEAD", capture: true).ordered
317
+
318
+ cli.reviewrequest
319
+ end
320
+ it 'creates authorization_token' do
321
+ should meet_expectations
322
+ end
323
+ it 'should create github pull request' do
324
+ should meet_expectations
325
+ end
326
+ it 'should run expected commands' do
327
+ should meet_expectations
328
+ end
329
+ end
279
330
  context 'when description != null and there is an existing authorization_token' do
280
331
  let(:options) { {description: 'testing'} }
281
332
  let(:authorization_token) { '123981239123' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thegarage-gitx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-30 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grit
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  version: '0'
205
205
  requirements: []
206
206
  rubyforge_project:
207
- rubygems_version: 2.0.7
207
+ rubygems_version: 2.0.3
208
208
  signing_key:
209
209
  specification_version: 4
210
210
  summary: Utility scripts for Git to increase productivity for common operations