Class: Relevant::Hudson

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

Defined Under Namespace

Classes: Build

Constant Summary collapse

Version =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#buildsObject



89
90
91
92
93
94
95
# File 'lib/relevant/hudson.rb', line 89

def builds
  return [] unless feed.respond_to?(:entries) # Error fetching feed
  
  builds = feed.entries.map{|rss_entry| Build.new(rss_entry)}
  builds.reject! {|build| build.project.match Regexp.new(@options[:ignore_projects], true)} if @options[:ignore_projects].present?
  builds.sort
end

#feedObject



97
98
99
100
101
102
103
104
# File 'lib/relevant/hudson.rb', line 97

def feed
  return unless @options[:rss_feed].present?
  
  feed_options = {:timeout => 10}
  feed_options[:http_authentication] = [@options[:http_auth_username], @options[:http_auth_password]] if @options[:http_auth_username].present?
  
  @feed ||= Feedzirra::Feed.fetch_and_parse(@options[:rss_feed], feed_options)
end