Class: Relevant::Hudson::Build
- Inherits:
-
Object
- Object
- Relevant::Hudson::Build
- Defined in:
- lib/relevant/hudson.rb
Constant Summary collapse
- TitleRegexp =
/^(.*) #(\d+) \((.*)\)$/
Instance Attribute Summary collapse
-
#rss_entry ⇒ Object
readonly
Returns the value of attribute rss_entry.
Instance Method Summary collapse
- #<=>(other_build) ⇒ Object
- #building? ⇒ Boolean
- #failing? ⇒ Boolean
-
#initialize(rss_entry) ⇒ Build
constructor
A new instance of Build.
- #label ⇒ Object
- #number ⇒ Object
- #passing? ⇒ Boolean
- #project ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(rss_entry) ⇒ Build
Returns a new instance of Build.
111 112 113 |
# File 'lib/relevant/hudson.rb', line 111 def initialize(rss_entry) @rss_entry = rss_entry end |
Instance Attribute Details
#rss_entry ⇒ Object (readonly)
Returns the value of attribute rss_entry.
109 110 111 |
# File 'lib/relevant/hudson.rb', line 109 def rss_entry @rss_entry end |
Instance Method Details
#<=>(other_build) ⇒ Object
149 150 151 152 153 154 |
# File 'lib/relevant/hudson.rb', line 149 def <=>(other_build) order = ['failing','building','passing'] result = order.index(self.label) <=> order.index(other_build.label) result = self.project <=> other_build.project if result.zero? result end |
#building? ⇒ Boolean
123 124 125 |
# File 'lib/relevant/hudson.rb', line 123 def building? status.match(/^\?$/) end |
#failing? ⇒ Boolean
119 120 121 |
# File 'lib/relevant/hudson.rb', line 119 def failing? status.match(/broken/) end |
#label ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/relevant/hudson.rb', line 139 def label if passing? 'passing' elsif failing? 'failing' elsif building? 'building' end end |
#number ⇒ Object
131 132 133 |
# File 'lib/relevant/hudson.rb', line 131 def number rss_entry.title.match(TitleRegexp)[2] end |
#passing? ⇒ Boolean
115 116 117 |
# File 'lib/relevant/hudson.rb', line 115 def passing? status.match(/(stable|back to normal)/i) end |
#project ⇒ Object
127 128 129 |
# File 'lib/relevant/hudson.rb', line 127 def project rss_entry.title.match(TitleRegexp)[1] end |
#status ⇒ Object
135 136 137 |
# File 'lib/relevant/hudson.rb', line 135 def status rss_entry.title.match(TitleRegexp)[3] end |