Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

firetower

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firetower

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

#+Title: Firetower README #+AUTHOR: Avdi Grimm #+EMAIL: avdi@avdi.org

Configuration:

#+STARTUP: odd #+STARTUP: hi #+STARTUP: hidestars

*** Requirements

Linux 
- [[http://www.kfish.org/software/xsel/][xsel]]
- [[apt:libnotify-bin][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

*** 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":

#+BEGIN_SRC ruby receive do |session, event| if event.text? && event =~ /^!eval (.*)$/ event.room.paste! "Eval result:\n" + eval($1).to_s end end #+END_SRC

The event hooks are [[http://hookr.rubyforge.org][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:

#+BEGIN_SRC ruby 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 #+END_SRC

Users can then enable your plugin by installing your gem and adding a line line to their firetower.conf:

#+BEGIN_SRC ruby use MyAwesomePlugin #+END_SRC

*** Not yet implemented: ***** TODO Join/leave rooms when subscribing/unsubscribing ***** TODO 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.

FAQs

Package last updated on 06 Sep 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc