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/Ray/Search.html
ADDED
@@ -0,0 +1,822 @@
|
|
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
|
+
Class: Ray::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
|
+
<span class='title'><span class='object_link'><a href="../Ray.html" title="Ray (module)">Ray</a></span></span>
|
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>Class: Ray::Search
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Object</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">Ray::Search</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
|
+
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<dt class="r2 last">Defined in:</dt>
|
90
|
+
<dd class="r2 last">lib/ray/search.rb</dd>
|
91
|
+
|
92
|
+
</dl>
|
93
|
+
<div class="clear"></div>
|
94
|
+
|
95
|
+
<h2>Overview</h2><div class="docstring">
|
96
|
+
<div class="discussion">
|
97
|
+
<p>Search RubyGems, GitHub and/or the local cache for extension information</p>
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
<div class="tags">
|
103
|
+
|
104
|
+
|
105
|
+
</div><div id="subclasses">
|
106
|
+
<h2>Direct Known Subclasses</h2>
|
107
|
+
<p class="children"><span class='object_link'><a href="Search/Cache.html" title="Ray::Search::Cache (class)">Cache</a></span>, <span class='object_link'><a href="Search/GitHub.html" title="Ray::Search::GitHub (class)">GitHub</a></span>, <span class='object_link'><a href="Search/RubyGems.html" title="Ray::Search::RubyGems (class)">RubyGems</a></span></p>
|
108
|
+
</div>
|
109
|
+
<h2>Defined Under Namespace</h2>
|
110
|
+
<p class="children">
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Search/Cache.html" title="Ray::Search::Cache (class)">Cache</a></span>, <span class='object_link'><a href="Search/GitHub.html" title="Ray::Search::GitHub (class)">GitHub</a></span>, <span class='object_link'><a href="Search/RubyGems.html" title="Ray::Search::RubyGems (class)">RubyGems</a></span>
|
116
|
+
|
117
|
+
|
118
|
+
</p>
|
119
|
+
|
120
|
+
|
121
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
122
|
+
<ul class="summary">
|
123
|
+
|
124
|
+
<li class="public ">
|
125
|
+
<span class="summary_signature">
|
126
|
+
|
127
|
+
<a href="#query-instance_method" title="#query (instance method)">- (Object) <strong>query</strong> </a>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
</span>
|
132
|
+
|
133
|
+
|
134
|
+
<span class="note title readonly">readonly</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute query.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#results-instance_method" title="#results (instance method)">- (Object) <strong>results</strong> </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
<span class="note title readonly">readonly</span>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute results.</p>
|
169
|
+
</div></span>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
<li class="public ">
|
175
|
+
<span class="summary_signature">
|
176
|
+
|
177
|
+
<a href="#uri-instance_method" title="#uri (instance method)">- (Object) <strong>uri</strong> </a>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</span>
|
182
|
+
|
183
|
+
|
184
|
+
<span class="note title readonly">readonly</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute uri.</p>
|
194
|
+
</div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
</ul>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<h2>
|
206
|
+
Instance Method Summary
|
207
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
208
|
+
</h2>
|
209
|
+
|
210
|
+
<ul class="summary">
|
211
|
+
|
212
|
+
<li class="public ">
|
213
|
+
<span class="summary_signature">
|
214
|
+
|
215
|
+
<a href="#cache-instance_method" title="#cache (instance method)">- (Hash) <strong>cache</strong> </a>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</span>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
<span class="summary_desc"><div class='inline'><p>Write search results to local cache file.</p>
|
229
|
+
</div></span>
|
230
|
+
|
231
|
+
</li>
|
232
|
+
|
233
|
+
|
234
|
+
<li class="public ">
|
235
|
+
<span class="summary_signature">
|
236
|
+
|
237
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Search) <strong>initialize</strong>(query = nil, live = nil) </a>
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
</span>
|
242
|
+
|
243
|
+
<span class="note title constructor">constructor</span>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Search.</p>
|
253
|
+
</div></span>
|
254
|
+
|
255
|
+
</li>
|
256
|
+
|
257
|
+
|
258
|
+
<li class="public ">
|
259
|
+
<span class="summary_signature">
|
260
|
+
|
261
|
+
<a href="#multiple_choice-instance_method" title="#multiple_choice (instance method)">- (Hash) <strong>multiple_choice</strong> </a>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</span>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<span class="summary_desc"><div class='inline'><p>Prompt the user to choose from a list of possible extensions.</p>
|
275
|
+
</div></span>
|
276
|
+
|
277
|
+
</li>
|
278
|
+
|
279
|
+
|
280
|
+
<li class="public ">
|
281
|
+
<span class="summary_signature">
|
282
|
+
|
283
|
+
<a href="#output-instance_method" title="#output (instance method)">- (String) <strong>output</strong> </a>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
</span>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
<span class="summary_desc"><div class='inline'><p>Pretty printable string; optimized for CLI.</p>
|
297
|
+
</div></span>
|
298
|
+
|
299
|
+
</li>
|
300
|
+
|
301
|
+
|
302
|
+
<li class="public ">
|
303
|
+
<span class="summary_signature">
|
304
|
+
|
305
|
+
<a href="#search-instance_method" title="#search (instance method)">- (Hash) <strong>search</strong> </a>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
</span>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
<span class="summary_desc"><div class='inline'><p>Get raw JSON response from search providers.</p>
|
319
|
+
</div></span>
|
320
|
+
|
321
|
+
</li>
|
322
|
+
|
323
|
+
|
324
|
+
</ul>
|
325
|
+
|
326
|
+
|
327
|
+
<div id="constructor_details" class="method_details_list">
|
328
|
+
<h2>Constructor Details</h2>
|
329
|
+
|
330
|
+
<div class="method_details first">
|
331
|
+
<p class="signature first" id="initialize-instance_method">
|
332
|
+
|
333
|
+
- (<tt><span class='object_link'><a href="" title="Ray::Search (class)">Search</a></span></tt>) <strong>initialize</strong>(query = nil, live = nil)
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
</p><div class="docstring">
|
338
|
+
<div class="discussion">
|
339
|
+
<p>A new instance of Search</p>
|
340
|
+
|
341
|
+
|
342
|
+
</div>
|
343
|
+
</div>
|
344
|
+
<div class="tags">
|
345
|
+
|
346
|
+
|
347
|
+
</div><table class="source_code">
|
348
|
+
<tr>
|
349
|
+
<td>
|
350
|
+
<pre class="lines">
|
351
|
+
|
352
|
+
|
353
|
+
15
|
354
|
+
16
|
355
|
+
17
|
356
|
+
18
|
357
|
+
19
|
358
|
+
20
|
359
|
+
21
|
360
|
+
22
|
361
|
+
23
|
362
|
+
24
|
363
|
+
25
|
364
|
+
26
|
365
|
+
27
|
366
|
+
28</pre>
|
367
|
+
</td>
|
368
|
+
<td>
|
369
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 15</span>
|
370
|
+
|
371
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span> <span class='id query'>query</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id live'>live</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
372
|
+
<span class='kw'>if</span> <span class='id query'>query</span>
|
373
|
+
<span class='ivar'>@query</span> <span class='op'>=</span> <span class='id query'>query</span>
|
374
|
+
<span class='ivar'>@results</span> <span class='op'>=</span> <span class='id live'>live</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='const'>Cache</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id query'>query</span><span class='rparen'>)</span><span class='period'>.</span><span class='id results'>results</span>
|
375
|
+
<span class='kw'>if</span> <span class='ivar'>@results</span><span class='period'>.</span><span class='id empty?'>empty?</span>
|
376
|
+
<span class='id rubygems'>rubygems</span> <span class='op'>=</span> <span class='const'>RubyGems</span><span class='period'>.</span><span class='id new'>new</span> <span class='id query'>query</span>
|
377
|
+
<span class='id github'>github</span> <span class='op'>=</span> <span class='const'>GitHub</span><span class='period'>.</span><span class='id new'>new</span> <span class='id query'>query</span>
|
378
|
+
<span class='ivar'>@results</span> <span class='op'>=</span> <span class='id github'>github</span><span class='period'>.</span><span class='id results'>results</span><span class='period'>.</span><span class='id merge'>merge</span> <span class='id rubygems'>rubygems</span><span class='period'>.</span><span class='id results'>results</span>
|
379
|
+
<span class='ivar'>@uri</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id rubygems'>rubygems</span><span class='period'>.</span><span class='id uri'>uri</span><span class='comma'>,</span> <span class='id github'>github</span><span class='period'>.</span><span class='id uri'>uri</span><span class='rbracket'>]</span>
|
380
|
+
<span class='kw'>end</span>
|
381
|
+
<span class='kw'>else</span>
|
382
|
+
<span class='ivar'>@results</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>A search query is required. Try: ray help search</span><span class='tstring_end'>"</span></span>
|
383
|
+
<span class='kw'>end</span>
|
384
|
+
<span class='kw'>end</span></pre>
|
385
|
+
</td>
|
386
|
+
</tr>
|
387
|
+
</table>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div id="instance_attr_details" class="attr_details">
|
393
|
+
<h2>Instance Attribute Details</h2>
|
394
|
+
|
395
|
+
|
396
|
+
<span id=""></span>
|
397
|
+
<span id="query-instance_method"></span>
|
398
|
+
<div class="method_details first">
|
399
|
+
<p class="signature first" id="query-instance_method">
|
400
|
+
|
401
|
+
- (<tt>Object</tt>) <strong>query</strong> <span class="extras">(readonly)</span>
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
</p><div class="docstring">
|
406
|
+
<div class="discussion">
|
407
|
+
<p>Returns the value of attribute query</p>
|
408
|
+
|
409
|
+
|
410
|
+
</div>
|
411
|
+
</div>
|
412
|
+
<div class="tags">
|
413
|
+
|
414
|
+
|
415
|
+
</div><table class="source_code">
|
416
|
+
<tr>
|
417
|
+
<td>
|
418
|
+
<pre class="lines">
|
419
|
+
|
420
|
+
|
421
|
+
11
|
422
|
+
12
|
423
|
+
13</pre>
|
424
|
+
</td>
|
425
|
+
<td>
|
426
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 11</span>
|
427
|
+
|
428
|
+
<span class='kw'>def</span> <span class='id query'>query</span>
|
429
|
+
<span class='ivar'>@query</span>
|
430
|
+
<span class='kw'>end</span></pre>
|
431
|
+
</td>
|
432
|
+
</tr>
|
433
|
+
</table>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
|
437
|
+
<span id=""></span>
|
438
|
+
<span id="results-instance_method"></span>
|
439
|
+
<div class="method_details ">
|
440
|
+
<p class="signature " id="results-instance_method">
|
441
|
+
|
442
|
+
- (<tt>Object</tt>) <strong>results</strong> <span class="extras">(readonly)</span>
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
</p><div class="docstring">
|
447
|
+
<div class="discussion">
|
448
|
+
<p>Returns the value of attribute results</p>
|
449
|
+
|
450
|
+
|
451
|
+
</div>
|
452
|
+
</div>
|
453
|
+
<div class="tags">
|
454
|
+
|
455
|
+
|
456
|
+
</div><table class="source_code">
|
457
|
+
<tr>
|
458
|
+
<td>
|
459
|
+
<pre class="lines">
|
460
|
+
|
461
|
+
|
462
|
+
11
|
463
|
+
12
|
464
|
+
13</pre>
|
465
|
+
</td>
|
466
|
+
<td>
|
467
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 11</span>
|
468
|
+
|
469
|
+
<span class='kw'>def</span> <span class='id results'>results</span>
|
470
|
+
<span class='ivar'>@results</span>
|
471
|
+
<span class='kw'>end</span></pre>
|
472
|
+
</td>
|
473
|
+
</tr>
|
474
|
+
</table>
|
475
|
+
</div>
|
476
|
+
|
477
|
+
|
478
|
+
<span id=""></span>
|
479
|
+
<span id="uri-instance_method"></span>
|
480
|
+
<div class="method_details ">
|
481
|
+
<p class="signature " id="uri-instance_method">
|
482
|
+
|
483
|
+
- (<tt>Object</tt>) <strong>uri</strong> <span class="extras">(readonly)</span>
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
</p><div class="docstring">
|
488
|
+
<div class="discussion">
|
489
|
+
<p>Returns the value of attribute uri</p>
|
490
|
+
|
491
|
+
|
492
|
+
</div>
|
493
|
+
</div>
|
494
|
+
<div class="tags">
|
495
|
+
|
496
|
+
|
497
|
+
</div><table class="source_code">
|
498
|
+
<tr>
|
499
|
+
<td>
|
500
|
+
<pre class="lines">
|
501
|
+
|
502
|
+
|
503
|
+
11
|
504
|
+
12
|
505
|
+
13</pre>
|
506
|
+
</td>
|
507
|
+
<td>
|
508
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 11</span>
|
509
|
+
|
510
|
+
<span class='kw'>def</span> <span class='id uri'>uri</span>
|
511
|
+
<span class='ivar'>@uri</span>
|
512
|
+
<span class='kw'>end</span></pre>
|
513
|
+
</td>
|
514
|
+
</tr>
|
515
|
+
</table>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
</div>
|
519
|
+
|
520
|
+
|
521
|
+
<div id="instance_method_details" class="method_details_list">
|
522
|
+
<h2>Instance Method Details</h2>
|
523
|
+
|
524
|
+
|
525
|
+
<div class="method_details first">
|
526
|
+
<p class="signature first" id="cache-instance_method">
|
527
|
+
|
528
|
+
- (<tt>Hash</tt>) <strong>cache</strong>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
</p><div class="docstring">
|
533
|
+
<div class="discussion">
|
534
|
+
<p>Write search results to local cache file</p>
|
535
|
+
|
536
|
+
|
537
|
+
</div>
|
538
|
+
</div>
|
539
|
+
<div class="tags">
|
540
|
+
|
541
|
+
<h3>Returns:</h3>
|
542
|
+
<ul class="return">
|
543
|
+
|
544
|
+
<li>
|
545
|
+
|
546
|
+
|
547
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
—
|
552
|
+
<div class='inline'><p>the original search results</p>
|
553
|
+
</div>
|
554
|
+
|
555
|
+
</li>
|
556
|
+
|
557
|
+
</ul>
|
558
|
+
|
559
|
+
</div><table class="source_code">
|
560
|
+
<tr>
|
561
|
+
<td>
|
562
|
+
<pre class="lines">
|
563
|
+
|
564
|
+
|
565
|
+
32
|
566
|
+
33
|
567
|
+
34
|
568
|
+
35
|
569
|
+
36
|
570
|
+
37
|
571
|
+
38
|
572
|
+
39
|
573
|
+
40
|
574
|
+
41
|
575
|
+
42
|
576
|
+
43
|
577
|
+
44
|
578
|
+
45
|
579
|
+
46</pre>
|
580
|
+
</td>
|
581
|
+
<td>
|
582
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 32</span>
|
583
|
+
|
584
|
+
<span class='kw'>def</span> <span class='id cache'>cache</span>
|
585
|
+
<span class='kw'>if</span> <span class='ivar'>@results</span><span class='period'>.</span><span class='id respond_to?'>respond_to?</span> <span class='symbol'>:merge</span>
|
586
|
+
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id exist?'>exist?</span> <span class='const'>CACHE</span>
|
587
|
+
<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'>CACHE</span>
|
588
|
+
<span class='kw'>else</span>
|
589
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id mkdir_p'>mkdir_p</span> <span class='const'>RAY</span>
|
590
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id touch'>touch</span> <span class='const'>CACHE</span>
|
591
|
+
<span class='id cache'>cache</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
592
|
+
<span class='kw'>end</span>
|
593
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id open'>open</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>
|
594
|
+
<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>
|
595
|
+
<span class='kw'>end</span>
|
596
|
+
<span class='kw'>end</span>
|
597
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
598
|
+
<span class='kw'>end</span></pre>
|
599
|
+
</td>
|
600
|
+
</tr>
|
601
|
+
</table>
|
602
|
+
</div>
|
603
|
+
|
604
|
+
<div class="method_details ">
|
605
|
+
<p class="signature " id="multiple_choice-instance_method">
|
606
|
+
|
607
|
+
- (<tt>Hash</tt>) <strong>multiple_choice</strong>
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
</p><div class="docstring">
|
612
|
+
<div class="discussion">
|
613
|
+
<p>Prompt the user to choose from a list of possible extensions</p>
|
614
|
+
|
615
|
+
|
616
|
+
</div>
|
617
|
+
</div>
|
618
|
+
<div class="tags">
|
619
|
+
|
620
|
+
<h3>Returns:</h3>
|
621
|
+
<ul class="return">
|
622
|
+
|
623
|
+
<li>
|
624
|
+
|
625
|
+
|
626
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
—
|
631
|
+
<div class='inline'><p>Extension information</p>
|
632
|
+
</div>
|
633
|
+
|
634
|
+
</li>
|
635
|
+
|
636
|
+
</ul>
|
637
|
+
|
638
|
+
</div><table class="source_code">
|
639
|
+
<tr>
|
640
|
+
<td>
|
641
|
+
<pre class="lines">
|
642
|
+
|
643
|
+
|
644
|
+
74
|
645
|
+
75
|
646
|
+
76
|
647
|
+
77
|
648
|
+
78
|
649
|
+
79</pre>
|
650
|
+
</td>
|
651
|
+
<td>
|
652
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 74</span>
|
653
|
+
|
654
|
+
<span class='kw'>def</span> <span class='id multiple_choice'>multiple_choice</span>
|
655
|
+
<span class='id puts'>puts</span> <span class='id output'>output</span>
|
656
|
+
<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>
|
657
|
+
<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>
|
658
|
+
<span class='ivar'>@results</span><span class='lbracket'>[</span><span class='id choice'>choice</span><span class='rbracket'>]</span>
|
659
|
+
<span class='kw'>end</span></pre>
|
660
|
+
</td>
|
661
|
+
</tr>
|
662
|
+
</table>
|
663
|
+
</div>
|
664
|
+
|
665
|
+
<div class="method_details ">
|
666
|
+
<p class="signature " id="output-instance_method">
|
667
|
+
|
668
|
+
- (<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>) <strong>output</strong>
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
</p><div class="docstring">
|
673
|
+
<div class="discussion">
|
674
|
+
<p>Pretty printable string; optimized for CLI</p>
|
675
|
+
|
676
|
+
|
677
|
+
</div>
|
678
|
+
</div>
|
679
|
+
<div class="tags">
|
680
|
+
|
681
|
+
<h3>Returns:</h3>
|
682
|
+
<ul class="return">
|
683
|
+
|
684
|
+
<li>
|
685
|
+
|
686
|
+
|
687
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
—
|
692
|
+
<div class='inline'><p>pretty text ready for output</p>
|
693
|
+
</div>
|
694
|
+
|
695
|
+
</li>
|
696
|
+
|
697
|
+
</ul>
|
698
|
+
|
699
|
+
</div><table class="source_code">
|
700
|
+
<tr>
|
701
|
+
<td>
|
702
|
+
<pre class="lines">
|
703
|
+
|
704
|
+
|
705
|
+
50
|
706
|
+
51
|
707
|
+
52
|
708
|
+
53
|
709
|
+
54
|
710
|
+
55
|
711
|
+
56
|
712
|
+
57
|
713
|
+
58
|
714
|
+
59
|
715
|
+
60
|
716
|
+
61
|
717
|
+
62
|
718
|
+
63
|
719
|
+
64
|
720
|
+
65
|
721
|
+
66
|
722
|
+
67
|
723
|
+
68
|
724
|
+
69
|
725
|
+
70</pre>
|
726
|
+
</td>
|
727
|
+
<td>
|
728
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 50</span>
|
729
|
+
|
730
|
+
<span class='kw'>def</span> <span class='id output'>output</span>
|
731
|
+
<span class='kw'>if</span> <span class='ivar'>@results</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>query is required</span><span class='regexp_end'>/</span></span>
|
732
|
+
<span class='ivar'>@results</span>
|
733
|
+
<span class='kw'>elsif</span> <span class='ivar'>@results</span><span class='period'>.</span><span class='id empty?'>empty?</span>
|
734
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>No extensions matched '</span><span class='embexpr_beg'>#{</span><span class='ivar'>@query</span><span class='rbrace'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
735
|
+
<span class='kw'>else</span>
|
736
|
+
<span class='id output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
737
|
+
<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>
|
738
|
+
<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>
|
739
|
+
<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>
|
740
|
+
<span class='id output'>output</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>%Q{</span><span class='tstring_content'>
|
741
|
+
</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'>
|
742
|
+
</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'>
|
743
|
+
</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'>
|
744
|
+
</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'>
|
745
|
+
ray install </span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>\n
|
746
|
+
</span><span class='tstring_end'>}</span></span><span class='period'>.</span><span class='id lstrip'>lstrip</span>
|
747
|
+
<span class='kw'>end</span>
|
748
|
+
<span class='kw'>return</span> <span class='id output'>output</span>
|
749
|
+
<span class='kw'>end</span>
|
750
|
+
<span class='kw'>end</span></pre>
|
751
|
+
</td>
|
752
|
+
</tr>
|
753
|
+
</table>
|
754
|
+
</div>
|
755
|
+
|
756
|
+
<div class="method_details ">
|
757
|
+
<p class="signature " id="search-instance_method">
|
758
|
+
|
759
|
+
- (<tt>Hash</tt>) <strong>search</strong>
|
760
|
+
|
761
|
+
|
762
|
+
|
763
|
+
</p><div class="docstring">
|
764
|
+
<div class="discussion">
|
765
|
+
<p>Get raw JSON response from search providers</p>
|
766
|
+
|
767
|
+
|
768
|
+
</div>
|
769
|
+
</div>
|
770
|
+
<div class="tags">
|
771
|
+
|
772
|
+
<h3>Returns:</h3>
|
773
|
+
<ul class="return">
|
774
|
+
|
775
|
+
<li>
|
776
|
+
|
777
|
+
|
778
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
—
|
783
|
+
<div class='inline'><p>search results in a normalized format</p>
|
784
|
+
</div>
|
785
|
+
|
786
|
+
</li>
|
787
|
+
|
788
|
+
</ul>
|
789
|
+
|
790
|
+
</div><table class="source_code">
|
791
|
+
<tr>
|
792
|
+
<td>
|
793
|
+
<pre class="lines">
|
794
|
+
|
795
|
+
|
796
|
+
83
|
797
|
+
84
|
798
|
+
85</pre>
|
799
|
+
</td>
|
800
|
+
<td>
|
801
|
+
<pre class="code"><span class="info file"># File 'lib/ray/search.rb', line 83</span>
|
802
|
+
|
803
|
+
<span class='kw'>def</span> <span class='id search'>search</span>
|
804
|
+
<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>
|
805
|
+
<span class='kw'>end</span></pre>
|
806
|
+
</td>
|
807
|
+
</tr>
|
808
|
+
</table>
|
809
|
+
</div>
|
810
|
+
|
811
|
+
</div>
|
812
|
+
|
813
|
+
</div>
|
814
|
+
|
815
|
+
<div id="footer">
|
816
|
+
Generated on Tue Nov 15 19:16:22 2011 by
|
817
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
818
|
+
0.7.3 (ruby-1.9.3).
|
819
|
+
</div>
|
820
|
+
|
821
|
+
</body>
|
822
|
+
</html>
|