smoke 0.0.3 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +101 -0
- data/Rakefile +53 -4
- data/VERSION.yml +4 -0
- data/examples/web_search_joined.rb +25 -0
- data/examples/yql_web_search.rb +11 -0
- data/lib/core_ext/hash.rb +20 -0
- data/lib/core_ext/string.rb +6 -0
- data/lib/smoke.rb +103 -3
- data/lib/smoke/cache.rb +56 -0
- data/lib/smoke/origin.rb +251 -0
- data/lib/smoke/request.rb +57 -0
- data/lib/smoke/source/data.rb +39 -0
- data/lib/smoke/source/feed.rb +24 -0
- data/lib/smoke/source/join.rb +33 -0
- data/lib/smoke/source/yql.rb +85 -0
- data/rdoc/classes/Smoke.html +260 -0
- data/rdoc/classes/Smoke/Origin.html +340 -0
- data/rdoc/classes/Smoke/Source/Data.html +126 -0
- data/rdoc/classes/Smoke/Source/Feed.html +117 -0
- data/rdoc/classes/Smoke/Source/YQL.html +223 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_markdown.html +180 -0
- data/rdoc/files/lib/core_ext/hash_rb.html +49 -0
- data/rdoc/files/lib/smoke/origin_rb.html +49 -0
- data/rdoc/files/lib/smoke/request_rb.html +49 -0
- data/rdoc/files/lib/smoke/source/data_rb.html +49 -0
- data/rdoc/files/lib/smoke/source/feed_rb.html +49 -0
- data/rdoc/files/lib/smoke/source/join_rb.html +49 -0
- data/rdoc/files/lib/smoke/source/yql_rb.html +49 -0
- data/rdoc/files/lib/smoke_rb.html +65 -0
- data/rdoc/fr_class_index.html +21 -0
- data/rdoc/fr_file_index.html +28 -0
- data/rdoc/fr_method_index.html +4459 -0
- data/rdoc/index.html +15 -0
- data/rdoc/rdoc-style.css +319 -0
- data/spec/core_ext/hash_spec.rb +25 -0
- data/spec/smoke/cache_spec.rb +75 -0
- data/spec/smoke/origin_spec.rb +220 -0
- data/spec/smoke/request_spec.rb +49 -0
- data/spec/smoke/shared_spec.rb +182 -0
- data/spec/smoke/source/data_spec.rb +65 -0
- data/spec/smoke/source/feed_spec.rb +49 -0
- data/spec/smoke/source/join_spec.rb +53 -0
- data/spec/smoke/source/yql_spec.rb +111 -0
- data/spec/smoke_spec.rb +51 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/supports/amc_pacer.json.yql +10 -0
- data/spec/supports/datatables.yql +12 -0
- data/spec/supports/flickr-photo.json +7 -0
- data/spec/supports/gzip_response.txt +0 -0
- data/spec/supports/search-web.json.yql +12 -0
- data/spec/supports/search-web.xml.yql +83 -0
- data/spec/supports/slashdot.xml +98 -0
- data/spec/supports/test_source.rb +10 -0
- metadata +144 -67
- data/History.txt +0 -13
- data/License.txt +0 -21
- data/Manifest.txt +0 -44
- data/README.txt +0 -3
- data/bin/smoke +0 -41
- data/bin/smoked +0 -43
- data/config/hoe.rb +0 -70
- data/config/requirements.rb +0 -17
- data/contrib/processors/smoke/remote_port_status_check_processor.rb +0 -10
- data/contrib/processors/smoke/system_load_processor.rb +0 -52
- data/contrib/signals/smoke/remote_port_status_check.rb +0 -39
- data/contrib/signals/smoke/system_load.rb +0 -23
- data/lib/smoke/client.rb +0 -50
- data/lib/smoke/client/connection.rb +0 -44
- data/lib/smoke/client/signal_runner.rb +0 -40
- data/lib/smoke/client/version.rb +0 -11
- data/lib/smoke/server.rb +0 -18
- data/lib/smoke/server/signal_handler.rb +0 -64
- data/lib/smoke/server/signal_router.rb +0 -38
- data/lib/smoke/server/version.rb +0 -11
- data/lib/smoke/signal.rb +0 -19
- data/lib/smoke/signal_processor.rb +0 -29
- data/lib/smoke/version.rb +0 -9
- data/log/debug.log +0 -0
- data/log/development.log +0 -0
- data/log/production.log +0 -0
- data/log/server.log +0 -0
- data/log/test.log +0 -0
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -35
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/test_helper.rb +0 -2
- data/test/test_server.rb +0 -11
- data/website/index.html +0 -87
- data/website/index.txt +0 -29
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.rhtml +0 -48
@@ -0,0 +1,117 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: Smoke::Source::Feed [smoke]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Class</span>
|
30
|
+
Smoke::Source::Feed
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../../files/lib/smoke/source/feed_rb.html">lib/smoke/source/feed.rb</a>
|
35
|
+
</li>
|
36
|
+
</ol>
|
37
|
+
<div class='parent'>
|
38
|
+
Parent:
|
39
|
+
<strong><a href="../Origin.html">Smoke::Origin</a></strong>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<div id='content'>
|
43
|
+
<div id='text'>
|
44
|
+
<div id='description'>
|
45
|
+
<p>
|
46
|
+
<a href="Feed.html">Feed</a> can take multiple rss or atom feeds and munge
|
47
|
+
them up together.
|
48
|
+
</p>
|
49
|
+
<p>
|
50
|
+
Usage:
|
51
|
+
</p>
|
52
|
+
<pre>Smoke.feed(:ruby) do
 url "domain.tld/rss"
 url "site.tld/atom"
