Class: Ci::ColorToStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/jenkins-remote-api/ci/helper/color_to_status.rb

Constant Summary collapse

COLOR_STATUS_MAPPING =
{
  /^blue$/              => 'success',
  /^red$/               => 'failure',
  /.*anime$/            => 'building',
  /^disabled$/          => 'disabled',
  /^aborted$/           => 'aborted',
  /^yellow$/            => 'unstable', #rare
  /^grey$/              => 'disabled',
}

Class Method Summary collapse

Class Method Details

.get_status_to(color) ⇒ Object



14
15
16
17
18
# File 'lib/jenkins-remote-api/ci/helper/color_to_status.rb', line 14

def self.get_status_to(color)
  result_color_key = COLOR_STATUS_MAPPING.keys.find { | color_regex | color_regex.match(color)}
  raise "This color '#{color}' and its corresponding status hasn't been added to library, pls contact author." if result_color_key.nil?
  COLOR_STATUS_MAPPING[result_color_key]
end