File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,12 @@ class SourceFile < Thor
7
7
8
8
desc "fetch source files" , "fetch source files from GitHub"
9
9
def fetch
10
- filtered_tags = fetch_tags
10
+ account = ask ( "Which GitHub account's version do you want to fetch? (leave blank for default)" )
11
+ account = 'heelhook' if account . empty?
12
+ filtered_tags = fetch_tags ( account )
11
13
tag = select ( "Which tag do you want to fetch?" , filtered_tags )
12
14
self . destination_root = "app/assets"
13
- remote = "https://github.com/heelhook /chardin.js"
15
+ remote = "https://github.com/#{ account } /chardin.js"
14
16
get "#{ remote } /raw/#{ tag } /chardinjs.min.js" , "javascripts/chardinjs.js"
15
17
get "#{ remote } /raw/#{ tag } /chardinjs.css" , "stylesheets/chardinjs.css"
16
18
@@ -26,12 +28,12 @@ def fetch
26
28
27
29
private
28
30
29
- def fetch_tags
31
+ def fetch_tags ( account )
30
32
http = HTTPClient . new
31
- response = JSON . parse ( http . get ( "https://api.github.com/repos/heelhook /chardin.js/tags" ) . body )
33
+ response = JSON . parse ( http . get ( "https://api.github.com/repos/#{ account } /chardin.js/tags" ) . body )
32
34
response . map { |tag | tag [ "name" ] } . sort
33
35
end
34
-
36
+
35
37
def select msg , elements
36
38
elements . each_with_index do |element , index |
37
39
say ( block_given? ? yield ( element , index + 1 ) : ( "#{ index + 1 } . #{ element . to_s } " ) )
You can’t perform that action at this time.
0 commit comments