Created
August 17, 2009 18:20
-
-
Save toto/169287 to your computer and use it in GitHub Desktop.
A simple jabber bot that tells you how a build went and some basic meta info
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
#!/usr/bin/env ruby | |
# | |
require 'rubygems' | |
gem 'xmpp4r-simple' | |
gem 'grit' | |
require 'xmpp4r-simple' | |
require 'grit' | |
include Grit | |
TO = '[email protected]' | |
exit(-1) unless ARGV.first | |
messenger = Jabber::Simple.new('[email protected]', "password") | |
message = "CI Joe on http://#{`hostname`.strip}:4567/ reports " | |
case File.basename(ARGV.first).strip) | |
when 'build-worked' | |
message << "Build SUCCESSFUL!" | |
when 'build-failed' | |
message << "Build FAILED!" | |
else | |
message << "Hello! #{ARGV.join(', ')}" | |
end | |
repo = Repo.new(Dir.pwd) | |
head = repo.commits.first | |
message << "\n" | |
message << "Revision: #{head.id_abbrev}\n" | |
message << "Date: #{head.committed_date}\n" | |
message << "From: #{head.committer.name} <#{head.committer.email}>\n" | |
message << "#{head.message}" | |
messenger.deliver TO, message | |
sleep 0.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment