thegarage-gitx 2.10.1 → 2.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c60254f8675c8326d671e96ac965f222eb007808
4
- data.tar.gz: 398dd0103e3a51063e1ad5d9a88d06e6ca471569
3
+ metadata.gz: c2e6a260e0bd7f13a9f8b2370fc820c12f38305d
4
+ data.tar.gz: 4f3cbe2290e5028707095755d9c724eca482e52b
5
5
  SHA512:
6
- metadata.gz: 91de6e1d04a921889e24c80f80a39bad98c8ba7069c7781ac889870458967b6c163ad75059bd3ff823343a923418ea6a3e49d75a30ec13a49f7d8e2fd80829b5
7
- data.tar.gz: e7d2fcdb382ba1fa9ba2562ced9b591c826e4a2ef22b40750fec4703a8e3748c7f71515d0ae7e6414711337ff2c4d4404f1ac0bf7d67368e3f1318a588408d1b
6
+ metadata.gz: ebb0db12d2acb6f3524e106441ea11cf5c9894871d86e0a2f762f4bceaf64007ab32ec5709ee21117dc5ea18dc7bc8ad5bb4b9051a95305c1e809dc30b70d3de
7
+ data.tar.gz: 6e3271a045068dadaaf5c015c4afd7ef447c5ac821305de953750435d0cb88e8d03257877cb9644f121b26f081ab6f9f07de586c8ba343da457ac5fd6c922cf8
@@ -98,6 +98,9 @@ module Thegarage
98
98
  client = Octokit::Client.new(login: username, password: password)
99
99
  response = client.create_authorization(authorization_request_options)
100
100
  response.token
101
+ rescue Octokit::ClientError => e
102
+ say "Error creating authorization: #{e.message}", :red
103
+ retry
101
104
  end
102
105
 
103
106
  def authorization_request_options
@@ -1,5 +1,5 @@
1
1
  module Thegarage
2
2
  module Gitx
3
- VERSION = '2.10.1'
3
+ VERSION = '2.10.2'
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ describe Thegarage::Gitx::Cli::ReviewCommand do
9
9
  pretend: true
10
10
  }
11
11
  end
12
- let(:cli) { Thegarage::Gitx::Cli::ReviewCommand.new(args, options, config) }
12
+ let(:cli) { described_class.new(args, options, config) }
13
13
  let(:repo) { double('fake repo', config: repo_config) }
14
14
  let(:repo_config) do
15
15
  {
@@ -232,6 +232,31 @@ describe Thegarage::Gitx::Cli::ReviewCommand do
232
232
  end
233
233
  it { expect(@auth_token).to eq authorization_token }
234
234
  end
235
+ context 'when config.authorization_token is nil and first request fails' do
236
+ let(:repo_config) do
237
+ {
238
+ 'remote.origin.url' => 'https://github.com/thegarage/thegarage-gitx',
239
+ 'github.user' => 'ryan@codecrate.com'
240
+ }
241
+ end
242
+ let(:github_password) { 'secretz' }
243
+ let(:authorization_token) { '123981239123' }
244
+ before do
245
+ stub_request(:post, "https://ryan@codecrate.com:secretz@api.github.com/authorizations").
246
+ to_return(:status => 401, :body => JSON.dump(token: authorization_token), :headers => {'Content-Type' => 'application/json'}).
247
+ then.
248
+ to_return(:status => 200, :body => JSON.dump(token: authorization_token), :headers => {'Content-Type' => 'application/json'})
249
+
250
+ expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ', {:echo => false}).and_return(github_password).twice
251
+ expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ', {:echo => false}).and_return(nil).twice
252
+
253
+ @auth_token = cli.send(:authorization_token)
254
+ end
255
+ it 'stores authorization_token in git config' do
256
+ expect(repo_config).to include('thegarage.gitx.githubauthtoken' => authorization_token)
257
+ end
258
+ it { expect(@auth_token).to eq authorization_token }
259
+ end
235
260
  context 'when there is an existing authorization_token' do
236
261
  let(:authorization_token) { '123981239123' }
237
262
  let(:repo_config) do
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: 2.10.1
4
+ version: 2.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged