Skip to content

Instantly share code, notes, and snippets.

@toto
Created August 17, 2009 18:20
Show Gist options
  • Save toto/169287 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby
#
require 'rubygems'
gem 'xmpp4r-simple'
gem 'grit'
require 'xmpp4r-simple'
require 'grit'
include Grit
TO = 'your-jabber-id@example.org'
exit(-1) unless ARGV.first
messenger = Jabber::Simple.new('your-bot@example.org', "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