Firetower README

Table of Contents

1 Firetower

images/BaldMountainLookout.jpg

A command-line interface to the Campfire API (http://developer.37signals.com/campfire/) by Avdi Grimm

URL: http://github.com/avdi/firetower

1.1 Requirements

1.2 Install

sudo gem install firetower
firetower setup

1.3 Configuration

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

1.3.1 A simple bot

Drop this in ~/.firetower/firetower.conf for a simple (and VERY UNSAFE!) demo of a Campfire bot which will eval arbitrary Ruby code:

receive do |session, event|
  if event['type'] == 'TextMessage' && event['body'] =~ /^!eval (.*)$/
    event.room.account.paste!(event.room.name, "Eval result:\n" + eval($1).to_s)
  end
end

1.4 Usage

1.4.1 Say something in campfire

firetower say 'blah blah blah'

1.4.2 Say something to a non-default room

firetower say subdomain='mycompany' room='Water Cooler' 'blah blah blah'

1.4.3 Paste a code snippet into campfire

firetower paste < hello.rb

1.4.4 Paste from the clipboaord

firetower paste --from=clip

1.4.5 Paste the selected text

firetower paste --from=sel

1.4.6 Start server (for notifications, bots, etc.)

firetower start

1.4.7 Stop server

firetower stop

1.5 Plugin API

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 initv1.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

1.6 License

(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.

Author: Avdi Grimm <avdi@avdi.org>

Date: 2010-07-11 23:51:09 EDT

HTML generated by org-mode 6.33trans in emacs 23