Sha256: 45c243cef0c555d2c93d80cd1d6d493bbc15de0cce3ed7aca7163a5db0de9e4f

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

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
      if current[:activity] == :building and previous[:activity] == :sleeping
        notify_started_handlers name, current
      end
      return unless current[:last_build_time] != previous[:last_build_time]
      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

    def compare_repo_state name, current, previous
      return unless previous
      current.each do |branch, state|
        next unless previous[branch]
        notify_commit_handlers "#{name}/#{branch}", state, previous[branch] if state != previous[branch]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chicanery-0.1.0 lib/chicanery/state_comparison.rb
chicanery-0.0.9 lib/chicanery/state_comparison.rb
chicanery-0.0.8 lib/chicanery/state_comparison.rb
chicanery-0.0.7 lib/chicanery/state_comparison.rb
chicanery-0.0.6 lib/chicanery/state_comparison.rb
chicanery-0.0.5 lib/chicanery/state_comparison.rb