ghs 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ghs +5 -5
- metadata +6 -6
data/bin/ghs
CHANGED
@@ -15,32 +15,32 @@ use_contracts self
|
|
15
15
|
|
16
16
|
Repo = Or[Hash, nil]
|
17
17
|
|
18
|
-
Contract String
|
18
|
+
Contract nil => String
|
19
19
|
def find_user
|
20
20
|
x = `git config github.user`
|
21
21
|
x.chomp
|
22
22
|
end
|
23
23
|
|
24
|
-
Contract String
|
24
|
+
Contract String => Repo
|
25
25
|
def req(url)
|
26
26
|
JSON.parse(open("https://api.github.com#{url}").read)
|
27
27
|
rescue OpenURI::HTTPError => e
|
28
28
|
nil
|
29
29
|
end
|
30
30
|
|
31
|
-
Contract String, String
|
31
|
+
Contract String, String => Repo
|
32
32
|
def get_repo(user, repo)
|
33
33
|
req "/repos/#{user}/#{repo}"
|
34
34
|
end
|
35
35
|
|
36
|
-
Contract String
|
36
|
+
Contract String => Repo
|
37
37
|
def find_user_repo(repo)
|
38
38
|
user = find_user
|
39
39
|
return nil if user == ""
|
40
40
|
get_repo(user, repo)
|
41
41
|
end
|
42
42
|
|
43
|
-
Contract String
|
43
|
+
Contract String => Repo
|
44
44
|
def find_generic_repo(repo)
|
45
45
|
results = req "/legacy/repos/search/#{repo}"
|
46
46
|
Trollop::die "Couldn't find a url" if results["repositories"].empty?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aditya Bhargava
|
@@ -40,12 +40,12 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 13
|
44
44
|
segments:
|
45
45
|
- 0
|
46
46
|
- 0
|
47
|
-
-
|
48
|
-
version: 0.0.
|
47
|
+
- 9
|
48
|
+
version: 0.0.9
|
49
49
|
type: :runtime
|
50
50
|
version_requirements: *id002
|
51
51
|
description: Find the clone url for repos on Github
|