public
Description: It isn't ready yet
Homepage:
Clone URL: git://github.com/benschwarz/smoke.git
smoke /
name age message
file .gitignore Sat Apr 25 03:12:18 -0700 2009 Updated .gitignore and added documentation to t... [benschwarz]
file LICENSE Mon Mar 23 01:35:10 -0700 2009 Initial commit to smoke. [benschwarz]
file README.markdown Tue Sep 29 04:42:25 -0700 2009 Updated readme to reference the newer api [benschwarz]
file Rakefile Sun Oct 25 01:15:38 -0700 2009 Moved fakeweb to be a development dependency [benschwarz]
file VERSION.yml Wed Oct 28 07:30:28 -0700 2009 Version bump to 0.5.17 [benschwarz]
directory examples/ Thu Aug 13 06:31:59 -0700 2009 Added cache to examples [benschwarz]
directory lib/ Wed Oct 28 07:30:11 -0700 2009 Added conceal and expose methods to sources (Fo... [benschwarz]
directory rdoc/ Sun Jun 14 07:03:33 -0700 2009 Update rip dependencies, corrected missing json... [benschwarz]
file smoke.gemspec Wed Oct 28 07:35:05 -0700 2009 Updated gemspec [benschwarz]
directory spec/ Wed Oct 28 07:30:11 -0700 2009 Added conceal and expose methods to sources (Fo... [benschwarz]
README.markdown

smoke

smoke is a Ruby based DSL that allows you to query web services such as YQL, RSS / Atom and JSON or XML in an elegant manner.

These "services" can then be re-represented, sorted and filtered. Data can be collected from multiple sources, sorted via a common property, chopped up and refried.

Then you can output as a plain ruby object or one of your other favourites (JSON, YAML, XML)

Examples of use

Media

Install

gem install smoke -s http://gemcutter.org

The concept

The concept comes from using Yahoo Pipes to make web based mash ups: Get a list of tv shows for my torrent client, compile a recipe book or make tools to give me a list of albums that artists in my music library are about to be released.

How or what to contribute

  • Test everything you do
  • Add a way to output (XML, anyone?)
  • Examples of queries you'd like to be able to do (email / github message them to me)

API Examples

YQL

# 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

Join sources and use them together

Smoke.join(:ruby, :python)

or even

Smoke.join(:python, :ruby) do
  emit do
    sort :title
    rename :shit_name => :title
  end
end

Define a source allowing for variables to be injected later

Source definition:

Smoke.feed :delicious do
  prepare do
    url "http://feeds.delicious.com/v2/rss/#{username}?count=15"
  end
end

Execution:

Smoke.delicious.username("bschwarz").output

TODO (working on, just mental notes)

Later / maybe

  • YQL w/oAuth
  • YQL Subqueries?
  • Implement basic auth for sources

For wiki pages (docs, later)

  • Document all sources with their irrespective differential methods
  • How to use path
  • YQL Definitions
  • Tranformations
  • Insert
  • Joining
  • Variable injection
  • Sort, Reverse
  • Keep, Discard
  • Truncate
  • Manually setting the content type for a url

Copyright

Copyright (c) 2009 Ben Schwarz. See LICENSE for details.