end</pre>
|
53
|
+
</div>
|
54
|
+
<div id='method-list'>
|
55
|
+
<h2>Methods</h2>
|
56
|
+
<h3>public instance</h3>
|
57
|
+
<ol>
|
58
|
+
<li><a href="#M000010">url</a></li>
|
59
|
+
</ol>
|
60
|
+
<h3>protected instance</h3>
|
61
|
+
<ol>
|
62
|
+
<li><a href="#M000011">dispatch</a></li>
|
63
|
+
</ol>
|
64
|
+
</div>
|
65
|
+
<div id='section'>
|
66
|
+
<div id='attribute-list'>
|
67
|
+
<h2 class='section-bar'>Attributes</h2>
|
68
|
+
<div class='name-list'>
|
69
|
+
<table>
|
70
|
+
<tr class='top-aligned-row context-row'>
|
71
|
+
<td class='context-item-name'>requests</td>
|
72
|
+
<td class='context-item-value'>[R]</td>
|
73
|
+
<td class='context-item-desc'></td>
|
74
|
+
</tr>
|
75
|
+
</table>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
<div id='methods'>
|
79
|
+
<h2>Public instance methods</h2>
|
80
|
+
<div class='public-instance method' id='method-M000010'>
|
81
|
+
<a name='M000010'> </a>
|
82
|
+
<div class='synopsis'>
|
83
|
+
<span class='name'>url</span>
|
84
|
+
<span class='arguments'>(feed_uri)</span>
|
85
|
+
</div>
|
86
|
+
<div class='source'>
|
87
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
|
88
|
+
[show source]
|
89
|
+
</a>
|
90
|
+
<pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/smoke/source/feed.rb, line 13</span>
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">url</span>(<span class="ruby-identifier">feed_uri</span>)
14: (<span class="ruby-ivar">@feeds</span> <span class="ruby-operator">||=</span> [] ) <span class="ruby-operator"><<</span> <span class="ruby-identifier">feed_uri</span>
15: <span class="ruby-keyword kw">end</span></pre>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<h2>Protected instance methods</h2>
|
94
|
+
<div class='protected-instance method' id='method-M000011'>
|
95
|
+
<a name='M000011'> </a>
|
96
|
+
<div class='synopsis'>
|
97
|
+
<span class='name'>dispatch</span>
|
98
|
+
<span class='arguments'>()</span>
|
99
|
+
</div>
|
100
|
+
<div class='source'>
|
101
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
|
102
|
+
[show source]
|
103
|
+
</a>
|
104
|
+
<pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/smoke/source/feed.rb, line 18</span>
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
19: <span class="ruby-ivar">@requests</span> = <span class="ruby-ivar">@feeds</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">:raw_response</span>) }
20: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">items</span> = <span class="ruby-ivar">@requests</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-operator">::</span><span class="ruby-constant">SimpleRSS</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">r</span>.<span class="ruby-identifier">body</span>).<span class="ruby-identifier">items</span> }.<span class="ruby-identifier">flatten</span>
21: <span class="ruby-keyword kw">end</span></pre>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div id='footer-push'></div>
|
112
|
+
</div>
|
113
|
+
<div id='footer'>
|
114
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
115
|
+
</div>
|
116
|
+
</body>
|
117
|
+
</html>
|
@@ -0,0 +1,223 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: Smoke::Source::YQL [smoke]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Class</span>
|
30
|
+
Smoke::Source::YQL
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../../files/lib/smoke/source/yql_rb.html">lib/smoke/source/yql.rb</a>
|
35
|
+
</li>
|
36
|
+
</ol>
|
37
|
+
<div class='parent'>
|
38
|
+
Parent:
|
39
|
+
<strong><a href="../Origin.html">Smoke::Origin</a></strong>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<div id='content'>
|
43
|
+
<div id='text'>
|
44
|
+
<div id='description'>
|
45
|
+
<p>
|
46
|
+
<a href="YQL.html">YQL</a> will call to Yahoo <a href="YQL.html">YQL</a>
|
47
|
+
services
|
48
|
+
</p>
|
49
|
+
<p>
|
50
|
+
Usage:
|
51
|
+
</p>
|
52
|
+
<pre>Smoke.yql(:ruby) do
 select :all
 from "search.web"
 where :query, "ruby"
