2010-10-03 21:00:33 +00:00
|
|
|
module Guard
|
|
|
|
module Interactor
|
2011-05-06 17:29:24 +00:00
|
|
|
extend self
|
|
|
|
|
|
|
|
def run_all
|
|
|
|
::Guard.run do
|
|
|
|
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :run_all) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def stop
|
|
|
|
UI.info "Bye bye...", :reset => true
|
|
|
|
::Guard.listener.stop
|
|
|
|
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :stop) }
|
|
|
|
abort("\n")
|
|
|
|
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
|
2011-05-06 17:29:24 +00:00
|
|
|
run_all
|
2010-10-03 21:00:33 +00:00
|
|
|
end
|
2011-05-06 17:29:24 +00:00
|
|
|
|
2010-10-03 21:00:33 +00:00
|
|
|
# Stop (Ctrl-C)
|
|
|
|
Signal.trap('INT') do
|
2011-05-06 17:29:24 +00:00
|
|
|
stop
|
2010-10-03 21:00:33 +00:00
|
|
|
end
|
2011-05-06 17:29:24 +00:00
|
|
|
|
2010-10-03 21:00:33 +00:00
|
|
|
# Reload (Ctrl-Z)
|
|
|
|
Signal.trap('TSTP') do
|
2011-05-06 17:29:24 +00:00
|
|
|
reload
|
2010-10-03 21:00:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2011-05-06 17:29:24 +00:00
|
|
|
end
|