Sha256: 4adde8a53ec68b95dc26701e7148c14bb0f9bbcc91f8d5f9c69552f35f067953

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 Bytes

Contents

module Chicanery
  module StateComparison
    def compare_jobs current_jobs, previous_jobs
      return unless previous_jobs
      current_jobs.each do |job_name, job|
        compare_job job_name, job, previous_jobs[job_name] if previous_jobs[job_name]
      end
    end

    def compare_job name, current, previous
      return unless current[:last_build_time] != previous[:last_build_time]
      if current[:activity] == :building and previous[:activity] == :sleeping
        notify_started_handlers name, current
        return
      end
      notify_succeeded_handlers name, current if current[:last_build_status] == :success
      notify_failed_handlers name, current if current[:last_build_status] == :failure
      notify_broken_handlers name, current if current[:last_build_status] == :failure and previous[:last_build_status] == :success
      notify_fixed_handlers name, current if current[:last_build_status] == :success and previous[:last_build_status] == :failure
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chicanery-0.0.4 lib/chicanery/state_comparison.rb