class Guard::Depend::Runner

Public Instance Methods

run(cmd) click to toggle source
# File lib/guard/depend/runner.rb, line 6
def run(cmd)
  return unless cmd

  cmd = [cmd].flatten
  command = cmd.join(' ')

  begin
    UI.info("Running '#{command}'")
    Notifier.notify(command, title: 'Running', image: :success)

    sh(*cmd)

    Notifier.notify("#{command} succeeded", title: 'Success', image: :success)
  rescue Exception => e
    UI.error("Failed to run '#{command}'. Exception was: #{e.class}: #{e.message}")
    UI.debug(e.backtrace.join("\n"))

    Notifier.notify("#{command} failed with #{e}", title: 'Failed', image: :failed)
  end
end