February 21, 2008 at 9:36 am
· Filed under Pyre, Ruby
I’ve released version 0.3.0 of Pyre, an alternative ruby library for interacting with Campfire from 37signals. Pyre now supports uploading files to a room! Observe:
require 'rubygems'
require 'pyre'
Pyre::Campfire.new('pyre') do |campfire|
campfire.login('bot@seriouslyreal.com', '12345')
campfire.room('Hot Chat') do |room|
room.upload('/path/to/animated.gif')
room.speak('What a cat!')
end
end
Also, now there’s a contrib directory which will hold examples of things to do with Pyre. Currently, the only thing in there is a Subversion repository post-commit hook for putting really nice messages about commits into a Campfire room. It’s really nice. Out of the box they look like this:
cms commited revision 104
*************************
Fixed all spelling mistaeks in the README
*************************
U pyre/trunk/README
I’m hoping to expand that contrib dir. I’m hoping people will help too.
Anyway, get it and use it.
sudo gem install pyre
Permalink
February 17, 2008 at 7:21 pm
· Filed under Pyre, Ruby
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
Permalink