Class: Guard::Gulp
Constant Summary collapse
- DEFAULT_SIGNAL =
:QUIT
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Gulp
constructor
A new instance of Gulp.
-
#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 = {}) ⇒ Gulp
Returns a new instance of Gulp.
8 9 10 11 12 |
# File 'lib/guard/gulp.rb', line 8 def initialize(watchers = [], = {}) @options = @pid = nil super end |
Instance Method Details
#reload ⇒ Object
Called on Ctrl-Z signal
45 46 47 48 |
# File 'lib/guard/gulp.rb', line 45 def reload UI.info 'Restarting gulp...' restart end |
#restart ⇒ Object
60 61 62 63 |
# File 'lib/guard/gulp.rb', line 60 def restart stop start end |
#run_all ⇒ Object
Called on Ctrl-/ signal
51 52 53 |
# File 'lib/guard/gulp.rb', line 51 def run_all true end |
#run_on_changes(paths) ⇒ Object
Called on file(s) modifications
56 57 58 |
# File 'lib/guard/gulp.rb', line 56 def run_on_changes(paths) restart end |
#start ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/guard/gulp.rb', line 14 def start stop UI.info 'Starting gulp...' UI.info cmd @pid = spawn(env, cmd) end |
#stop ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/guard/gulp.rb', line 22 def stop if @pid UI.info 'Stopping gulp...' UI.info 'Stopped process gulp' ::Process.kill DEFAULT_SIGNAL, @pid begin Timeout.timeout(15) do ::Process.wait @pid end rescue Timeout::Error UI.info 'Sending SIGKILL to gulp, as it\'s taking too long to shutdown.' ::Process.kill :KILL, @pid ::Process.wait @pid end UI.info 'Stopped process guard' end rescue Errno::ESRCH UI.info 'Guard::Gulp lost the Gulp subprocess!' ensure @pid = nil end |