git-ready 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/git-ready.gemspec +2 -2
- data/lib/git-ready/interactive_setup.rb +15 -6
- 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: 966c34169e7fd69941e39a8aa2549ee3c84c76ef
|
4
|
+
data.tar.gz: 453f3fc5ec32f530836024d2ac906a727b006b23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0875e5b3844c0f2c9b7b2e53648f47b504d3dd5e89cb53bd8ba1d493885bd0388ad7084f3994855a46f3d20d288032534a5a0134778bffd38fd92785fe10cf
|
7
|
+
data.tar.gz: f6f38ba3859d563b1819e6bacd396e1688b8d2b3e0c79466109694c447f11f1ad00603c299ef792f0bff3462f256902dae8dc1c9daaed5f71215475c9eca9e84
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.4
|
data/git-ready.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: git-ready 0.8.
|
5
|
+
# stub: git-ready 0.8.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "git-ready"
|
9
|
-
s.version = "0.8.
|
9
|
+
s.version = "0.8.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -51,20 +51,29 @@ module InteractiveSetup
|
|
51
51
|
def self.setup
|
52
52
|
Announce.info 'If you leave this blank, git-ready will do most of the work for you. As a fallback, you can generate your own at https://github.com/settings/tokens/new'
|
53
53
|
token = ask 'Enter your GitHub Personal Access Token:', String
|
54
|
-
|
55
|
-
token if
|
54
|
+
generated = guided_generation if token.empty?
|
55
|
+
token = generated[:token] if generated
|
56
|
+
token_works?(token) ? token : setup
|
56
57
|
end
|
57
58
|
|
58
59
|
def self.guided_generation
|
59
|
-
|
60
|
-
password = ask('Enter your GitHub password:') { |c| c.echo = '*' }
|
61
|
-
generate login, password
|
60
|
+
generate ask_login, ask_password
|
62
61
|
rescue Octokit::OneTimePasswordRequired
|
63
62
|
Announce.info 'Your account has 2-Factor Authentication enabled. Awesome!'
|
64
63
|
headers = { 'X-GitHub-OTP' => ask('Enter a valid 2-Factor Auth Token') }
|
65
64
|
generate login, password, headers
|
66
65
|
end
|
67
66
|
|
67
|
+
def self.ask_login
|
68
|
+
login = ask('Enter your GitHub login:')
|
69
|
+
login.empty? ? ask_login : login
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.ask_password
|
73
|
+
password = ask('Enter your GitHub password:') { |c| c.echo = '*' }
|
74
|
+
password.empty? ? ask_password : password
|
75
|
+
end
|
76
|
+
|
68
77
|
def self.generate(login, password, headers = {}, first_attempt = true)
|
69
78
|
github = Octokit::Client.new login: login, password: password
|
70
79
|
github.create_authorization(note: 'git-ready',
|
@@ -93,7 +102,7 @@ module InteractiveSetup
|
|
93
102
|
end
|
94
103
|
end
|
95
104
|
|
96
|
-
def self.
|
105
|
+
def self.token_works?(token)
|
97
106
|
github = Octokit::Client.new access_token: token
|
98
107
|
true if github.repos
|
99
108
|
rescue Octokit::Unauthorized
|