Created
December 10, 2008 22:29
-
-
Save jashmenn/34518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 <[email protected]> | |
# 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