github-tv 0.3 → 0.4
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/README.md +7 -1
- data/bin/github-tv +35 -7
- data/github-tv.gemspec +1 -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: 327ec5b7370f80ce65cdd1e4773ae61ad3218c5d
|
4
|
+
data.tar.gz: efa2e8f9e11dbc5c04f3563153541abcfa9eb37a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63f4c41fc5f3f5e0ffc5025741b6d009f87c94c3ecb33db4b3bb73033a647c50a777749b4cc709d2fab86bf930843935bb6aff80f7b7bdc07fdc59baeaddb645
|
7
|
+
data.tar.gz: 436a344a4559f89361456acecabc685fe654311de9c4e7424106966e5d23ae4b376146a34a014d4dfbfdb0d447fbf8880afd564f1b112c678b0fdc220b4479a9
|
data/README.md
CHANGED
@@ -19,9 +19,15 @@ repos:
|
|
19
19
|
- user2/repo2
|
20
20
|
```
|
21
21
|
|
22
|
+
Optionally, you can set default path/url to config file.
|
23
|
+
|
24
|
+
```bash
|
25
|
+
git config --global github.tv.config *path/url for config*
|
26
|
+
```
|
27
|
+
|
22
28
|
## Contributors
|
23
29
|
|
24
|
-
* @gazay, @brainopia
|
30
|
+
* @gazay, @brainopia, @igas, @aderyabin
|
25
31
|
|
26
32
|
## License
|
27
33
|
|
data/bin/github-tv
CHANGED
@@ -4,10 +4,34 @@ require_relative '../lib/github-tv'
|
|
4
4
|
require 'io/console'
|
5
5
|
require 'open-uri'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
def create_token(client, tfa=nil)
|
8
|
+
opts = {
|
9
|
+
scopes: ['public_repo'],
|
10
|
+
note: "github-tv #{Time.now}",
|
11
|
+
note_url: 'https://github.com/evilmartians/github-tv'
|
12
|
+
}
|
13
|
+
opts.merge!(headers: { 'X-GitHub-OTP' => tfa }) if tfa
|
14
|
+
client.create_authorization opts
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
config_location = ARGV.shift
|
21
|
+
config_location ||= `git config github.tv.config`.chomp
|
9
22
|
|
10
|
-
|
23
|
+
abort 'Missing path/url for config file' if config_location.empty?
|
24
|
+
|
25
|
+
begin
|
26
|
+
config = YAML.load open config_location
|
27
|
+
rescue Errno::ENOENT
|
28
|
+
abort 'Incorrect path to config file'
|
29
|
+
rescue Psych::SyntaxError
|
30
|
+
abort 'Config file format is not YAML'
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
token = `git config github.tv.token`.chomp
|
11
35
|
|
12
36
|
if token.empty?
|
13
37
|
puts 'Please authenticate yourself to create a token for further usage.'
|
@@ -23,12 +47,16 @@ if token.empty?
|
|
23
47
|
login: username,
|
24
48
|
password: password
|
25
49
|
|
26
|
-
response =
|
27
|
-
|
28
|
-
|
50
|
+
response = begin
|
51
|
+
create_token(client)
|
52
|
+
rescue Octokit::OneTimePasswordRequired
|
53
|
+
print 'Two-factor authentication code: '
|
54
|
+
tfa = gets.chomp
|
55
|
+
create_token(client, tfa)
|
56
|
+
end
|
29
57
|
|
30
58
|
token = response.token
|
31
|
-
`git config --global github.tv #{token}`
|
59
|
+
`git config --global github.tv.token #{token}`
|
32
60
|
end
|
33
61
|
|
34
62
|
config['token'] = token
|
data/github-tv.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-tv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brainopia
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|