master/lib/guard/interactor.rb

42 lines
787 B
Ruby
Raw Normal View History

2010-10-03 21:00:33 +00:00
module Guard
module Interactor
extend self
def run_all
::Guard.run do
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :run_all) }
end
end
def stop
2011-05-06 20:58:18 +00:00
UI.info "Bye bye...\n", :reset => true
::Guard.listener.stop
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :stop) }
2011-05-06 20:58:18 +00:00
abort
end
def reload
::Guard.run do
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :reload) }
end
end
2010-10-03 21:00:33 +00:00
def self.init_signal_traps
# Run all (Ctrl-\)
Signal.trap('QUIT') do
run_all
2010-10-03 21:00:33 +00:00
end
2010-10-03 21:00:33 +00:00
# Stop (Ctrl-C)
Signal.trap('INT') do
stop
2010-10-03 21:00:33 +00:00
end
2010-10-03 21:00:33 +00:00
# Reload (Ctrl-Z)
Signal.trap('TSTP') do
reload
2010-10-03 21:00:33 +00:00
end
end
end
end