Class: CruiseStatus
- Inherits:
-
Object
- Object
- CruiseStatus
- Defined in:
- lib/cruisestatus.rb
Overview
Instance Method Summary collapse
-
#failures ⇒ Object
A list of failing builds.
-
#initialize(feed_url) ⇒ CruiseStatus
constructor
- feed_url
-
URL pointing to a cruise.rb RSS feed.
-
#pass? ⇒ Boolean
True if all builds described by the feed are passing.
Constructor Details
#initialize(feed_url) ⇒ CruiseStatus
- feed_url
-
URL pointing to a cruise.rb RSS feed. Example: “my.cruise.com/projects.rss” or: “my.cruise.com/projects/myproject.rss”“
21 22 23 24 25 26 27 |
# File 'lib/cruisestatus.rb', line 21 def initialize( feed_url ) project_feed = Kernel.open( feed_url ).read @doc = REXML::Document.new project_feed rescue Exception => e @failures = [e.] @doc = REXML::Document.new "" end |
Instance Method Details
#failures ⇒ Object
A list of failing builds. Empty if all builds passed.
37 38 39 40 41 42 43 |
# File 'lib/cruisestatus.rb', line 37 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 |
#pass? ⇒ Boolean
True if all builds described by the feed are passing.
31 32 33 |
# File 'lib/cruisestatus.rb', line 31 def pass? failures.empty? end |