Skip to content

Instantly share code, notes, and snippets.

@jashmenn
Created December 10, 2008 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jashmenn/34518 to your computer and use it in GitHub Desktop.
Save jashmenn/34518 to your computer and use it in GitHub Desktop.
# CatNotifier - CruiseControl Notifier for irc_cat
#
# Put this file in {CruiseControl Path}/builder_plugins/installed/
# Tell the builder, whom do you want to receive build notices
# <pre><code>Project.configure do |project|
# ...
# project.cat_notifier.host = "your.irccat.host"
# project.cat_notifier.port = "yourport"
# ...
# end</code></pre>
#
# And enjoy :-)
# -Jordan Bracco <jordan@lifeisdead.net>
# updates with color by nate
class CatNotifier
attr_accessor :host, :port
def initialize(project = nil)
end
def color(number)
3.chr + number.to_s
end
def build_finished(build)
return if not build.failed?
# catsend("#{build.project.name} build #{build.label} failed :-( Build cat is not happy.")
catsend("#{color(0)}#{build.project.name} #{color(5)}build #{color(0)}#{build.label} #{color(4)}failed: #{build.url}")
CruiseControl::Log.event("Sent build failed to irccat", :debug)
end
def build_fixed(build, previous_build)
catsend("#{color(0)}#{build.project.name} #{color(3)}build #{color(0)}#{build.label} #{color(9)}fixed: #{build.url}")
CruiseControl::Log.event("Sent build fixed to irccat", :debug)
end
def catsend(message)
begin
raise "Not Configured!" if @host.nil?||@port.nil?
socket = TCPSocket.open(@host,@port)
socket.write(message + "\r\n")
rescue => e
CruiseControl::Log.event("CatNotifier Error :\n#{e}", :error)
raise
end
end
end
Project.plugin :cat_notifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment