class Guard::Dsl

Public Instance Methods

eager(command) click to toggle source

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.

# File lib/guard/shell.rb, line 37
def eager(command)
  require 'pty'

  begin
    PTY.spawn command do |r, w, pid|
      begin
        $stdout.puts
        r.each {|line| print line }
      rescue Errno::EIO
        # the process has finished
      end
    end
  rescue PTY::ChildExited
    $stdout.puts "The child process exited!"
  end
end
n(msg, title='', image=nil) click to toggle source

Easy method to display a notification

# File lib/guard/shell.rb, line 30
def n(msg, title='', image=nil)
  Compat::UI.notify(msg, :title => title, :image => image)
end