thorium 0.1.1 → 0.2.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/bin/thorium +29 -12
- data/lib/thorium.rb +29 -12
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20252bee2e328a24c6615c68f8f8abc14cacab00
|
4
|
+
data.tar.gz: ea4b7bbcb0e19778c1db0c4ef144bc3525166d0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08bf16d89a1b80708129f7f166a8f66ad2f90cb5869c94d6d0c0734d13c058bd8f6046cbcbcc66cfca620ba797ee43c28241299457a47f483e7a962d20b5fd00
|
7
|
+
data.tar.gz: a2e04d20c39a04ddd83e5dec67115c203dcb59212202c025e75fca8317f17fddf928ac8ae18501d316a1d928ccb56355ae7866c38e8dd36ac67323c783bbdec0
|
data/bin/thorium
CHANGED
@@ -40,24 +40,41 @@ module GitCLI
|
|
40
40
|
|
41
41
|
include Thor::Actions
|
42
42
|
|
43
|
+
@@gh_api_url = "https://api.github.com"
|
44
|
+
|
43
45
|
class_option :verbose, :type => :boolean, :default => 1
|
44
46
|
|
45
|
-
desc "list", "
|
47
|
+
desc "list", "Lists Github repositories"
|
46
48
|
def list
|
47
49
|
require 'json'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
require 'pp'
|
51
|
+
gh_uname = ask("Enter Github username: ")
|
52
|
+
puts "\nFetching Github repositories (#{gh_uname})..."
|
53
|
+
puts "------------------------------------------"
|
54
|
+
@repos = get_gh_repos(gh_uname).each_with_index.map do |e, i|
|
55
|
+
e.values_at("name", "ssh_url", "clone_url").unshift("[#{i+1}]")
|
56
|
+
end
|
57
|
+
print_table @repos
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "clone", "Clones a repository from the list"
|
61
|
+
def clone
|
62
|
+
list
|
63
|
+
index = ask("Which repository would you like to clone?", :limited_to => ("1".."#{@repos.size}").to_a).to_i
|
64
|
+
protocol = ask("Select a protocol (ssh or https)?", :limited_to => ["s", "h"])
|
65
|
+
url = protocol == "s" ? @repos[index-1][2] : @repos[index-1][3]
|
66
|
+
run("git clone #{url}")
|
59
67
|
end
|
60
68
|
|
69
|
+
no_commands {
|
70
|
+
def get_gh_repos(uname)
|
71
|
+
url = "#{@@gh_api_url}/users/#{uname}/repos"
|
72
|
+
gh_repos_filepath = ENV['HOME'] + "/.thorium/gh_repos_#{uname}.json"
|
73
|
+
get url, gh_repos_filepath, :verbose => false
|
74
|
+
JSON.parse File.read(gh_repos_filepath)
|
75
|
+
end
|
76
|
+
}
|
77
|
+
|
61
78
|
end
|
62
79
|
end
|
63
80
|
|
data/lib/thorium.rb
CHANGED
@@ -40,24 +40,41 @@ module GitCLI
|
|
40
40
|
|
41
41
|
include Thor::Actions
|
42
42
|
|
43
|
+
@@gh_api_url = "https://api.github.com"
|
44
|
+
|
43
45
|
class_option :verbose, :type => :boolean, :default => 1
|
44
46
|
|
45
|
-
desc "list", "
|
47
|
+
desc "list", "Lists Github repositories"
|
46
48
|
def list
|
47
49
|
require 'json'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
require 'pp'
|
51
|
+
gh_uname = ask("Enter Github username: ")
|
52
|
+
puts "\nFetching Github repositories (#{gh_uname})..."
|
53
|
+
puts "------------------------------------------"
|
54
|
+
@repos = get_gh_repos(gh_uname).each_with_index.map do |e, i|
|
55
|
+
e.values_at("name", "ssh_url", "clone_url").unshift("[#{i+1}]")
|
56
|
+
end
|
57
|
+
print_table @repos
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "clone", "Clones a repository from the list"
|
61
|
+
def clone
|
62
|
+
list
|
63
|
+
index = ask("Which repository would you like to clone?", :limited_to => ("1".."#{@repos.size}").to_a).to_i
|
64
|
+
protocol = ask("Select a protocol (ssh or https)?", :limited_to => ["s", "h"])
|
65
|
+
url = protocol == "s" ? @repos[index-1][2] : @repos[index-1][3]
|
66
|
+
run("git clone #{url}")
|
59
67
|
end
|
60
68
|
|
69
|
+
no_commands {
|
70
|
+
def get_gh_repos(uname)
|
71
|
+
url = "#{@@gh_api_url}/users/#{uname}/repos"
|
72
|
+
gh_repos_filepath = ENV['HOME'] + "/.thorium/gh_repos_#{uname}.json"
|
73
|
+
get url, gh_repos_filepath, :verbose => false
|
74
|
+
JSON.parse File.read(gh_repos_filepath)
|
75
|
+
end
|
76
|
+
}
|
77
|
+
|
61
78
|
end
|
62
79
|
end
|
63
80
|
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thorium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Stankevich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: Workflow automation gem
|
@@ -43,12 +43,12 @@ require_paths:
|
|
43
43
|
- lib
|
44
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|