radiant-ray-extension 3.0.0.alpha → 3.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/Rakefile +2 -0
- data/doc/NilClass.html +178 -0
- data/doc/Ray/CLI.html +211 -197
- data/doc/Ray/Extension/Git.html +435 -0
- data/doc/Ray/Extension/RubyGem.html +858 -0
- data/doc/Ray/Extension/Zip.html +453 -0
- data/doc/Ray/Extension.html +755 -0
- data/doc/Ray/{Cache.html → Search/Cache.html} +108 -256
- data/doc/Ray/{GitHub.html → Search/GitHub.html} +167 -81
- data/doc/Ray/{RubyGems.html → Search/RubyGems.html} +118 -68
- data/doc/Ray/Search.html +822 -0
- data/doc/Ray.html +89 -34
- data/doc/String.html +99 -29
- data/doc/_index.html +1 -1
- data/doc/file.LICENSE.html +1 -1
- data/doc/file.README.html +2 -4
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +3 -3
- data/lib/ray/cli.rb +146 -193
- data/lib/ray/constants.rb +7 -12
- data/lib/ray/extension.rb +203 -89
- data/lib/ray/search.rb +198 -43
- data/lib/ray/utility.rb +31 -0
- data/lib/ray.rb +2 -7
- data/spec/fixtures/cache_single.yml +2 -1
- data/spec/fixtures/cassettes/combined_search_empty.yml +71 -0
- data/spec/fixtures/cassettes/combined_search_multiple.yml +264 -0
- data/spec/fixtures/cassettes/combined_search_single.yml +108 -0
- data/spec/fixtures/cassettes/github_reorder_children_zip_file.yml +487 -0
- data/spec/fixtures/cassettes/github_sitemap_xml_zip_file.yml +553 -0
- data/spec/fixtures/cassettes/{github_v2_api_no_matches.yml → github_v2_search_empty.yml} +3 -3
- data/spec/fixtures/cassettes/github_v2_search_multiple.yml +225 -0
- data/spec/fixtures/cassettes/github_v2_search_single.yml +76 -0
- data/spec/fixtures/cassettes/{zip_file.yml → github_zip_file.yml} +3 -3
- data/spec/fixtures/cassettes/{rubygems_v1_api_gem_info.yml → rubygems_v1_gem_info.yml} +5 -5
- data/spec/fixtures/cassettes/{rubygems_v1_api_no_matches.yml → rubygems_v1_search_empty.yml} +3 -3
- data/spec/fixtures/cassettes/rubygems_v1_search_multiple.yml +40 -0
- data/spec/fixtures/cassettes/{rubygems_v1_api_search_reorder_children.yml → rubygems_v1_search_single.yml} +6 -6
- data/spec/fixtures/dummy.zip +0 -0
- data/spec/ray/extension_spec.rb +172 -0
- data/spec/ray/search_spec.rb +300 -0
- data/spec/spec_helper.rb +36 -9
- metadata +50 -85
- data/doc/Extension.html +0 -1189
- data/doc/Ray/Gem.html +0 -760
- data/doc/Ray/Git.html +0 -278
- data/doc/Ray/Zip.html +0 -300
- data/doc/Search.html +0 -433
- data/lib/ray/extension/gem.rb +0 -96
- data/lib/ray/extension/git.rb +0 -30
- data/lib/ray/extension/zip.rb +0 -44
- data/lib/ray/search/cache.rb +0 -61
- data/lib/ray/search/github.rb +0 -40
- data/lib/ray/search/rubygems.rb +0 -36
- data/lib/ray/string.rb +0 -18
- data/spec/fixtures/Gemfile +0 -4
- data/spec/fixtures/cassettes/github_v2_api_search_no_matches.yml +0 -38
- data/spec/fixtures/cassettes/github_v2_api_search_reorder_children.yml +0 -75
- data/spec/fixtures/cassettes/github_v2_api_search_single.yml +0 -74
- data/spec/fixtures/cassettes/github_v3_api_owner_name.yml +0 -75
- data/spec/fixtures/cassettes/rubygems_v1_api_search_no_matches.yml +0 -34
- data/spec/fixtures/cassettes/rubygems_v1_api_search_reorder.yml +0 -36
- data/spec/fixtures/cassettes/rubygems_v1_api_search_single.yml +0 -41
- data/spec/fixtures/dummy/README +0 -1
- data/spec/fixtures/dummy/Rakefile +0 -109
- data/spec/fixtures/dummy/config/initializers/radiant_config.rb +0 -3
- data/spec/fixtures/dummy/config/locales/en.yml +0 -3
- data/spec/fixtures/dummy/config/routes.rb +0 -5
- data/spec/fixtures/dummy/dummy_extension.rb +0 -21
- data/spec/fixtures/dummy/lib/radiant-dummy-extension.rb +0 -8
- data/spec/fixtures/dummy/lib/tasks/dummy_extension_tasks.rake +0 -47
- data/spec/fixtures/dummy/public/stylesheets/extensions/dummy/dummy.css +0 -0
- data/spec/fixtures/dummy/radiant-dummy-extension.gemspec +0 -29
- data/spec/ray/extension/gem_spec.rb +0 -214
- data/spec/ray/extension/git_spec.rb +0 -216
- data/spec/ray/extension/zip_spec.rb +0 -239
- data/spec/ray/search/cache_spec.rb +0 -74
- data/spec/ray/search/github_spec.rb +0 -137
- data/spec/ray/search/rubygems_spec.rb +0 -127
- data/spec/ray/string_spec.rb +0 -30
data/doc/Search.html
DELETED
@@ -1,433 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Module: Search
|
8
|
-
|
9
|
-
— Documentation by YARD 0.7.3
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
relpath = '';
|
19
|
-
if (relpath != '') relpath += '/';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
-
|
26
|
-
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
|
-
<div id="header">
|
34
|
-
<div id="menu">
|
35
|
-
|
36
|
-
<a href="_index.html">Index (S)</a> »
|
37
|
-
|
38
|
-
|
39
|
-
<span class="title">Search</span>
|
40
|
-
|
41
|
-
|
42
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<div id="search">
|
46
|
-
|
47
|
-
<a id="class_list_link" href="#">Class List</a>
|
48
|
-
|
49
|
-
<a id="method_list_link" href="#">Method List</a>
|
50
|
-
|
51
|
-
<a id="file_list_link" href="#">File List</a>
|
52
|
-
|
53
|
-
</div>
|
54
|
-
<div class="clear"></div>
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<iframe id="search_frame"></iframe>
|
58
|
-
|
59
|
-
<div id="content"><h1>Module: Search
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</h1>
|
64
|
-
|
65
|
-
<dl class="box">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<dt class="r1">Included in:</dt>
|
74
|
-
<dd class="r1"><span class='object_link'><a href="Ray/Cache.html" title="Ray::Cache (class)">Ray::Cache</a></span>, <span class='object_link'><a href="Ray/GitHub.html" title="Ray::GitHub (class)">Ray::GitHub</a></span>, <span class='object_link'><a href="Ray/RubyGems.html" title="Ray::RubyGems (class)">Ray::RubyGems</a></span></dd>
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
<dt class="r2 last">Defined in:</dt>
|
79
|
-
<dd class="r2 last">lib/ray/search.rb</dd>
|
80
|
-
|
81
|
-
</dl>
|
82
|
-
<div class="clear"></div>
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
<h2>
|
91
|
-
Instance Method Summary
|
92
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
93
|
-
</h2>
|
94
|
-
|
95
|
-
<ul class="summary">
|
96
|
-
|
97
|
-
<li class="public ">
|
98
|
-
<span class="summary_signature">
|
99
|
-
|
100
|
-
<a href="#cache-instance_method" title="#cache (instance method)">- (Object) <strong>cache</strong> </a>
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
</span>
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<span class="summary_desc"><div class='inline'>
|
114
|
-
</div></span>
|
115
|
-
|
116
|
-
</li>
|
117
|
-
|
118
|
-
|
119
|
-
<li class="public ">
|
120
|
-
<span class="summary_signature">
|
121
|
-
|
122
|
-
<a href="#merge-instance_method" title="#merge (instance method)">- (Object) <strong>merge</strong>(other) </a>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
</span>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<span class="summary_desc"><div class='inline'>
|
136
|
-
</div></span>
|
137
|
-
|
138
|
-
</li>
|
139
|
-
|
140
|
-
|
141
|
-
<li class="public ">
|
142
|
-
<span class="summary_signature">
|
143
|
-
|
144
|
-
<a href="#multiple_choice-instance_method" title="#multiple_choice (instance method)">- (Object) <strong>multiple_choice</strong> </a>
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
</span>
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
<span class="summary_desc"><div class='inline'>
|
158
|
-
</div></span>
|
159
|
-
|
160
|
-
</li>
|
161
|
-
|
162
|
-
|
163
|
-
<li class="public ">
|
164
|
-
<span class="summary_signature">
|
165
|
-
|
166
|
-
<a href="#output-instance_method" title="#output (instance method)">- (Object) <strong>output</strong> </a>
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
</span>
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
<span class="summary_desc"><div class='inline'>
|
180
|
-
</div></span>
|
181
|
-
|
182
|
-
</li>
|
183
|
-
|
184
|
-
|
185
|
-
<li class="public ">
|
186
|
-
<span class="summary_signature">
|
187
|
-
|
188
|
-
<a href="#search-instance_method" title="#search (instance method)">- (Object) <strong>search</strong> </a>
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
</span>
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
<span class="summary_desc"><div class='inline'>
|
202
|
-
</div></span>
|
203
|
-
|
204
|
-
</li>
|
205
|
-
|
206
|
-
|
207
|
-
</ul>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
<div id="instance_method_details" class="method_details_list">
|
213
|
-
<h2>Instance Method Details</h2>
|
214
|
-
|
215
|
-
|
216
|
-
<div class="method_details first">
|
217
|
-
<p class="signature first" id="cache-instance_method">
|
218
|
-
|
219
|
-
- (<tt>Object</tt>) <strong>cache</strong>
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
</p><table class="source_code">
|
224
|
-
<tr>
|
225
|
-
<td>
|
226
|
-
<pre class="lines">
|
227
|
-
|
228
|
-
|
229
|
-
13
|
230
|
-
14
|
231
|
-
15
|
232
|
-
16
|
233
|
-
17
|
234
|
-
18
|
235
|
-
19
|
236
|
-
20
|
237
|
-
21
|
238
|
-
22
|
239
|
-
23
|
240
|
-
24
|
241
|
-
25</pre>
|
242
|
-
</td>
|
243
|
-
<td>
|
244
|
-
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 13</span>
|
245
|
-
|
246
|
-
<span class='kw'>def</span> <span class='id cache'>cache</span>
|
247
|
-
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id exist?'>exist?</span> <span class='const'>Ray</span><span class='op'>::</span><span class='const'>CACHE</span>
|
248
|
-
<span class='id cache'>cache</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id load_file'>load_file</span> <span class='const'>Ray</span><span class='op'>::</span><span class='const'>CACHE</span>
|
249
|
-
<span class='kw'>else</span>
|
250
|
-
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id mkdir_p'>mkdir_p</span> <span class='const'>Ray</span><span class='op'>::</span><span class='const'>RAY</span>
|
251
|
-
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id touch'>touch</span> <span class='const'>Ray</span><span class='op'>::</span><span class='const'>CACHE</span>
|
252
|
-
<span class='id cache'>cache</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
253
|
-
<span class='kw'>end</span>
|
254
|
-
<span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span> <span class='const'>Ray</span><span class='op'>::</span><span class='const'>CACHE</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</span><span class='tstring_end'>"</span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span>
|
255
|
-
<span class='id f'>f</span><span class='period'>.</span><span class='id write'>write</span> <span class='id cache'>cache</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@results</span><span class='rparen'>)</span><span class='period'>.</span><span class='id to_yaml'>to_yaml</span>
|
256
|
-
<span class='kw'>end</span>
|
257
|
-
<span class='kw'>return</span> <span class='kw'>self</span>
|
258
|
-
<span class='kw'>end</span></pre>
|
259
|
-
</td>
|
260
|
-
</tr>
|
261
|
-
</table>
|
262
|
-
</div>
|
263
|
-
|
264
|
-
<div class="method_details ">
|
265
|
-
<p class="signature " id="merge-instance_method">
|
266
|
-
|
267
|
-
- (<tt>Object</tt>) <strong>merge</strong>(other)
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
</p><table class="source_code">
|
272
|
-
<tr>
|
273
|
-
<td>
|
274
|
-
<pre class="lines">
|
275
|
-
|
276
|
-
|
277
|
-
57
|
278
|
-
58
|
279
|
-
59
|
280
|
-
60</pre>
|
281
|
-
</td>
|
282
|
-
<td>
|
283
|
-
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 57</span>
|
284
|
-
|
285
|
-
<span class='kw'>def</span> <span class='id merge'>merge</span> <span class='id other'>other</span>
|
286
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id results'>results</span><span class='period'>.</span><span class='id merge!'>merge!</span> <span class='id other'>other</span><span class='period'>.</span><span class='id results'>results</span>
|
287
|
-
<span class='kw'>return</span> <span class='kw'>self</span>
|
288
|
-
<span class='kw'>end</span></pre>
|
289
|
-
</td>
|
290
|
-
</tr>
|
291
|
-
</table>
|
292
|
-
</div>
|
293
|
-
|
294
|
-
<div class="method_details ">
|
295
|
-
<p class="signature " id="multiple_choice-instance_method">
|
296
|
-
|
297
|
-
- (<tt>Object</tt>) <strong>multiple_choice</strong>
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
</p><table class="source_code">
|
302
|
-
<tr>
|
303
|
-
<td>
|
304
|
-
<pre class="lines">
|
305
|
-
|
306
|
-
|
307
|
-
50
|
308
|
-
51
|
309
|
-
52
|
310
|
-
53
|
311
|
-
54
|
312
|
-
55</pre>
|
313
|
-
</td>
|
314
|
-
<td>
|
315
|
-
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 50</span>
|
316
|
-
|
317
|
-
<span class='kw'>def</span> <span class='id multiple_choice'>multiple_choice</span>
|
318
|
-
<span class='id puts'>puts</span> <span class='id output'>output</span>
|
319
|
-
<span class='id print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Which extension do you want to install? </span><span class='tstring_end'>"</span></span>
|
320
|
-
<span class='id choice'>choice</span> <span class='op'>=</span> <span class='const'>STDIN</span><span class='period'>.</span><span class='id gets'>gets</span><span class='period'>.</span><span class='id chomp'>chomp</span>
|
321
|
-
<span class='ivar'>@results</span><span class='lbracket'>[</span><span class='id choice'>choice</span><span class='rbracket'>]</span>
|
322
|
-
<span class='kw'>end</span></pre>
|
323
|
-
</td>
|
324
|
-
</tr>
|
325
|
-
</table>
|
326
|
-
</div>
|
327
|
-
|
328
|
-
<div class="method_details ">
|
329
|
-
<p class="signature " id="output-instance_method">
|
330
|
-
|
331
|
-
- (<tt>Object</tt>) <strong>output</strong>
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
</p><table class="source_code">
|
336
|
-
<tr>
|
337
|
-
<td>
|
338
|
-
<pre class="lines">
|
339
|
-
|
340
|
-
|
341
|
-
27
|
342
|
-
28
|
343
|
-
29
|
344
|
-
30
|
345
|
-
31
|
346
|
-
32
|
347
|
-
33
|
348
|
-
34
|
349
|
-
35
|
350
|
-
36
|
351
|
-
37
|
352
|
-
38
|
353
|
-
39
|
354
|
-
40
|
355
|
-
41
|
356
|
-
42
|
357
|
-
43
|
358
|
-
44
|
359
|
-
45
|
360
|
-
46
|
361
|
-
47
|
362
|
-
48</pre>
|
363
|
-
</td>
|
364
|
-
<td>
|
365
|
-
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 27</span>
|
366
|
-
|
367
|
-
<span class='kw'>def</span> <span class='id output'>output</span>
|
368
|
-
<span class='id output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
369
|
-
<span class='kw'>if</span> <span class='ivar'>@results</span><span class='period'>.</span><span class='id empty?'>empty?</span>
|
370
|
-
<span class='id output'>output</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>%Q{</span><span class='tstring_content'>
|
371
|
-
No extensions matched: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@query</span><span class='rbrace'>}</span><span class='tstring_content'>
|
372
|
-
# URI: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@uri</span><span class='rbrace'>}</span><span class='tstring_content'>
|
373
|
-
</span><span class='tstring_end'>}</span></span><span class='period'>.</span><span class='id lstrip'>lstrip</span>
|
374
|
-
<span class='kw'>else</span>
|
375
|
-
<span class='ivar'>@results</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id extension'>extension</span><span class='op'>|</span>
|
376
|
-
<span class='id name'>name</span> <span class='op'>=</span> <span class='id extension'>extension</span><span class='period'>.</span><span class='id first'>first</span><span class='period'>.</span><span class='id to_extension_name'>to_extension_name</span>
|
377
|
-
<span class='id info'>info</span> <span class='op'>=</span> <span class='id extension'>extension</span><span class='period'>.</span><span class='id last'>last</span>
|
378
|
-
<span class='id output'>output</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>%Q{</span><span class='tstring_content'>
|
379
|
-
</span><span class='embexpr_beg'>#{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-</span><span class='tstring_end'>"</span></span> <span class='op'>*</span> <span class='int'>80</span><span class='rbrace'>}</span><span class='tstring_content'>
|
380
|
-
</span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id info'>info</span><span class='lbracket'>[</span><span class='symbol'>:version</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>) by </span><span class='embexpr_beg'>#{</span><span class='id info'>info</span><span class='lbracket'>[</span><span class='symbol'>:author</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='lparen'>(</span><span class='int'>78</span> <span class='op'>-</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id info'>info</span><span class='lbracket'>[</span><span class='symbol'>:version</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>) by </span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id size'>size</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>
|
381
|
-
</span><span class='embexpr_beg'>#{</span><span class='id info'>info</span><span class='lbracket'>[</span><span class='symbol'>:description</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id wrap'>wrap</span><span class='lparen'>(</span><span class='int'>78</span><span class='comma'>,</span> <span class='int'>2</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>
|
382
|
-
</span><span class='embexpr_beg'>#{</span><span class='id info'>info</span><span class='lbracket'>[</span><span class='symbol'>:homepage</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>
|
383
|
-
ray install </span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>\n
|
384
|
-
</span><span class='tstring_end'>}</span></span><span class='period'>.</span><span class='id lstrip'>lstrip</span>
|
385
|
-
<span class='kw'>end</span>
|
386
|
-
<span class='kw'>return</span> <span class='id output'>output</span>
|
387
|
-
<span class='kw'>end</span>
|
388
|
-
<span class='kw'>end</span></pre>
|
389
|
-
</td>
|
390
|
-
</tr>
|
391
|
-
</table>
|
392
|
-
</div>
|
393
|
-
|
394
|
-
<div class="method_details ">
|
395
|
-
<p class="signature " id="search-instance_method">
|
396
|
-
|
397
|
-
- (<tt>Object</tt>) <strong>search</strong>
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
</p><table class="source_code">
|
402
|
-
<tr>
|
403
|
-
<td>
|
404
|
-
<pre class="lines">
|
405
|
-
|
406
|
-
|
407
|
-
9
|
408
|
-
10
|
409
|
-
11</pre>
|
410
|
-
</td>
|
411
|
-
<td>
|
412
|
-
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 9</span>
|
413
|
-
|
414
|
-
<span class='kw'>def</span> <span class='id search'>search</span>
|
415
|
-
<span class='id normalize'>normalize</span> <span class='id open'>open</span><span class='lparen'>(</span><span class='ivar'>@uri</span><span class='rparen'>)</span><span class='period'>.</span><span class='id read'>read</span>
|
416
|
-
<span class='kw'>end</span></pre>
|
417
|
-
</td>
|
418
|
-
</tr>
|
419
|
-
</table>
|
420
|
-
</div>
|
421
|
-
|
422
|
-
</div>
|
423
|
-
|
424
|
-
</div>
|
425
|
-
|
426
|
-
<div id="footer">
|
427
|
-
Generated on Sun Nov 20 20:26:43 2011 by
|
428
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
429
|
-
0.7.3 (ruby-1.9.3).
|
430
|
-
</div>
|
431
|
-
|
432
|
-
</body>
|
433
|
-
</html>
|
data/lib/ray/extension/gem.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require "multi_json"
|
2
|
-
require "ray/extension"
|
3
|
-
|
4
|
-
module Ray
|
5
|
-
|
6
|
-
class Gem
|
7
|
-
|
8
|
-
include Extension
|
9
|
-
|
10
|
-
def initialize options = {}
|
11
|
-
@author = options[:author]
|
12
|
-
@description = options[:description]
|
13
|
-
@homepage = options[:homepage]
|
14
|
-
@name = options[:name].to_s.to_extension_name
|
15
|
-
@uri = options[:uri]
|
16
|
-
@version = options[:version] || version
|
17
|
-
end
|
18
|
-
|
19
|
-
def install
|
20
|
-
unless @name
|
21
|
-
raise "The extension name is required"
|
22
|
-
end
|
23
|
-
|
24
|
-
add_gem
|
25
|
-
bundle
|
26
|
-
copy_tasks
|
27
|
-
run_tasks
|
28
|
-
end
|
29
|
-
alias enable install
|
30
|
-
|
31
|
-
def add_gem
|
32
|
-
puts "#{@name} => Adding to Gemfile..."
|
33
|
-
File.open GEMFILE, "a" do |gemfile|
|
34
|
-
gemfile.puts "gem \"radiant-#{@name}-extension\", \"~> #{@version}\""
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def version
|
39
|
-
return 0 unless @name
|
40
|
-
uri = "#{RG_V1_API}/gems/radiant-#{@name}-extension.json"
|
41
|
-
response = open(uri).read
|
42
|
-
MultiJson.decode(response)["version"]
|
43
|
-
end
|
44
|
-
|
45
|
-
def bundle
|
46
|
-
puts "#{@name} => Bundling..."
|
47
|
-
FileUtils.rm "#{Ray::GEMFILE}.lock"
|
48
|
-
`bundle update`
|
49
|
-
end
|
50
|
-
|
51
|
-
def copy_tasks
|
52
|
-
puts "#{@name} => Copying tasks..."
|
53
|
-
path = `bundle show radiant-#{@name}-extension`.chomp
|
54
|
-
tasks = "#{path}/lib/tasks/#{@name}_extension_tasks.rake"
|
55
|
-
if File.exist? tasks
|
56
|
-
FileUtils.cp tasks, "#{Ray::ROOT}/lib/tasks/"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def load_tasks
|
61
|
-
puts "#{@name} => Loading tasks..."
|
62
|
-
rake_file = "#{Ray::ROOT}/lib/tasks/#{@name}_extension_tasks.rake"
|
63
|
-
load rake_file if File.exist? rake_file
|
64
|
-
Rake.application.tasks.map(&:name)
|
65
|
-
end
|
66
|
-
|
67
|
-
def disable
|
68
|
-
puts "#{@name} => Removing from Gemfile..."
|
69
|
-
current_gemfile = File.read GEMFILE
|
70
|
-
updated_gemfile = current_gemfile.sub /gem "radiant-#{@name}-extension".+\n/, ""
|
71
|
-
File.open GEMFILE, "w" do |gemfile|
|
72
|
-
gemfile.puts updated_gemfile
|
73
|
-
end
|
74
|
-
bundle
|
75
|
-
end
|
76
|
-
|
77
|
-
def uninstall
|
78
|
-
run_tasks({
|
79
|
-
:migrate => "VERSION=0",
|
80
|
-
:update => :psa
|
81
|
-
})
|
82
|
-
disable
|
83
|
-
end
|
84
|
-
|
85
|
-
def run_task task, options = ""
|
86
|
-
puts "#{@name} => Running #{task} task..."
|
87
|
-
if task == "update" and options == :psa
|
88
|
-
public_service_announcement `bundle show radiant-#{@name}-extension`.chop
|
89
|
-
else
|
90
|
-
`rake radiant:extensions:#{@name}:#{task} #{options}`
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
data/lib/ray/extension/git.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require "ray/extension"
|
2
|
-
|
3
|
-
module Ray
|
4
|
-
|
5
|
-
class Git
|
6
|
-
|
7
|
-
include Extension
|
8
|
-
|
9
|
-
def install
|
10
|
-
if File.exist? "#{Ray::EXT_DIR}/#{@name}"
|
11
|
-
raise "The #{@name} extension is already installed"
|
12
|
-
end
|
13
|
-
|
14
|
-
clone
|
15
|
-
vendor
|
16
|
-
run_tasks
|
17
|
-
cleanup
|
18
|
-
end
|
19
|
-
|
20
|
-
def clone
|
21
|
-
puts "#{@name} => Cloning..."
|
22
|
-
raise "The extension name is required" unless @name
|
23
|
-
raise "The repository URI is required" unless @uri
|
24
|
-
`git clone --depth=1 --quiet #{@uri} #{Ray::TMP_DIR}/#{@name}`
|
25
|
-
FileUtils.rm_rf "#{Ray::TMP_DIR}/#{@name}/.git"
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/lib/ray/extension/zip.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require "zip"
|
2
|
-
require "ray/extension"
|
3
|
-
|
4
|
-
# set StringMax to 0 so open-uri always creates a tmp file
|
5
|
-
OpenURI::Buffer.send :remove_const, "StringMax"
|
6
|
-
OpenURI::Buffer.const_set "StringMax", 0
|
7
|
-
|
8
|
-
module Ray
|
9
|
-
|
10
|
-
class Zip
|
11
|
-
|
12
|
-
include Extension
|
13
|
-
|
14
|
-
def install
|
15
|
-
if File.exist? "#{Ray::EXT_DIR}/#{@name}"
|
16
|
-
raise "The #{@name} extension is already installed"
|
17
|
-
end
|
18
|
-
|
19
|
-
download
|
20
|
-
extract
|
21
|
-
vendor
|
22
|
-
run_tasks
|
23
|
-
cleanup
|
24
|
-
end
|
25
|
-
|
26
|
-
def extract
|
27
|
-
if Dir.glob("#{Ray::TMP_DIR}/*").size != 1
|
28
|
-
raise "The file does not exist"
|
29
|
-
end
|
30
|
-
|
31
|
-
archive = Dir.glob("#{Ray::TMP_DIR}/*").first
|
32
|
-
::Zip::ZipFile.open archive do |zip_file|
|
33
|
-
zip_file.each do |f|
|
34
|
-
f_path = File.join "#{Ray::TMP_DIR}", f.name
|
35
|
-
FileUtils.mkdir_p File.dirname f_path
|
36
|
-
zip_file.extract f, f_path unless File.exist? f_path
|
37
|
-
end
|
38
|
-
end
|
39
|
-
FileUtils.rm archive
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
data/lib/ray/search/cache.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
require "ray/search"
|
3
|
-
require "ray/string"
|
4
|
-
require "yaml"
|
5
|
-
|
6
|
-
module Ray
|
7
|
-
|
8
|
-
class Cache
|
9
|
-
|
10
|
-
include Search
|
11
|
-
|
12
|
-
attr_reader :query, :uri
|
13
|
-
attr_accessor :results
|
14
|
-
|
15
|
-
def initialize query
|
16
|
-
@query = query
|
17
|
-
@results = search
|
18
|
-
@uri = Ray::CACHE
|
19
|
-
end
|
20
|
-
|
21
|
-
def search
|
22
|
-
return {} unless File.exist? Ray::CACHE
|
23
|
-
cache = YAML.load_file Ray::CACHE
|
24
|
-
results = {}
|
25
|
-
cache.each do |extension|
|
26
|
-
name = extension.first
|
27
|
-
info = extension.last
|
28
|
-
if match? name, info[:description]
|
29
|
-
results[name] = {
|
30
|
-
:author => info[:author],
|
31
|
-
:description => info[:description],
|
32
|
-
:homepage => info[:homepage],
|
33
|
-
:name => name,
|
34
|
-
:uri => info[:uri],
|
35
|
-
:version => info[:version]
|
36
|
-
}
|
37
|
-
end
|
38
|
-
end
|
39
|
-
return results
|
40
|
-
end
|
41
|
-
|
42
|
-
def match? name, description
|
43
|
-
if "#{name} #{description}".include?(@query)
|
44
|
-
return true
|
45
|
-
elsif name.include?(@query.to_extension_name)
|
46
|
-
return true
|
47
|
-
end
|
48
|
-
return false
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.clear
|
52
|
-
FileUtils.rm Ray::CACHE
|
53
|
-
end
|
54
|
-
|
55
|
-
def cache
|
56
|
-
return self
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|