Class: Guard::Dsl
- Inherits:
-
Object
- Object
- Guard::Dsl
- Defined in:
- lib/guard/shell.rb
Instance Method Summary collapse
-
#eager(command) ⇒ Object
Eager prints the result for stdout and stderr as it would be written when running the command from the terminal.
-
#n(msg, title = '', image = nil) ⇒ Object
Easy method to display a notification.
Instance Method Details
#eager(command) ⇒ Object
Eager prints the result for stdout and stderr as it would be written when running the command from the terminal. This is useful for long running tasks.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/guard/shell.rb', line 35 def eager(command) require 'pty' begin PTY.spawn command do |r, w, pid| begin puts r.each {|line| print line } rescue Errno::EIO # the process has finished end end rescue PTY::ChildExited puts "The child process exited!" end end |
#n(msg, title = '', image = nil) ⇒ Object
Easy method to display a notification
28 29 30 |
# File 'lib/guard/shell.rb', line 28 def n(msg, title='', image=nil) Notifier.notify(msg, :title => title, :image => image) end |