A command-line interface to the Campfire API (http://developer.37signals.com/campfire/) by Avdi Grimm. Also, a pretty simple way to create a Campfire bot.
URL: http://github.com/avdi/firetower
Linux
- xsel
- libnotify-bin
OS X
- growlnotify package from the Extras folder in Growl-1.x.y.dmg
- ‘Listen for incoming notifications’ is checked in the Growl Preference Pane
sudo gem install firetower firetower setup
firetower say 'blah blah blah'
firetower say subdomain='mycompany' room='Water Cooler' 'blah blah blah'
firetower paste < hello.rb
firetower paste --from=clip
firetower paste --from=sel
firetower start
firetower stop
Edit $HOME/.firetower/firetower.conf
All configuration is done in Ruby. The context is a Firetower::Sesson object. You can add handlers for events:
receive do |session, event| ... end
Or enable plugins:
use NotifyPlugin
Drop this in ~/.firetower/firetower.conf for a simple (and VERY UNSAFE!) demo of a Campfire bot which will eval arbitrary Ruby code whenever someone prefaces a message with “!eval”:
receive do |session, event|
if event.text? && event =~ /^!eval (.*)$/
event.room.paste! "Eval result:\n" + eval($1).to_s
end
end
The event hooks are HookR events, so any number of handlers can be stacked on a given event. And more advanced usage are possible; for instance, you can attach a Listener object to receive all types of events. In fact, this last is how plugins are implemented.
If you want to write your own Firetower plugins, you should create a gem that contains a path something like this:
lib/firetower/plugins/my_awesome_plugin/init_v1.rb
Firetower will load the init_v1.rb file on startup. Typically, a plugin will define a Firetower::Session::Listener class (or more than one) in the Firetower::Plugins namespace:
module Firetower
module Plugins
class MyAwesomePlugin < Firetower::Session::Listener
def startup(session)
# Some one-time startup code...
end
def receive(session, event)
# Some event-handling code...
end
end
end
end
Users can then enable your plugin by installing your gem and adding a line line to their firetower.conf:
use MyAwesomePlugin
(The MIT License)
Copyright (c) 2010 Avdi Grimm
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.