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.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/guard/shell.rb', line 38 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
31 32 33 |
# File 'lib/guard/shell.rb', line 31 def n(msg, title='', image=nil) Notifier.notify(msg, :title => title, :image => image) end |