Module: Chicanery::Servers
Instance Method Summary collapse
- #check_servers(current_state, previous_state) ⇒ Object
- #compare_job(name, current, previous) ⇒ Object
- #compare_jobs(current_jobs, previous_jobs) ⇒ Object
Instance Method Details
#check_servers(current_state, previous_state) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/chicanery/servers.rb', line 9 def check_servers current_state, previous_state current_state[:servers] = {} servers.each do |server| current_jobs = server.jobs compare_jobs current_jobs, previous_state[:servers][server.name] if previous_state[:servers] current_state[:servers][server.name] = current_jobs end end |
#compare_job(name, current, previous) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/chicanery/servers.rb', line 25 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 |
#compare_jobs(current_jobs, previous_jobs) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/chicanery/servers.rb', line 18 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 |