Sha256: cc50c7b0d6ece449b431ceb9a0c397cff69e918fe907fac051d549c7198f16bf
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'rexml/document' require "open-uri" # Checks the status of one or more project builds on a cruisecontrol.rb # server. # # == Example: # # if CruiseStatus.new( 'http://my.cruise.com/projects.rss' ).pass? # puts "Build passed!" # else # puts "Build failed…Boo!" # end # class CruiseStatus # feed_url:: # URL pointing to a cruise.rb RSS feed. # Example: "http://my.cruise.com/projects.rss" # or: "http://my.cruise.com/projects/myproject.rss"" # def initialize( feed_url ) project_feed = Kernel.open( feed_url ).read @doc = REXML::Document.new project_feed rescue Exception => e @failures = [e.message] @doc = REXML::Document.new "" end # True if all builds described by the feed are passing. # def pass? failures.empty? end # A list of failing builds. Empty if all builds passed. # def failures @failures ||= REXML::XPath.match( @doc, "//item/title" ).select { |element| element.text =~ /failed$/ }.map do |element| element.text.gsub( /(.*) build (.+) failed$/, '\1' ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cruisestatus-1.1.6 | lib/cruisestatus.rb |