Class: BuildLights::Hudson

Inherits:
Object
  • Object
show all
Defined in:
lib/hudson.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri, parser = FeedParser) ⇒ Hudson

Returns a new instance of Hudson.



6
7
8
9
# File 'lib/hudson.rb', line 6

def initialize(uri, parser = FeedParser)
  puts "Hudson url: #{uri}" if $verbose      
  @feed = parser.parse uri
end

Instance Method Details

#failed_jobsObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hudson.rb', line 11

def failed_jobs
  @feed.entries.each.map do |entry|
    match = /(.*) #\d+ (.*)/.match(entry.title)
    raise "Invalid rss title #{entry.title}" unless match
    name = match[1]
    status = match[2]
    puts "#{name} -> #{status}" if $verbose
    failed = /FAIL/i.match(status)
    name if failed
  end.compact
end