Sha256: 5f77f83703e87613265cfcd6697c81b564a4693226498ecc9952c7dc2773306d

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 Bytes

Contents

require 'rexml/document'
require "open-uri"
 
class CruiseStatus
  
  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
 
  def pass?
    failures.empty?
  end
  
  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.0.0 lib/cruise_status.rb