Sha256: 6c0ed71433c16852fa2ee754f53a560b1abcdd9c35d00a6e3a7676bcc674c889

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

require 'rake'

module Guard
  class Depend
    class Runner
      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

      private
      include FileUtils
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-depend-0.1.0 lib/guard/depend/runner.rb