Baldrick

Description

A dogsbody. Does what you tell it. Use it to glue things together.

Baldrick recognises orders and then performs appropriate tasks. Baldrick acts as the glue between the source of the order (for example a twitter Atom feed) and the task you would like performed (put the kettle on).

Installation

Make Baldrick cower ‘neath your boot:

sudo gem install baldrick

If you want to use the injour listener you will also need to install injour

Building the Gem yourself

Grab the code from github:

git clone git://github.com/brentsnook/baldrick.git
cd baldrick
rake install_gem

Synopsis

You tell Baldrick:

  • how to perform tasks

  • which tasks will be performed when a particular order is received

  • where to listen for new orders

Baldrick keeps an ear out at the places you tell it to listen and then does its thing.

To tell Baldrick to print out a list of people in the twitterverse who desire a tasty beverage:

#cuppa.rb
require 'rubygems'
require 'baldrick_serve'

listen_to :feed, :at => 'http://search.twitter.com/search.atom?q=cup+of'

on_hearing /cup of (.*?)[\.,]/ do |beverage, order|
  puts "#{order[:who]} would like a cup of #{beverage}"  
end

Just run the script and the magic ruby fairies will take care of the rest:

ruby cuppa.rb

Dismiss Baldrick with CTRL C.

How does it all work?

The regex describes the phrase that triggers the task, the contents of any capturing groups are passed to the body of your task along with the order. The order contains who, what, where and when.

Check out wiki.github.com/brentsnook/baldrick for details.

What is it good for?

Don’t look at me, I just made it. How about these for suggestions?

  • do cool stuff based on injour statuses

  • do cool stuff based on web (RSS/Atom) feeds

  • do cool stuff with an Arduino board

  • control a continuous integration build light

  • control a nuclear power plant

We want to know what you use it for, please send us some love on the google group.

License

(The MIT License)

Copyright © 2009 Brent Snook fuglylogic.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.