Pyre, an alternative library for Campfire
I’ve recently had reason to use 37signals’ Campfire, and thus a need for a Campfire bot. Tinder does a fine job, but I was running into issues (minor annoyances), so of course I decided to write my own library for interacting with Campfire.
And Pyre was born.
As of right now, you can log in, log out, join and leave rooms, speak and paste to rooms, and that’s it. But for something like a svn post-commit hook, that’s all you need. Pyre uses Mechanize (as opposed to Tinder’s ActiveSupport, Hpricot, and regular expressions combo) to deal with Campfire, so it was pretty easy to throw together.
Sample code? Here’s what the end of an svn post-commit hook might look like (after the message has been built):
Pyre::Campfire.new('subdomain', :ssl => true) do |campfire| campfire.login('bot@email', 'botpassword') campfire.room('Development') do |room| room.paste(message) end end
Pretty straightforward.
For the most part I tried to stay close to Tinder’s interface so that porting to Pyre would be easy, but this block style is new (and, I think, nice).
I’ll be implementing listening in a room soon enough I wager.
So go ahead and get it!
sudo gem install pyre