Module: Crabfarm::Modes::Live

Extended by:
Live
Included in:
Live
Defined in:
lib/crabfarm/modes/live.rb

Instance Method Summary collapse

Instance Method Details

#start_watchObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/crabfarm/modes/live.rb', line 9

def start_watch
  begin
    Crabfarm.enable_debugging!
    Crabfarm.install_live_backend!
    Crabfarm.live.start

    controller = Crabfarm::Live::Controller.new Crabfarm.live
    watcher = Crabfarm::Live::Watcher.new controller
    watcher.watch 0.2

  rescue SystemExit, Interrupt
    # nothing
  rescue Exception => e
    puts "Fatal error: #{e.to_s}".color Console::Colors::ERROR
    puts e.backtrace
  ensure
    puts 'Exiting'
    Crabfarm.live.stop rescue nil
  end
end