ghi 0.9.0.20130504 → 0.9.0.20130912
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ghi/authorization.rb +18 -4
- data/lib/ghi/client.rb +2 -1
- data/lib/ghi/commands/command.rb +1 -1
- data/lib/ghi/commands/list.rb +1 -0
- data/lib/ghi/commands/version.rb +1 -1
- data/lib/ghi/formatting/colors.rb +1 -1
- data/lib/ghi/web.rb +3 -1
- metadata +47 -61
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e0c68ea7d989b5a9f84393182ce31fc1aa3225d0
|
4
|
+
data.tar.gz: 4703a58daeadacc4fe7eeb14634707e1689af384
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9285c3ef1ba18302d364ba8690c42bf9f4bd0861ae3c16c57a86dd372e6e958058c6a9b3b4182df3cbde206778a6c1307c3516d7cb5e808ebefc3a18b1219d9f
|
7
|
+
data.tar.gz: 0a48d81eaae90de2a27a5bf6ff60ac58de04f709638ae3111196e978fd33db416f30b2255b7e33e0cd3ec04551ed770c69ce10832f8a7f40732d9a586977e45b
|
data/lib/ghi/authorization.rb
CHANGED
@@ -16,13 +16,18 @@ module GHI
|
|
16
16
|
|
17
17
|
def authorize! user = username, pass = password, local = true
|
18
18
|
return false unless user && pass
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
code ||= nil # 2fa
|
20
|
+
args = code ? [] : [54, "✔\r"]
|
21
|
+
res = throb(*args) {
|
22
|
+
headers = {}
|
23
|
+
headers['X-GitHub-OTP'] = code if code
|
24
|
+
body = {
|
23
25
|
:scopes => %w(public_repo repo),
|
24
26
|
:note => 'ghi',
|
25
27
|
:note_url => 'https://github.com/stephencelis/ghi'
|
28
|
+
}
|
29
|
+
Client.new(user, pass).post(
|
30
|
+
'/authorizations', body, :headers => headers
|
26
31
|
)
|
27
32
|
}
|
28
33
|
@token = res.body['token']
|
@@ -50,6 +55,15 @@ EOF
|
|
50
55
|
end
|
51
56
|
end
|
52
57
|
rescue Client::Error => e
|
58
|
+
if e.response['X-GitHub-OTP'] =~ /required/
|
59
|
+
puts "Bad code." if code
|
60
|
+
print "Two-factor authentication code: "
|
61
|
+
trap('INT') { abort }
|
62
|
+
code = gets
|
63
|
+
code = '' and puts "\n" unless code
|
64
|
+
retry
|
65
|
+
end
|
66
|
+
|
53
67
|
abort "#{e.message}#{CURSOR[:column][0]}"
|
54
68
|
end
|
55
69
|
|
data/lib/ghi/client.rb
CHANGED
@@ -102,7 +102,8 @@ module GHI
|
|
102
102
|
path += "?#{q.join '&'}"
|
103
103
|
end
|
104
104
|
|
105
|
-
headers =
|
105
|
+
headers = options.fetch :headers, {}
|
106
|
+
headers.update 'Accept' => CONTENT_TYPE, 'User-Agent' => USER_AGENT
|
106
107
|
req = METHODS[method].new path, headers
|
107
108
|
if GHI::Authorization.token
|
108
109
|
req['Authorization'] = "token #{GHI::Authorization.token}"
|
data/lib/ghi/commands/command.rb
CHANGED
data/lib/ghi/commands/list.rb
CHANGED
data/lib/ghi/commands/version.rb
CHANGED
data/lib/ghi/web.rb
CHANGED
@@ -12,7 +12,9 @@ module GHI
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def open path = '', params = {}
|
15
|
-
|
15
|
+
launcher = 'open'
|
16
|
+
launcher = 'xdg-open' if /linux/ =~ RUBY_PLATFORM
|
17
|
+
system "#{launcher} '#{uri_for path, params}'"
|
16
18
|
end
|
17
19
|
|
18
20
|
def curl path = '', params = {}
|
metadata
CHANGED
@@ -1,58 +1,51 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 0
|
9
|
-
- 20130504
|
10
|
-
version: 0.9.0.20130504
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0.20130912
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Stephen Celis
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-09-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: rake
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
31
20
|
type: :development
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: ronn
|
35
21
|
prerelease: false
|
36
|
-
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
|
42
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ronn
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
43
34
|
type: :development
|
44
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
45
41
|
description: |
|
46
42
|
GitHub Issues on the command line. Use your `$EDITOR`, not your browser.
|
47
|
-
|
48
43
|
email: stephen@stephencelis.com
|
49
|
-
executables:
|
44
|
+
executables:
|
50
45
|
- ghi
|
51
46
|
extensions: []
|
52
|
-
|
53
47
|
extra_rdoc_files: []
|
54
|
-
|
55
|
-
files:
|
48
|
+
files:
|
56
49
|
- lib/ghi/authorization.rb
|
57
50
|
- lib/ghi/client.rb
|
58
51
|
- lib/ghi/commands/assign.rb
|
@@ -75,35 +68,28 @@ files:
|
|
75
68
|
- lib/ghi/json.rb
|
76
69
|
- lib/ghi/web.rb
|
77
70
|
- lib/ghi.rb
|
78
|
-
|
71
|
+
- bin/ghi
|
79
72
|
homepage: https://github.com/stephencelis/ghi
|
80
73
|
licenses: []
|
81
|
-
|
74
|
+
metadata: {}
|
82
75
|
post_install_message:
|
83
76
|
rdoc_options: []
|
84
|
-
|
85
|
-
require_paths:
|
77
|
+
require_paths:
|
86
78
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
version: "0"
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
101
89
|
requirements: []
|
102
|
-
|
103
90
|
rubyforge_project:
|
104
|
-
rubygems_version:
|
91
|
+
rubygems_version: 2.0.3
|
105
92
|
signing_key:
|
106
|
-
specification_version:
|
93
|
+
specification_version: 4
|
107
94
|
summary: GitHub Issues command line interface
|
108
95
|
test_files: []
|
109
|
-
|