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,57 @@
|
|
1
|
+
module Smoke
|
2
|
+
class Request # :nodoc:
|
3
|
+
class Failure < Exception # :nodoc:
|
4
|
+
attr_reader :uri
|
5
|
+
|
6
|
+
def initialize(uri, msg)
|
7
|
+
@uri = URI.parse(uri)
|
8
|
+
Smoke.log.error "Smoke Request: Failed to get from #{@uri} (#{msg})"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
SUPPORTED_TYPES = %w(json xml javascript)
|
13
|
+
@@request_options = {
|
14
|
+
:user_agent => Smoke.config[:user_agent],
|
15
|
+
:accept_encoding => "gzip"
|
16
|
+
}
|
17
|
+
|
18
|
+
attr_reader :uri, :content_type, :body, :type
|
19
|
+
|
20
|
+
def initialize(uri, options = {})
|
21
|
+
@uri, @options = uri, options
|
22
|
+
dispatch
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def dispatch
|
27
|
+
get = Smoke::Cache.fetch @uri, @@request_options
|
28
|
+
@body = get[:body]
|
29
|
+
@content_type = get[:content_type]
|
30
|
+
|
31
|
+
present! unless @options[:raw_response]
|
32
|
+
|
33
|
+
rescue RestClient::Exception => e
|
34
|
+
Failure.new(@uri, e)
|
35
|
+
end
|
36
|
+
|
37
|
+
def present!
|
38
|
+
set_type
|
39
|
+
parse!
|
40
|
+
end
|
41
|
+
|
42
|
+
def set_type
|
43
|
+
@type = @options[:type] || (SUPPORTED_TYPES.detect{|t| @content_type =~ /#{t}/ } || "unknown").to_sym
|
44
|
+
end
|
45
|
+
|
46
|
+
def parse!
|
47
|
+
case @type
|
48
|
+
when :json, :javascript
|
49
|
+
@body = ::Crack::JSON.parse(@body).symbolize_keys!
|
50
|
+
when :xml
|
51
|
+
@body = ::Crack::XML.parse(@body).symbolize_keys!
|
52
|
+
when :unknown
|
53
|
+
Smoke.log.warn "Smoke Request: Format unknown for #{@uri} (#{@content_type})"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Smoke
|
2
|
+
module Source # :nodoc:
|
3
|
+
# The "Data" source allows you to query
|
4
|
+
# datasources that are "complete" urls
|
5
|
+
# and rely on the automagic object parsing
|
6
|
+
# that smoke provides.
|
7
|
+
#
|
8
|
+
# For example, you may use this source
|
9
|
+
# to query a complete restful api call
|
10
|
+
# unpackage the xml response and get a
|
11
|
+
# clean ruby object.
|
12
|
+
#
|
13
|
+
# Data can take as many urls as you'd like
|
14
|
+
# to throw at it.
|
15
|
+
#
|
16
|
+
# Usage:
|
17
|
+
# Smoke.data(:ruby) do
|
18
|
+
# url "http://api.flickr.com/services/rest/?user_id=36821533%40N00&tags=benschwarz-site&nojsoncallback=1&method=flickr.photos.search&format=json&api_key=your_api_key_here
|
19
|
+
# path :photos, :photo
|
20
|
+
# end
|
21
|
+
class Data < Origin
|
22
|
+
attr_reader :request
|
23
|
+
|
24
|
+
# The URL that you'd like smoke to source its data from
|
25
|
+
# You can also set the type for silly servers that don't set a correct content-type (Flickr!)
|
26
|
+
# Example:
|
27
|
+
# url "http://site.com/resource.json", :type => :json
|
28
|
+
def url(source_url, options = {})
|
29
|
+
@url, @options = source_url, options
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
def dispatch
|
34
|
+
@request = Smoke::Request.new(@url, @options)
|
35
|
+
self.items = @request.body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Smoke
|
2
|
+
module Source # :nodoc:
|
3
|
+
# Feed can take multiple rss or atom feeds and munge them up together.
|
4
|
+
#
|
5
|
+
# Usage:
|
6
|
+
# Smoke.feed(:ruby) do
|
7
|
+
# url "domain.tld/rss"
|
8
|
+
# url "site.tld/atom"
|
9
|
+
# end
|
10
|
+
class Feed < Origin
|
11
|
+
attr_reader :requests
|
12
|
+
|
13
|
+
def url(feed_uri)
|
14
|
+
(@feeds ||= [] ) << feed_uri
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
def dispatch
|
19
|
+
@requests = @feeds.map{|f| Smoke::Request.new(f, {:raw_response => true}) }
|
20
|
+
self.items = @requests.map{|r| ::SimpleRSS.parse(r.body).items }.flatten
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Smoke
|
2
|
+
module Source # :nodoc:
|
3
|
+
# The "Joiner" source is a special source
|
4
|
+
# that can be used to join multiple sources together
|
5
|
+
# and proxy call dispatch for each source
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
# Smoke.join(:delicious, :twitter, :flickr) do
|
9
|
+
# path :photos, :photo
|
10
|
+
# end
|
11
|
+
class Join < Origin # :nodoc:
|
12
|
+
def initialize(names, &block)
|
13
|
+
@names = names
|
14
|
+
super((names << "joined").join("_").to_sym, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
def sources
|
19
|
+
Smoke.active_sources.find_all{|k, v| @names.include?(k) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def dispatch
|
23
|
+
# Recall dispatch
|
24
|
+
sources.each do |source|
|
25
|
+
source.last.send(:dispatch) if source.last.respond_to?(:dispatch)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Re-map items
|
29
|
+
@items = sources.map {|source| source.last.items }.flatten
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Smoke
|
2
|
+
module Source # :nodoc:
|
3
|
+
# YQL will call to Yahoo YQL services
|
4
|
+
#
|
5
|
+
# Usage:
|
6
|
+
# Smoke.yql(:ruby) do
|
7
|
+
# select :all
|
8
|
+
# from "search.web"
|
9
|
+
# where :query, "ruby"
|
10
|
+
# end
|
11
|
+
class YQL < Origin
|
12
|
+
API_BASE = "http://query.yahooapis.com/v1/public/yql"
|
13
|
+
attr_reader :request
|
14
|
+
|
15
|
+
# Select indicates what YQL will be selecting
|
16
|
+
# Usage:
|
17
|
+
# select :all
|
18
|
+
# => "SELECT *"
|
19
|
+
# select :title
|
20
|
+
# => "SELECT title"
|
21
|
+
# select :title, :description
|
22
|
+
# => "SELECT title, description"
|
23
|
+
def select(what = :all)
|
24
|
+
@select = what.join(",") and return if what.is_a? Array
|
25
|
+
@select = "*" and return if what == :all
|
26
|
+
@select = what and return
|
27
|
+
end
|
28
|
+
|
29
|
+
# from corresponds to the from fragment of the YQL query
|
30
|
+
# Usage:
|
31
|
+
# from "search.web"
|
32
|
+
# or
|
33
|
+
# from :html
|
34
|
+
def from(source)
|
35
|
+
@from = source.join(',') and return if source.is_a? Array
|
36
|
+
@from = source.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
# where is a straight up match, no fancy matchers
|
40
|
+
# are currently supported
|
41
|
+
# Usage:
|
42
|
+
# where :xpath, "//div/div/a"
|
43
|
+
# or
|
44
|
+
# where :query, "python"
|
45
|
+
def where(column, value)
|
46
|
+
@where = @where || []
|
47
|
+
@where << "#{column.to_s} = '#{value}'"
|
48
|
+
end
|
49
|
+
|
50
|
+
# `use` can be used to set the url location of the data-table
|
51
|
+
# that you want YQL to search upon
|
52
|
+
#
|
53
|
+
# Usage:
|
54
|
+
# use "http://datatables.org/alltables.env"
|
55
|
+
def use(url)
|
56
|
+
params.merge!({:env => url})
|
57
|
+
end
|
58
|
+
|
59
|
+
protected
|
60
|
+
def params
|
61
|
+
@params || @params = {}
|
62
|
+
end
|
63
|
+
|
64
|
+
def dispatch
|
65
|
+
@request = Smoke::Request.new(build_uri)
|
66
|
+
self.items = @request.body
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def build_uri
|
71
|
+
chunks = []
|
72
|
+
default_opts = {
|
73
|
+
:q => build_query,
|
74
|
+
:format => "json"
|
75
|
+
}.merge(params).each {|k,v| chunks << "#{k}=#{v}" }
|
76
|
+
|
77
|
+
return URI.encode(API_BASE + "?" + chunks.join("&"))
|
78
|
+
end
|
79
|
+
|
80
|
+
def build_query
|
81
|
+
"SELECT #{@select} FROM #{@from} WHERE #{@where.join(" AND ")}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,260 @@
|
|
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 [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'>Module</span>
|
30
|
+
Smoke
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../files/lib/smoke/request_rb.html">lib/smoke/request.rb</a>
|
35
|
+
</li>
|
36
|
+
<li class='other'>
|
37
|
+
<a href="../files/lib/smoke/origin_rb.html">lib/smoke/origin.rb</a>
|
38
|
+
</li>
|
39
|
+
<li class='other'>
|
40
|
+
<a href="../files/lib/smoke/source/data_rb.html">lib/smoke/source/data.rb</a>
|
41
|
+
</li>
|
42
|
+
<li class='other'>
|
43
|
+
<a href="../files/lib/smoke/source/feed_rb.html">lib/smoke/source/feed.rb</a>
|
44
|
+
</li>
|
45
|
+
<li class='other'>
|
46
|
+
<a href="../files/lib/smoke/source/join_rb.html">lib/smoke/source/join.rb</a>
|
47
|
+
</li>
|
48
|
+
<li class='other'>
|
49
|
+
<a href="../files/lib/smoke/source/yql_rb.html">lib/smoke/source/yql.rb</a>
|
50
|
+
</li>
|
51
|
+
<li class='other'>
|
52
|
+
<a href="../files/lib/smoke_rb.html">lib/smoke.rb</a>
|
53
|
+
</li>
|
54
|
+
<li>
|
55
|
+
<a class='show' href='#' onclick='this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false'>show all</a>
|
56
|
+
</li>
|
57
|
+
</ol>
|
58
|
+
</div>
|
59
|
+
<div id='content'>
|
60
|
+
<div id='text'>
|
61
|
+
<div id='method-list'>
|
62
|
+
<h2>Methods</h2>
|
63
|
+
<h3>public class</h3>
|
64
|
+
<ol>
|
65
|
+
<li><a href="#M000001">[]</a></li>
|
66
|
+
<li><a href="#M000002">activate</a></li>
|
67
|
+
<li><a href="#M000003">active_sources</a></li>
|
68
|
+
<li><a href="#M000007">data</a></li>
|
69
|
+
<li><a href="#M000008">feed</a></li>
|
70
|
+
<li><a href="#M000009">join</a></li>
|
71
|
+
<li><a href="#M000005">log</a></li>
|
72
|
+
<li><a href="#M000004">rename</a></li>
|
73
|
+
<li><a href="#M000006">yql</a></li>
|
74
|
+
</ol>
|
75
|
+
</div>
|
76
|
+
<div id='section'>
|
77
|
+
<div id='class-list'>
|
78
|
+
<h2>Classes and Modules</h2>
|
79
|
+
Class <a href="Smoke/Origin.html" class="link">Smoke::Origin</a><br />
|
80
|
+
</div>
|
81
|
+
<div id='attribute-list'>
|
82
|
+
<h2 class='section-bar'>Attributes</h2>
|
83
|
+
<div class='name-list'>
|
84
|
+
<table>
|
85
|
+
<tr class='top-aligned-row context-row'>
|
86
|
+
<td class='context-item-name'>active_sources</td>
|
87
|
+
<td class='context-item-value'>[R]</td>
|
88
|
+
<td class='context-item-desc'></td>
|
89
|
+
</tr>
|
90
|
+
</table>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<div id='methods'>
|
94
|
+
<h2>Public class methods</h2>
|
95
|
+
<div class='public-class method' id='method-M000001'>
|
96
|
+
<a name='M000001'> </a>
|
97
|
+
<div class='synopsis'>
|
98
|
+
<span class='name'>[]</span>
|
99
|
+
<span class='arguments'>(source)</span>
|
100
|
+
</div>
|
101
|
+
<div class='description'>
|
102
|
+
<p>
|
103
|
+
Access registered smoke source instances
|
104
|
+
</p>
|
105
|
+
<p>
|
106
|
+
Usage:
|
107
|
+
</p>
|
108
|
+
<pre>Smoke.yql(:ruby) do ....

Smoke[:ruby]
=> #<Smoke::Source::YQL::0x18428d4...</pre>
|
109
|
+
</div>
|
110
|
+
<div class='source'>
|
111
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
|
112
|
+
[show source]
|
113
|
+
</a>
|
114
|
+
<pre id='M000001-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 26</span>
26: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">source</span>)
27: <span class="ruby-identifier">active_sources</span>[<span class="ruby-identifier">source</span>]
28: <span class="ruby-keyword kw">end</span></pre>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class='public-class method' id='method-M000002'>
|
118
|
+
<a name='M000002'> </a>
|
119
|
+
<div class='synopsis'>
|
120
|
+
<span class='name'>activate</span>
|
121
|
+
<span class='arguments'>(name, source)</span>
|
122
|
+
</div>
|
123
|
+
<div class='description'>
|
124
|
+
<p>
|
125
|
+
Activates new instances of sources Source instances are stored within the
|
126
|
+
@@<a href="Smoke.html#M000003">active_sources</a> class variable for later
|
127
|
+
use
|
128
|
+
</p>
|
129
|
+
</div>
|
130
|
+
<div class='source'>
|
131
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
|
132
|
+
[show source]
|
133
|
+
</a>
|
134
|
+
<pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 33</span>
33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">activate</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">source</span>)
34: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">active_sources</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
35: <span class="ruby-constant">Smoke</span>.<span class="ruby-identifier">log</span>.<span class="ruby-identifier">warn</span> <span class="ruby-value str">"Smoke source activation: Source with idential name already initialized"</span> 
36: <span class="ruby-keyword kw">end</span>
37: <span class="ruby-identifier">active_sources</span>.<span class="ruby-identifier">update</span>({ <span class="ruby-identifier">name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">source</span> })
38: <span class="ruby-keyword kw">end</span></pre>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
<div class='public-class method' id='method-M000003'>
|
138
|
+
<a name='M000003'> </a>
|
139
|
+
<div class='synopsis'>
|
140
|
+
<span class='name'>active_sources</span>
|
141
|
+
<span class='arguments'>()</span>
|
142
|
+
</div>
|
143
|
+
<div class='description'>
|
144
|
+
<p>
|
145
|
+
Returns all activated smoke sources
|
146
|
+
</p>
|
147
|
+
</div>
|
148
|
+
<div class='source'>
|
149
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
|
150
|
+
[show source]
|
151
|
+
</a>
|
152
|
+
<pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 41</span>
41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">active_sources</span>
42: <span class="ruby-ivar">@@active_sources</span>
43: <span class="ruby-keyword kw">end</span></pre>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
<div class='public-class method' id='method-M000007'>
|
156
|
+
<a name='M000007'> </a>
|
157
|
+
<div class='synopsis'>
|
158
|
+
<span class='name'>data</span>
|
159
|
+
<span class='arguments'>(name, &block)</span>
|
160
|
+
</div>
|
161
|
+
<div class='source'>
|
162
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
|
163
|
+
[show source]
|
164
|
+
</a>
|
165
|
+
<pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 65</span>
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Data</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
<div class='public-class method' id='method-M000008'>
|
169
|
+
<a name='M000008'> </a>
|
170
|
+
<div class='synopsis'>
|
171
|
+
<span class='name'>feed</span>
|
172
|
+
<span class='arguments'>(name, &block)</span>
|
173
|
+
</div>
|
174
|
+
<div class='source'>
|
175
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
|
176
|
+
[show source]
|
177
|
+
</a>
|
178
|
+
<pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 66</span>
66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">feed</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Feed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
<div class='public-class method' id='method-M000009'>
|
182
|
+
<a name='M000009'> </a>
|
183
|
+
<div class='synopsis'>
|
184
|
+
<span class='name'>join</span>
|
185
|
+
<span class='arguments'>(*names, &block)</span>
|
186
|
+
</div>
|
187
|
+
<div class='description'>
|
188
|
+
<p>
|
189
|
+
Join multiple sources together into a single feed Usage:
|
190
|
+
</p>
|
191
|
+
<pre>Smoke.join(:delicious, :twitter, :flickr) do
 name :stream
 path :photos, :photo
end</pre>
|
192
|
+
</div>
|
193
|
+
<div class='source'>
|
194
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
|
195
|
+
[show source]
|
196
|
+
</a>
|
197
|
+
<pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 74</span>
74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">names</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">Join</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">names</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
<div class='public-class method' id='method-M000005'>
|
201
|
+
<a name='M000005'> </a>
|
202
|
+
<div class='synopsis'>
|
203
|
+
<span class='name'>log</span>
|
204
|
+
<span class='arguments'>()</span>
|
205
|
+
</div>
|
206
|
+
<div class='description'>
|
207
|
+
<p>
|
208
|
+
Log for info, debug, error and warn with:
|
209
|
+
</p>
|
210
|
+
<pre>Smoke.log.info "message"
Smoke.log.debug "message"
Smoke.log.error "message"
Smoke.log.warn "message"</pre>
|
211
|
+
</div>
|
212
|
+
<div class='source'>
|
213
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
|
214
|
+
[show source]
|
215
|
+
</a>
|
216
|
+
<pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 60</span>
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>
61: <span class="ruby-ivar">@@log</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">$stdout</span>)
62: <span class="ruby-keyword kw">end</span></pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
<div class='public-class method' id='method-M000004'>
|
220
|
+
<a name='M000004'> </a>
|
221
|
+
<div class='synopsis'>
|
222
|
+
<span class='name'>rename</span>
|
223
|
+
<span class='arguments'>(candidates)</span>
|
224
|
+
</div>
|
225
|
+
<div class='description'>
|
226
|
+
<p>
|
227
|
+
Rename a source
|
228
|
+
</p>
|
229
|
+
</div>
|
230
|
+
<div class='source'>
|
231
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
|
232
|
+
[show source]
|
233
|
+
</a>
|
234
|
+
<pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 46</span>
46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rename</span>(<span class="ruby-identifier">candidates</span>)
47: <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">|</span> 
48: <span class="ruby-identifier">active_sources</span>[<span class="ruby-identifier">o</span>].<span class="ruby-identifier">name</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_s</span>
49: <span class="ruby-identifier">active_sources</span>.<span class="ruby-identifier">rename</span>(<span class="ruby-identifier">o</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">n</span>)
50: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">active_sources</span>[<span class="ruby-identifier">n</span>]
51: <span class="ruby-keyword kw">end</span>
52: <span class="ruby-keyword kw">end</span></pre>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
<div class='public-class method' id='method-M000006'>
|
238
|
+
<a name='M000006'> </a>
|
239
|
+
<div class='synopsis'>
|
240
|
+
<span class='name'>yql</span>
|
241
|
+
<span class='arguments'>(name, &block)</span>
|
242
|
+
</div>
|
243
|
+
<div class='source'>
|
244
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
|
245
|
+
[show source]
|
246
|
+
</a>
|
247
|
+
<pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/smoke.rb, line 64</span>
64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">yql</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-constant">Smoke</span><span class="ruby-operator">::</span><span class="ruby-constant">Source</span><span class="ruby-operator">::</span><span class="ruby-constant">YQL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>); <span class="ruby-keyword kw">end</span></pre>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
<div id='footer-push'></div>
|
255
|
+
</div>
|
256
|
+
<div id='footer'>
|
257
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
258
|
+
</div>
|
259
|
+
</body>
|
260
|
+
</html>
|