travis 1.8.5.travis.791.4 → 1.8.5.travis.793.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/travis/tools/github.rb +4 -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: 6dcbe6853f772d517c4bbeafdea807282dbd6ae9
|
4
|
+
data.tar.gz: 770a0b2eafb71771b8d265984bb271a91187d585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5485df7392197b479026138827d0f175d8d1f2362e25258502804586ad0acf4593bdca44c29ab60f5c926a795e223dc6a0b9cb986fe0ce7fb56463456f5818d
|
7
|
+
data.tar.gz: 063724a0e9c1bfbcbdff83cb2b12e5050fd44173e9fb2feb0dfe811ddfaf23c49a047b64c52ea500f3701f008e6e4d4d7a6069c9893b0e54cc219dae6abeec9c
|
data/lib/travis/tools/github.rb
CHANGED
@@ -38,7 +38,7 @@ module Travis
|
|
38
38
|
|
39
39
|
def with_basic_auth(&block)
|
40
40
|
user, password = ask_credentials
|
41
|
-
basic_auth(user, password, true) do |gh|
|
41
|
+
basic_auth(user, password, true) do |gh, _|
|
42
42
|
gh['user'] # so otp kicks in
|
43
43
|
yield gh
|
44
44
|
end
|
@@ -212,10 +212,10 @@ module Travis
|
|
212
212
|
end
|
213
213
|
|
214
214
|
def login(user, password, die = true, otp = nil)
|
215
|
-
basic_auth(user, password, die, otp) do |gh|
|
215
|
+
basic_auth(user, password, die, otp) do |gh, new_otp|
|
216
216
|
reply = create_token(gh)
|
217
217
|
auth_href = reply['_links']['self']['href']
|
218
|
-
self.callback = proc { with_otp(gh, user,
|
218
|
+
self.callback = proc { with_otp(gh, user, new_otp) { |g| g.delete(auth_href) } } if drop_token
|
219
219
|
reply['token']
|
220
220
|
end
|
221
221
|
end
|
@@ -232,7 +232,7 @@ module Travis
|
|
232
232
|
|
233
233
|
def with_otp(gh, user, otp, &block)
|
234
234
|
gh = GH.with(gh.options.merge(:headers => { "X-GitHub-OTP" => otp })) if otp
|
235
|
-
block.call(gh)
|
235
|
+
block.call(gh, otp)
|
236
236
|
rescue GH::Error => error
|
237
237
|
raise error unless error.info[:response_status] == 401 and error.info[:response_headers]['x-github-otp'].to_s =~ /required/
|
238
238
|
otp = ask_otp.arity == 0 ? ask_otp.call : ask_otp.call(user)
|