Tinder Continuous Integration to Campfire Script
November 30th, 2007 by pyrat
Recently signal vs noise showcased how their continuous integration tool posts to campfire using the tinder api. Well I thought that it looked cool so have thrown together a quick and dirty ruby script to do it as well.
It will integrate with anything which has an RSS feed. Cruisecontrol.rb does and works nicely. Its a bit rough around the edges but works as is. Run it from the crontab and you are sorted.
Improvements welcome.
Here is a screenshot of it posting on campfire:

Here is the code:
#!/usr/bin/ruby require 'rubygems' require 'active_record' require 'simple-rss' require 'open-uri' require 'tinder' include Tinder # Author: Alastair Brunton # http://www.simplyexcited.co.uk # Rss to Campfire campfire_domain = 'simplyexcited' campfire_email = 'cheer@cheerfactory.co.uk' campfire_password = 'xxxx' feeds = %w(http://feedserver/edflats.rss) ActiveRecord::Base.logger = Logger.new(STDERR) ActiveRecord::Base.colorize_logging = false ActiveRecord::Base.establish_connection( :adapter => "mysql", :username => "username", :password => "password", :database => "ci_to_campfire" ) # uncomment this section the first time to create the table # ActiveRecord::Schema.define do # create_table :items do |table| # table.column :feed_identifier, :string # table.column :title, :string # table.column :link, :string # table.column :description, :text # end # end class Item < ActiveRecord::Base def to_s %(Theres been some action:\n #{self.title}\n\n #{self.description} ) end end campfire = Campfire.new campfire_domain campfire.login campfire_email, campfire_password room = campfire.find_room_by_name('The Office') feeds.each do |rss_url| rss_user_agent = "RSS to Campfire" rss_items = SimpleRSS.parse open(rss_url ,"User-Agent" => rss_user_agent) for item in rss_items.items Item.transaction do unless existing_item = Item.find(:all, :conditions => ["link=? AND feed_identifier=?", item.link, rss_url]).first new_item = Item.create(:title => item.title, :link => item.link, :description => item.description, :feed_identifier => rss_url) room.paste(new_item.to_s) end end end end room.leave campfire.logout
February 12th, 2008 at 7:25 pm
[…] 13. Continuous Integration is a great technique which makes sure you dont have any broken windows in your project. Often testing on a development machine is tied too much to the environment on the development machine. Often Davey, your designer will delete an erb tag by mistake. CI involves automatically building the project after each subversion commit. Cruisecontrol.rb is your tool of choice here. As the number of projects you have configured with it grows, make sure your server has quite a bit of RAM. You can also integrate this with campfire and basecamp to use these tools as a centre to the development in your work environment. […]