master/lib/guard/interactor.rb

30 lines
681 B
Ruby
Raw Normal View History

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