js-get 0.1.3 → 0.1.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.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/js-get +19 -13
- data/doc/classes/App.html +1 -1
- data/doc/classes/App.src/M000001.html +1 -1
- data/doc/classes/App.src/M000002.html +1 -1
- data/doc/classes/App.src/M000003.html +1 -1
- data/doc/classes/App.src/M000004.html +1 -1
- data/doc/classes/App.src/M000005.html +1 -1
- data/doc/classes/App.src/M000006.html +1 -1
- data/doc/classes/App.src/M000007.html +1 -1
- data/doc/classes/App.src/M000008.html +1 -1
- data/doc/classes/App.src/M000009.html +1 -1
- data/doc/classes/App.src/M000010.html +1 -1
- data/doc/classes/App.src/M000011.html +6 -2
- data/doc/classes/App.src/M000012.html +9 -8
- data/doc/classes/App.src/M000013.html +2 -2
- data/doc/classes/App.src/M000014.html +6 -5
- data/doc/classes/App.src/M000015.html +1 -1
- data/doc/created.rid +1 -1
- data/doc/files/bin/js-get.html +1 -1
- data/js-get.gemspec +26 -1
- metadata +1 -1
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/bin/js-get
CHANGED
@@ -41,7 +41,7 @@ require 'crack'
|
|
41
41
|
require 'fileutils'
|
42
42
|
|
43
43
|
class App
|
44
|
-
VERSION = '0.1.
|
44
|
+
VERSION = '0.1.4'
|
45
45
|
JSDIR = ENV['JSDIR'] || "public/javascripts"
|
46
46
|
HOST = ENV['JSGET_HOST'] || "http://js-get.jackhq.com"
|
47
47
|
|
@@ -133,21 +133,26 @@ class App
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def process_command
|
136
|
-
|
136
|
+
command = @arguments[0]
|
137
|
+
# Remove First Argument
|
138
|
+
@arguments.slice!(0)
|
139
|
+
|
140
|
+
send(command.to_sym)
|
137
141
|
|
138
142
|
#process_standard_input # [Optional]
|
139
143
|
end
|
140
144
|
|
141
145
|
def install
|
142
146
|
# Install Javascript
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
147
|
+
@arguments.each do |js_name|
|
148
|
+
puts "Installing Javascript - #{js_name}" if @options.verbose
|
149
|
+
jlib = Crack::JSON.parse(RestClient.get("#{HOST}/scripts/#{js_name}"))
|
150
|
+
FileUtils.mkpath(JSDIR)
|
151
|
+
File.open([JSDIR, "#{js_name}.js"].join('/'), 'w') do |f|
|
152
|
+
f.write(RestClient.get(jlib["src_url"]))
|
153
|
+
end
|
154
|
+
puts "Successfully Installed - #{js_name}" if @options.verbose
|
149
155
|
end
|
150
|
-
puts "Successfully Installed - #{js_name}" if @options.verbose
|
151
156
|
rescue
|
152
157
|
puts "Could not locate javascript library on #{HOST}"
|
153
158
|
end
|
@@ -161,10 +166,11 @@ class App
|
|
161
166
|
end
|
162
167
|
|
163
168
|
def uninstall
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
169
|
+
@arguments.each do |js_name|
|
170
|
+
puts "Removing Javascript - #{js_name}" if @options.verbose
|
171
|
+
FileUtils.rm [ [JSDIR,"#{js_name}.js"].join('/') ]
|
172
|
+
puts "Successfully removed javascript library - #{js_name}" if @options.verbose
|
173
|
+
end
|
168
174
|
rescue
|
169
175
|
puts "Could not remove javascript library"
|
170
176
|
end
|
data/doc/classes/App.html
CHANGED
@@ -120,7 +120,7 @@
|
|
120
120
|
<tr class="top-aligned-row context-row">
|
121
121
|
<td class="context-item-name">VERSION</td>
|
122
122
|
<td>=</td>
|
123
|
-
<td class="context-item-value">'0.
|
123
|
+
<td class="context-item-value">'0.1.4'</td>
|
124
124
|
</tr>
|
125
125
|
<tr class="top-aligned-row context-row">
|
126
126
|
<td class="context-item-name">JSDIR</td>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 50</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">arguments</span>, <span class="ruby-identifier">stdin</span>)
|
15
15
|
<span class="ruby-ivar">@arguments</span> = <span class="ruby-identifier">arguments</span>
|
16
16
|
<span class="ruby-ivar">@stdin</span> = <span class="ruby-identifier">stdin</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 62</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
|
15
15
|
|
16
16
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parsed_options?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">arguments_valid?</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 83</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parsed_options?</span>
|
15
15
|
|
16
16
|
<span class="ruby-comment cmt"># Specify options</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 100</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_options</span>
|
15
15
|
<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">quiet</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 104</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_options</span>
|
15
15
|
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Options:\n"</span>
|
16
16
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 113</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">arguments_valid?</span>
|
15
15
|
<span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">'install'</span>,<span class="ruby-value str">'list'</span>,<span class="ruby-value str">'uninstall'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-ivar">@arguments</span>[<span class="ruby-value">0</span>])
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 118</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_arguments</span>
|
15
15
|
<span class="ruby-comment cmt"># TO DO - place in local vars, etc</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 122</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_help</span>
|
15
15
|
<span class="ruby-identifier">output_version</span>
|
16
16
|
<span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-identifier">usage</span>() <span class="ruby-comment cmt">#exits app</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 127</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_usage</span>
|
15
15
|
<span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-identifier">usage</span>(<span class="ruby-value str">'usage'</span>) <span class="ruby-comment cmt"># gets usage from comments above</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 131</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_version</span>
|
15
15
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{File.basename(__FILE__)} version #{VERSION}"</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,9 +10,13 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 135</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_command</span>
|
15
|
-
<span class="ruby-identifier">
|
15
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-ivar">@arguments</span>[<span class="ruby-value">0</span>]
|
16
|
+
<span class="ruby-comment cmt"># Remove First Argument</span>
|
17
|
+
<span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
|
18
|
+
|
19
|
+
<span class="ruby-identifier">send</span>(<span class="ruby-identifier">command</span>.<span class="ruby-identifier">to_sym</span>)
|
16
20
|
|
17
21
|
<span class="ruby-comment cmt">#process_standard_input # [Optional]</span>
|
18
22
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,17 +10,18 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 145</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">install</span>
|
15
15
|
<span class="ruby-comment cmt"># Install Javascript</span>
|
16
|
-
<span class="ruby-identifier">
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
<span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">js_name</span><span class="ruby-operator">|</span>
|
17
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Installing Javascript - #{js_name}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">verbose</span>
|
18
|
+
<span class="ruby-identifier">jlib</span> = <span class="ruby-constant">Crack</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"#{HOST}/scripts/#{js_name}"</span>))
|
19
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkpath</span>(<span class="ruby-constant">JSDIR</span>)
|
20
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>([<span class="ruby-constant">JSDIR</span>, <span class="ruby-node">"#{js_name}.js"</span>].<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>), <span class="ruby-value str">'w'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
21
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">jlib</span>[<span class="ruby-value str">"src_url"</span>]))
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Successfully Installed - #{js_name}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">verbose</span>
|
22
24
|
<span class="ruby-keyword kw">end</span>
|
23
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Successfully Installed - #{js_name}"</span>
|
24
25
|
<span class="ruby-keyword kw">rescue</span>
|
25
26
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Could not locate javascript library on #{HOST}"</span>
|
26
27
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 160</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>
|
15
15
|
<span class="ruby-comment cmt"># List Libraries</span>
|
16
|
-
<span class="ruby-identifier">libraries</span> = <span class="ruby-constant">Crack</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"#{HOST}/scripts"</span>))
|
16
|
+
<span class="ruby-identifier">libraries</span> = <span class="ruby-constant">Crack</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">RestClient</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"#{HOST}/scripts.json"</span>))
|
17
17
|
<span class="ruby-identifier">libraries</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
|
18
18
|
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">lib</span>[<span class="ruby-value str">"name"</span>]
|
19
19
|
<span class="ruby-keyword kw">end</span>
|
@@ -10,12 +10,13 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 168</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uninstall</span>
|
15
|
-
<span class="ruby-identifier">
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
<span class="ruby-ivar">@arguments</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">js_name</span><span class="ruby-operator">|</span>
|
16
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Removing Javascript - #{js_name}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">verbose</span>
|
17
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span> [ [<span class="ruby-constant">JSDIR</span>,<span class="ruby-node">"#{js_name}.js"</span>].<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>) ]
|
18
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Successfully removed javascript library - #{js_name}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">verbose</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
19
20
|
<span class="ruby-keyword kw">rescue</span>
|
20
21
|
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Could not remove javascript library"</span>
|
21
22
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File bin/js-get, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File bin/js-get, line 178</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_standard_input</span>
|
15
15
|
<span class="ruby-identifier">input</span> = <span class="ruby-ivar">@stdin</span>.<span class="ruby-identifier">read</span>
|
16
16
|
<span class="ruby-comment cmt"># TO DO - process input</span>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Thu, 22 Oct 2009
|
1
|
+
Thu, 22 Oct 2009 11:21:28 -0400
|
data/doc/files/bin/js-get.html
CHANGED
data/js-get.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{js-get}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tom Wilson"]
|
@@ -25,6 +25,31 @@ Gem::Specification.new do |s|
|
|
25
25
|
"README.rdoc",
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
|
+
"bin/js-get",
|
29
|
+
"doc/classes/App.html",
|
30
|
+
"doc/classes/App.src/M000001.html",
|
31
|
+
"doc/classes/App.src/M000002.html",
|
32
|
+
"doc/classes/App.src/M000003.html",
|
33
|
+
"doc/classes/App.src/M000004.html",
|
34
|
+
"doc/classes/App.src/M000005.html",
|
35
|
+
"doc/classes/App.src/M000006.html",
|
36
|
+
"doc/classes/App.src/M000007.html",
|
37
|
+
"doc/classes/App.src/M000008.html",
|
38
|
+
"doc/classes/App.src/M000009.html",
|
39
|
+
"doc/classes/App.src/M000010.html",
|
40
|
+
"doc/classes/App.src/M000011.html",
|
41
|
+
"doc/classes/App.src/M000012.html",
|
42
|
+
"doc/classes/App.src/M000013.html",
|
43
|
+
"doc/classes/App.src/M000014.html",
|
44
|
+
"doc/classes/App.src/M000015.html",
|
45
|
+
"doc/created.rid",
|
46
|
+
"doc/files/bin/js-get.html",
|
47
|
+
"doc/fr_class_index.html",
|
48
|
+
"doc/fr_file_index.html",
|
49
|
+
"doc/fr_method_index.html",
|
50
|
+
"doc/index.html",
|
51
|
+
"doc/rdoc-style.css",
|
52
|
+
"js-get.gemspec",
|
28
53
|
"lib/js-get.rb",
|
29
54
|
"test/helper.rb",
|
30
55
|
"test/test_js-get.rb"
|