Module: Chicanery

Includes:
Persistence, Repos, Servers, Sites
Defined in:
lib/chicanery.rb,
lib/chicanery/git.rb,
lib/chicanery/site.rb,
lib/chicanery/debug.rb,
lib/chicanery/repos.rb,
lib/chicanery/sites.rb,
lib/chicanery/cctray.rb,
lib/chicanery/servers.rb,
lib/chicanery/summary.rb,
lib/chicanery/version.rb,
lib/chicanery/handlers.rb,
lib/chicanery/collections.rb,
lib/chicanery/persistence.rb

Defined Under Namespace

Modules: Cctray, Collections, Debug, Git, Handlers, Persistence, Repos, Servers, Sites, Summary Classes: Site

Constant Summary collapse

VERSION =
'0.1.9'

Instance Method Summary collapse

Methods included from Sites

#check_sites, #site, #sites

Methods included from Debug

#verbose, #verbose_blue

Methods included from Repos

#check_repos, #compare_repo_state

Methods included from Servers

#check_servers, #compare_job, #compare_jobs, #hack_for_forgetful_ci

Methods included from Persistence

#persist, #persist_state_to, #restore

Instance Method Details

#execute(args) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/chicanery.rb', line 25

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

#poll_period(seconds = nil) ⇒ Object



20
21
22
23
# File 'lib/chicanery.rb', line 20

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

#runObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/chicanery.rb', line 41

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

#run_every(poll_period) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/chicanery.rb', line 33

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