#!/usr/bin/ruby HOME = ENV['HOME'] LOG = "#{HOME}/log/makedepot.log" # update Rails Dir.chdir File.join(HOME,'git','rails') before = `git log -1 --pretty=format:%H` system 'git pull' Process.exit if `git log -1 --pretty=format:%H` == before # run awdwr tests Dir.chdir File.join(HOME,'git','awdwr') system 'git pull' system "ruby makedepot.rb .. | tee #{LOG}" system "diff -q makedepot.html checkdepot.html" Process.exit if $? == 0 HOSTNAME = `hostname`.chomp.split('.').first # failure message JID, PASSWORD, USER = "rubys@rubix/awdwr", "password", "rubys@rubix/Laptop" message = open(LOG) {|log| log.lines.to_a.last.chomp} uri = "http://#{HOSTNAME}/~#{ENV['USER']}/awdwr/checkdepot.html" # send message require 'rubygems' require 'xmpp4r/client' jclient = Jabber::Client.new(Jabber::JID.new(JID)) jclient.connect.auth(PASSWORD) jmessage = Jabber::Message.new(USER, "#{message}") html = jmessage.add_element('html') html.add_namespace('http://jabber.org/protocol/xhtml-im') body = html.add_element('body') body.add_namespace('http://www.w3.org/1999/xhtml') body << REXML::Document.new("#{message}").root jclient.send jmessage jclient.close