Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A command-line interface to Campfire chats

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 example
Octocat-spinner-32 images
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .bnsignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 History.txt
Octocat-spinner-32 README.org
Octocat-spinner-32 Rakefile
Octocat-spinner-32 version.txt
README.org

Firetower README

Firetower

images/BaldMountainLookout.jpg

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

Requirements

Linux

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

Install

sudo gem install firetower
firetower setup

Command Usage

Say something in campfire
firetower say 'blah blah blah'
Say something to a non-default room
firetower say subdomain='mycompany' room='Water Cooler' 'blah blah blah'
Paste a code snippet into campfire
firetower paste < hello.rb
Paste from the clipboaord
firetower paste --from=clip
Paste the selected text
firetower paste --from=sel
Start server (for notifications, bots, etc.)
firetower start
Stop server
firetower stop

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
Creating a bot

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.

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

Not yet implemented:

Join/leave rooms when subscribing/unsubscribing
Fire all defined hooks, including :shutdown and :leave

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.

Something went wrong with that request. Please try again.