master/lib/guard/interactor.rb

32 lines
660 B
Ruby
Raw Normal View History

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