Class: Guard::Clockwork
Constant Summary collapse
- DEFAULT_CLOCKFILE =
'config/clock.rb'
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Clockwork
constructor
A new instance of Clockwork.
-
#reload ⇒ Object
Called on Ctrl-Z signal.
- #restart ⇒ Object
-
#run_all ⇒ Object
Called on Ctrl-/ signal.
-
#run_on_changes(paths) ⇒ Object
Called on file(s) modifications.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Clockwork
Returns a new instance of Clockwork.
9 10 11 12 13 14 |
# File 'lib/guard/clockwork.rb', line 9 def initialize(watchers = [], = {}) @options = @pid = nil @clockfile = [:clockfile] || DEFAULT_CLOCKFILE super end |
Instance Method Details
#reload ⇒ Object
Called on Ctrl-Z signal
38 39 40 41 |
# File 'lib/guard/clockwork.rb', line 38 def reload UI.info 'Restarting clockwork...' restart end |
#restart ⇒ Object
53 54 55 56 |
# File 'lib/guard/clockwork.rb', line 53 def restart stop start end |
#run_all ⇒ Object
Called on Ctrl-/ signal
44 45 46 |
# File 'lib/guard/clockwork.rb', line 44 def run_all true end |
#run_on_changes(paths) ⇒ Object
Called on file(s) modifications
49 50 51 |
# File 'lib/guard/clockwork.rb', line 49 def run_on_changes(paths) restart end |
#start ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/guard/clockwork.rb', line 16 def start stop UI.info 'Starting up clockwork...' UI.info cmd @pid = spawn({}, cmd) end |
#stop ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/guard/clockwork.rb', line 24 def stop if @pid UI.info 'Stopping clockwork...' ::Process.kill :INT, @pid ::Process.wait @pid UI.info 'Stopped process clockwork' end rescue Errno::ESRCH UI.info 'Guard::Clockwork lost the subprocess!' ensure @pid = nil end |