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

March 3, 2010 Pivotal Labs

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!

About the Author

Biography

Previous
Tweed 1.5: Bug Fixes and Video Beta
Tweed 1.5: Bug Fixes and Video Beta

Version 1.5 has been submitted and should be in the App Catalog soon. Bugs Load More showing gaps in hom...

Next
New Yorkers, looking for a new challenge? Come work for a Pivotal client!
New Yorkers, looking for a new challenge? Come work for a Pivotal client!

At Pivotal Labs, one of the services we provide is bootstrapping startups, including helping them interview...

×

Subscribe to our Newsletter

!
Thank you!
Error - something went wrong!