Sha256: ba940e275814824c05a443748c143629fa6efd1a963cf9ded171f901bdb179d6

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

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

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

  VERSION = "0.1.3"

  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

1 entries across 1 versions & 1 rubygems

Version Path
chicanery-0.1.3 lib/chicanery.rb