Sha256: ec0dcb18706be855de2fbe660b8a75ce0c647ab5ffc229d6f1629bb1951fac30
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
require 'starting_blocks' require 'blinky' # fix issue where no light will cause lock-up module Blinky class LightFactory class << self alias :original_detect_lights :detect_lights def detect_lights plugins, recipes original_detect_lights plugins, recipes rescue [] end end end end module StartingBlocks module Extensions class BlinkyLighting def initialize @light = Blinky.new.light end def self.turn_off! Blinky.new.light.off! end def receive_files_to_run files @spec_count = files.count return if files.count == 0 change_color_to :yellow end def receive_results results return if @spec_count.to_i == 0 if results[:color] change_color_to results[:color] else run_the_old_logic_with results end end def run_the_old_logic_with results if (results[:tests] || 0) == 0 change_color_to :red elsif (results[:errors] || 0) > 0 change_color_to :red elsif (results[:failures] || 0) > 0 change_color_to :red elsif (results[:skips] || 0) > 0 change_color_to :yellow else change_color_to :green end end def change_color_to(color) case color when :green @light.success! when :red @light.failure! when :yellow @light.building! end rescue end end end end StartingBlocks::Publisher.subscribers << StartingBlocks::Extensions::BlinkyLighting.new
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
starting_blocks-blinky-1.0.0 | lib/starting_blocks-blinky.rb |