Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Look sharp, the build just went red (on Campfire)!

In order to post to our Campfire chat when the CI goes red, we threw the following script in script/campfire_post:

#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'uri'
require 'json'

url = URI.parse('http://SUBDOMAIN.campfirenow.com/room/ROOM_ID/speak.json')
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'API_KEY', 'X' # leave the X
req.body = JSON.dump({ :message => { :body => ARGV.first }})
req.content_type = 'application/json'
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
case res
  when Net::HTTPSuccess, Net::HTTPRedirection
    # OK
  else
    res.error!
end

And then in cruise.rake:

desc "The task that cruisecontrol.rb runs"
task :cruise do
  begin
    rake "spec"
    # etc
    # etc
  rescue
    exclaim = ["Oh goodness, t", "OMG t", "Look sharp, t", "Attention everyone! T", "Ohnoes! T"][rand * 5]
    system "ruby script/campfire_post '#{exclaim}he build just went red!'"
    raise
  end
end

And it’s even cheeky!

Comments
  1. Chad Woolley says:

    There is a Campfire Notifier plugin for CruiseControl.rb at [http://github.com/thoughtworks/cruisecontrol.rb-contrib/tree/master/plugins/campfire_notifier/](http://github.com/thoughtworks/cruisecontrol.rb-contrib/tree/master/plugins/campfire_notifier/).

    I don’t think it’s this cheeky, though.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *