1 module MatzBot::Commands
4 require 'rexml/document'
6 GIT_URL = 'http://git.rubini.us/?p=code;a=atom'
15 trap("ABRT", "IGNORE")
16 trap("ABRT", abrt_proc)
18 trap("ABRT", abrt_proc)
21 data = open(GIT_URL).read
23 doc = REXML::Document.new(data)
25 last_hash = session[:git_last_hash]
29 REXML::XPath.each(doc, "//entry") do |entry|
30 title = REXML::XPath.first(entry, "./title")
31 link = REXML::XPath.first(entry, "./link")
32 name = REXML::XPath.first(entry, "./author/name")
33 hash = link.attributes['href'].split("=").last
35 top_hash = hash if top_hash.nil?
37 break if hash == last_hash
39 # we need to put the hast already in now, otherwise it might run the build twice.
40 session[:git_last_hash] = top_hash
43 build = IO.popen("~/continuous/bin/rubinius.zsh #{hash}", "r+") { |p| p.read }
45 say "#{person}: #{hash[0..8]}; #{build}"
46 #build.split("\n").map{|x| say " * " << x}
49 break # only run it for the very last commit
53 Signal.trap("USR2") do