end</pre>
|
53
|
+
</div>
|
54
|
+
<div id='method-list'>
|
55
|
+
<h2>Methods</h2>
|
56
|
+
<h3>public instance</h3>
|
57
|
+
<ol>
|
58
|
+
<li><a href="#M000015">from</a></li>
|
59
|
+
<li><a href="#M000014">select</a></li>
|
60
|
+
<li><a href="#M000017">use</a></li>
|
61
|
+
<li><a href="#M000016">where</a></li>
|
62
|
+
</ol>
|
63
|
+
<h3>protected instance</h3>
|
64
|
+
<ol>
|
65
|
+
<li><a href="#M000019">dispatch</a></li>
|
66
|
+
<li><a href="#M000018">params</a></li>
|
67
|
+
</ol>
|
68
|
+
</div>
|
69
|
+
<div id='section'>
|
70
|
+
<div id='constants-list'>
|
71
|
+
<h2>Constants</h2>
|
72
|
+
<div class='name-list'>
|
73
|
+
<table summary='Constants'>
|
74
|
+
<tr class='top-aligned-row context-row'>
|
75
|
+
<td class='context-item-name'>API_BASE</td>
|
76
|
+
<td>=</td>
|
77
|
+
<td class='context-item-value'>"http://query.yahooapis.com/v1/public/yql"</td>
|
78
|
+
</tr>
|
79
|
+
</table>
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
<div id='attribute-list'>
|
83
|
+
<h2 class='section-bar'>Attributes</h2>
|
84
|
+
<div class='name-list'>
|
85
|
+
<table>
|
86
|
+
<tr class='top-aligned-row context-row'>
|
87
|
+
<td class='context-item-name'>request</td>
|
88
|
+
<td class='context-item-value'>[R]</td>
|
89
|
+
<td class='context-item-desc'></td>
|
90
|
+
</tr>
|
91
|
+
</table>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div id='methods'>
|
95
|
+
<h2>Public instance methods</h2>
|
96
|
+
<div class='public-instance method' id='method-M000015'>
|
97
|
+
<a name='M000015'> </a>
|
98
|
+
<div class='synopsis'>
|
99
|
+
<span class='name'>from</span>
|
100
|
+
<span class='arguments'>(source)</span>
|
101
|
+
</div>
|
102
|
+
<div class='description'>
|
103
|
+
<p>
|
104
|
+
from corresponds to the from fragment of the <a href="YQL.html">YQL</a>
|
105
|
+
query Usage:
|
106
|
+
</p>
|
107
|
+
<pre>from "search.web"</pre>
|
108
|
+
<p>
|
109
|
+
or
|
110
|
+
</p>
|
111
|
+
<pre>from :html</pre>
|
112
|
+
</div>
|
113
|
+
<div class='source'>
|
114
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
|
115
|
+
[show source]
|
116
|
+
</a>
|
117
|
+
<pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 34</span>
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from</span>(<span class="ruby-identifier">source</span>)
35: <span class="ruby-ivar">@from</span> = <span class="ruby-identifier">source</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
36: <span class="ruby-ivar">@from</span> = <span class="ruby-identifier">source</span>.<span class="ruby-identifier">to_s</span>
37: <span class="ruby-keyword kw">end</span></pre>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
<div class='public-instance method' id='method-M000014'>
|
121
|
+
<a name='M000014'> </a>
|
122
|
+
<div class='synopsis'>
|
123
|
+
<span class='name'>select</span>
|
124
|
+
<span class='arguments'>(what = :all)</span>
|
125
|
+
</div>
|
126
|
+
<div class='description'>
|
127
|
+
<p>
|
128
|
+
Select indicates what <a href="YQL.html">YQL</a> will be selecting Usage:
|
129
|
+
</p>
|
130
|
+
<pre>select :all
=> "SELECT *"
select :title
=> "SELECT title"
select :title, :description
=> "SELECT title, description"</pre>
|
131
|
+
</div>
|
132
|
+
<div class='source'>
|
133
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
|
134
|
+
[show source]
|
135
|
+
</a>
|
136
|
+
<pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 23</span>
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select</span>(<span class="ruby-identifier">what</span> = <span class="ruby-identifier">:all</span>)
24: <span class="ruby-ivar">@select</span> = <span class="ruby-identifier">what</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">","</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
25: <span class="ruby-ivar">@select</span> = <span class="ruby-value str">"*"</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:all</span>
26: <span class="ruby-ivar">@select</span> = <span class="ruby-identifier">what</span>.<span class="ruby-identifier">to_s</span>
27: <span class="ruby-keyword kw">end</span></pre>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
<div class='public-instance method' id='method-M000017'>
|
140
|
+
<a name='M000017'> </a>
|
141
|
+
<div class='synopsis'>
|
142
|
+
<span class='name'>use</span>
|
143
|
+
<span class='arguments'>(url)</span>
|
144
|
+
</div>
|
145
|
+
<div class='description'>
|
146
|
+
<p>
|
147
|
+
`use` can be used to set the url location of the data-table that you want
|
148
|
+
<a href="YQL.html">YQL</a> to search upon
|
149
|
+
</p>
|
150
|
+
<p>
|
151
|
+
Usage:
|
152
|
+
</p>
|
153
|
+
<pre>use "http://datatables.org/alltables.env"</pre>
|
154
|
+
</div>
|
155
|
+
<div class='source'>
|
156
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
|
157
|
+
[show source]
|
158
|
+
</a>
|
159
|
+
<pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 55</span>
55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use</span>(<span class="ruby-identifier">url</span>)
56: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge!</span>({<span class="ruby-identifier">:env</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">url</span>})
57: <span class="ruby-keyword kw">end</span></pre>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
<div class='public-instance method' id='method-M000016'>
|
163
|
+
<a name='M000016'> </a>
|
164
|
+
<div class='synopsis'>
|
165
|
+
<span class='name'>where</span>
|
166
|
+
<span class='arguments'>(column, value)</span>
|
167
|
+
</div>
|
168
|
+
<div class='description'>
|
169
|
+
<p>
|
170
|
+
where is a straight up match, no fancy matchers are currently supported
|
171
|
+
Usage:
|
172
|
+
</p>
|
173
|
+
<pre>where :xpath, "//div/div/a"</pre>
|
174
|
+
<p>
|
175
|
+
or
|
176
|
+
</p>
|
177
|
+
<pre>where :query, "python"</pre>
|
178
|
+
</div>
|
179
|
+
<div class='source'>
|
180
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
|
181
|
+
[show source]
|
182
|
+
</a>
|
183
|
+
<pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 45</span>
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">where</span>(<span class="ruby-identifier">column</span>, <span class="ruby-identifier">value</span>)
46: <span class="ruby-ivar">@where</span> = <span class="ruby-ivar">@where</span> <span class="ruby-operator">||</span> []
47: <span class="ruby-ivar">@where</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{column.to_s} = '#{value}'"</span>
48: <span class="ruby-keyword kw">end</span></pre>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
<h2>Protected instance methods</h2>
|
187
|
+
<div class='protected-instance method' id='method-M000019'>
|
188
|
+
<a name='M000019'> </a>
|
189
|
+
<div class='synopsis'>
|
190
|
+
<span class='name'>dispatch</span>
|
191
|
+
<span class='arguments'>()</span>
|
192
|
+
</div>
|
193
|
+
<div class='source'>
|
194
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
|
195
|
+
[show source]
|
196
|
+
</a>
|
197
|
+
<pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 64</span>
64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
65: <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">build_uri</span>)
66: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">items</span> = [(<span class="ruby-ivar">@path</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">drill</span>(<span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span>, <span class="ruby-operator">*</span><span class="ruby-ivar">@path</span>)]
67: <span class="ruby-keyword kw">end</span></pre>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
<div class='protected-instance method' id='method-M000018'>
|
201
|
+
<a name='M000018'> </a>
|
202
|
+
<div class='synopsis'>
|
203
|
+
<span class='name'>params</span>
|
204
|
+
<span class='arguments'>()</span>
|
205
|
+
</div>
|
206
|
+
<div class='source'>
|
207
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
|
208
|
+
[show source]
|
209
|
+
</a>
|
210
|
+
<pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/smoke/source/yql.rb, line 60</span>
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span> 
61: <span class="ruby-ivar">@params</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@params</span> = {}
62: <span class="ruby-keyword kw">end</span></pre>
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
<div id='footer-push'></div>
|
218
|
+
</div>
|
219
|
+
<div id='footer'>
|
220
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
221
|
+
</div>
|
222
|
+
</body>
|
223
|
+
</html>
|
data/rdoc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Mon, 08 Jun 2009 23:18:27 +1000
|
@@ -0,0 +1,180 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>File: README.markdown [smoke]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='file' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>README.markdown</h1>
|
29
|
+
<div class='paths'>
|
30
|
+
README.markdown
|
31
|
+
</div>
|
32
|
+
<div class='last-update'>
|
33
|
+
Last Update:
|
34
|
+
<span class='datetime'>Mon Jun 08 19:58:40 +1000 2009</span>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<div id='content'>
|
38
|
+
<div id='text'>
|
39
|
+
<div id='description'>
|
40
|
+
<p>
|
41
|
+
# smoke
|
42
|
+
</p>
|
43
|
+
<p>
|
44
|
+
smoke is a Ruby based DSL that allows you to take data from YQL, RSS / Atom
|
45
|
+
(and more, if you think of a useful source). This “data” can
|
46
|
+
then be re-represented, sorted and filtered. You can collect data from a
|
47
|
+
multiude of sources, sort them on a common property and return a plain old
|
48
|
+
ruby object or json (You could add in something to output XML too)
|
49
|
+
</p>
|
50
|
+
<p>
|
51
|
+
## Media
|
52
|
+
</p>
|
53
|
+
<ul>
|
54
|
+
<li>[Presentation from Melbourne roro](<a
|
55
|
+
href="http://www.slideshare.net/benschwarz/smoke-1371124">www.slideshare.net/benschwarz/smoke-1371124</a>)
|
56
|
+
|
57
|
+
</li>
|
58
|
+
<li>Early [screencast](<a
|
59
|
+
href="http://vimeo.com/4272804">vimeo.com/4272804</a>) to get developer /
|
60
|
+
peer feedback
|
61
|
+
|
62
|
+
</li>
|
63
|
+
</ul>
|
64
|
+
<p>
|
65
|
+
## The concept
|
66
|
+
</p>
|
67
|
+
<p>
|
68
|
+
The concept comes from using [Yahoo Pipes](<a
|
69
|
+
href="http://pipes.yahoo.com">pipes.yahoo.com</a>) to make little mash ups,
|
70
|
+
get a list of tv shows for my torrent client, compile a recipe book or make
|
71
|
+
tools to give me a list of albums that artists in my music library are
|
72
|
+
about to be release.
|
73
|
+
</p>
|
74
|
+
<p>
|
75
|
+
## How or what to contribute
|
76
|
+
</p>
|
77
|
+
<ul>
|
78
|
+
<li>Test everything you do
|
79
|
+
|
80
|
+
</li>
|
81
|
+
<li>Add a way to output (XML, anyone?)
|
82
|
+
|
83
|
+
</li>
|
84
|
+
<li>Examples of queries you’d like to be able to do (email / github
|
85
|
+
message them to me)
|
86
|
+
|
87
|
+
</li>
|
88
|
+
</ul>
|
89
|
+
<p>
|
90
|
+
## API Examples ### YQL
|
91
|
+
</p>
|
92
|
+
<pre># This will use yahoo search to get an array of search results about Ruby
Smoke.yql(:ruby) do
 select :all
 from "search.web"
 where :query, "ruby"

 discard :title, /tuesday/i
end

Smoke.yql(:python) do
 select :all
 from "search.web"
 where :query, "python"
end</pre>
|
93
|
+
<p>
|
94
|
+
### Join sources and use them together
|
95
|
+
</p>
|
96
|
+
<pre>Smoke.join(:ruby, :python)</pre>
|
97
|
+
<p>
|
98
|
+
or even
|
99
|
+
</p>
|
100
|
+
<pre>Smoke.join(:python, :ruby) do
 emit do
 sort :title
 rename :shit_name => :title
 end
end</pre>
|
101
|
+
<p>
|
102
|
+
### Define a source allowing for variables to be injected later
|
103
|
+
</p>
|
104
|
+
<p>
|
105
|
+
Source definition:
|
106
|
+
</p>
|
107
|
+
<pre>Smoke.feed :delicious do
 prepare do
 url "http://feeds.delicious.com/v2/rss/#{username}?count=15"
 end
end</pre>
|
108
|
+
<p>
|
109
|
+
Execution:
|
110
|
+
</p>
|
111
|
+
<pre>Smoke[:delicious].username("bschwarz").output</pre>
|
112
|
+
<p>
|
113
|
+
### CI
|
114
|
+
</p>
|
115
|
+
<p>
|
116
|
+
Integrity [is running for smoke](<a
|
117
|
+
href="http://integrity.ffolio.net/smoke">integrity.ffolio.net/smoke</a>)
|
118
|
+
</p>
|
119
|
+
<p>
|
120
|
+
### TODO (working on, just mental notes)
|
121
|
+
</p>
|
122
|
+
<ul>
|
123
|
+
<li>Joined sources require a call to dispatch when their parent calls output
|
124
|
+
|
125
|
+
</li>
|
126
|
+
<li>Sources that are renamed also need their @name’s renaming
|
127
|
+
|
128
|
+
</li>
|
129
|
+
<li>Implement a disaptch / request method that will actually thread property
|
130
|
+
(event-machine)
|
131
|
+
|
132
|
+
</li>
|
133
|
+
<li>Checkout experimental fakeweb version to stub out the yql specs
|
134
|
+
|
135
|
+
</li>
|
136
|
+
</ul>
|
137
|
+
<p>
|
138
|
+
#### Later / maybe
|
139
|
+
</p>
|
140
|
+
<ul>
|
141
|
+
<li>Allow for sources to explicitly set the content type being returned for
|
142
|
+
those stupid content providers
|
143
|
+
|
144
|
+
</li>
|
145
|
+
<li>YQL w/oAuth
|
146
|
+
|
147
|
+
</li>
|
148
|
+
<li>YQL Subqueries?
|
149
|
+
|
150
|
+
</li>
|
151
|
+
</ul>
|
152
|
+
<p>
|
153
|
+
#### For wiki pages (docs, later)
|
154
|
+
</p>
|
155
|
+
<ul>
|
156
|
+
<li>How to use `path`
|
157
|
+
|
158
|
+
</li>
|
159
|
+
<li>YQL Definitions
|
160
|
+
|
161
|
+
</li>
|
162
|
+
</ul>
|
163
|
+
<p>
|
164
|
+
### Copyright
|
165
|
+
</p>
|
166
|
+
<p>
|
167
|
+
Copyright © 2009 Ben Schwarz. See LICENSE for details.
|
168
|
+
</p>
|
169
|
+
</div>
|
170
|
+
<div id='section'>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
<div id='footer-push'></div>
|
175
|
+
</div>
|
176
|
+
<div id='footer'>
|
177
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
178
|
+
</div>
|
179
|
+
</body>
|
180
|
+
</html>
|