Sha256: 667da2185ac2d6541ab5a56415f1e901bead6f01cd01dde2d58a23e21829ec06

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

if ENV['COVERAGE']
  require 'simplecov'
  require 'simplecov-gem-adapter'
  SimpleCov.start 'gem'
end

require 'chicanery/version'
require 'chicanery/persistence'
require 'chicanery/servers'
require 'chicanery/repos'
require 'chicanery/sites'
require 'chicanery/summary'

module Chicanery
  include Persistence
  include Servers
  include Repos
  include Sites

  def poll_period seconds=nil
    @poll_period = seconds if seconds
    @poll_period
  end

  def execute args
    begin
      load args.shift
      run_every poll_period
    rescue Interrupt
    end
  end

  def run_every poll_period
    loop do
      run
      break unless poll_period
      sleep poll_period
    end
  end

  def run
    previous_state = restore
    current_state = {}
    check_servers current_state, previous_state
    check_repos current_state, previous_state
    check_sites current_state, previous_state
    current_state.extend Chicanery::Summary
    run_handlers.each {|handler| handler.call current_state, previous_state }
    persist current_state
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chicanery-0.2.0 lib/chicanery.rb
chicanery-0.1.9 lib/chicanery.rb