thegarage-gitx 2.10.1 → 2.10.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/github.rb +3 -0
- data/lib/thegarage/gitx/version.rb +1 -1
- data/spec/thegarage/gitx/cli/review_command_spec.rb +26 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2e6a260e0bd7f13a9f8b2370fc820c12f38305d
|
4
|
+
data.tar.gz: 4f3cbe2290e5028707095755d9c724eca482e52b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -9,7 +9,7 @@ describe Thegarage::Gitx::Cli::ReviewCommand do
|
|
9
9
|
pretend: true
|
10
10
|
}
|
11
11
|
end
|
12
|
-
let(:cli) {
|
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.
|
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-
|
11
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|