Sha256: 4d7bddcc0c33d4a9057523fd12900c3297bf5e6248d168cffa6032278b2d4d62

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

module Guard
  class Teabag
    class Runner

      attr_accessor :console

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

        begin
          require "teabag/console"
          @console = ::Teabag::Console.new(@options)
        rescue ::Teabag::EnvironmentNotFound => e
          STDOUT.print "Unable to load Teabag environment in {#{::Teabag::Environment.standard_environments.join(', ')}}.\n"
          STDOUT.print "Consider using -r path/to/teabag_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-teabag-0.0.2 lib/guard/teabag/runner.rb
guard-teabag-0.0.1 lib/guard/teabag/runner.rb