Sha256: f24828beb9664dfc7c5fb9d7dabce391af926eaf170992c3ab7852337e9e3ee2

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 Bytes

Contents

module Guard
  class Teaspoon
    class Runner

      attr_accessor :console

      def initialize(options = {})
        @options = options

        begin
          require "teaspoon/console"
          @console = ::Teaspoon::Console.new(@options)
        rescue ::Teaspoon::EnvironmentNotFound => e
          STDOUT.print "Unable to load Teaspoon environment in {#{::Teaspoon::Environment.standard_environments.join(', ')}}.\n"
          STDOUT.print "Consider using -r path/to/teaspoon_env\n"
          abort
        end
      end

      def run_all(options = {})
        @console.execute(@options.merge(options))
      end

      def run(files = [], options = {})
        return false if files.empty?
        @console.execute(@options.merge(options), files)
      end

      private

      def abort
        exit(1)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
guard-teaspoon-0.0.4 lib/guard/teaspoon/runner.rb
guard-teaspoon-0.0.3 lib/guard/teaspoon/runner.rb