rgist 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rgist/content.rb +11 -2
- data/lib/rgist/version.rb +1 -1
- 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: b420fb9c9887a6add868a5de29364499711fb831
|
4
|
+
data.tar.gz: 6ad40039937f8f7437cd079f288093ba311061fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34f2c59811ca44632fcc7309d6e4ab4ed8d9bcd2f8b34b69c08bf470160fc6b14f5c134c42fabc6a0d188b20b7b39a3c5a81f9683a4b71f6a288b202a7a5f794
|
7
|
+
data.tar.gz: c2136971839a894e6c9ed3b1dc1534d8799bb68c383ff53faaa9d94e20033c89ee5bd5a06758ecbd585974a72030ab5ca4a625cb78ededebad5726d7a19307aa
|
data/lib/rgist/content.rb
CHANGED
@@ -5,19 +5,24 @@ module Gist
|
|
5
5
|
|
6
6
|
def get(user, file)
|
7
7
|
begin
|
8
|
-
response =
|
8
|
+
response = curl(PATH % user)
|
9
9
|
json = JSON.parse(response)
|
10
10
|
|
11
11
|
result = nil
|
12
12
|
|
13
13
|
json.each do |gist|
|
14
14
|
files = gist['files']
|
15
|
+
|
15
16
|
if files.keys.include?(file)
|
16
17
|
result = files[file]['raw_url']
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
if result
|
22
|
+
puts curl(result)
|
23
|
+
else
|
24
|
+
# Raise content not found
|
25
|
+
end
|
21
26
|
rescue Exception => exception
|
22
27
|
raise exception
|
23
28
|
end
|
@@ -25,6 +30,10 @@ module Gist
|
|
25
30
|
|
26
31
|
private
|
27
32
|
|
33
|
+
def curl(path)
|
34
|
+
execute("curl #{path}")
|
35
|
+
end
|
36
|
+
|
28
37
|
def execute(cmd)
|
29
38
|
response = nil
|
30
39
|
|
data/lib/rgist/version.rb
CHANGED