Class: Guard::Minitest::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/minitest/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Runner

Returns a new instance of Runner.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/guard/minitest/runner.rb', line 14

def initialize(options = {})
  @options = {
    :verbose  => false,
    :notify   => true,
    :bundler  => File.exist?("#{Dir.pwd}/Gemfile"),
    :rubygems => false,
    :drb      => false,
    :colour   => false,
    :color    => false,
    :all      => %w{test spec}
  }.merge(options)

  @options[:all] = [@options[:all]].flatten
end

Class Method Details

.run(paths = [], options = {}) ⇒ Object



8
9
10
# File 'lib/guard/minitest/runner.rb', line 8

def run(paths = [], options = {})
  Runner.new(options).run(paths, options)
end

Instance Method Details

#allObject



35
36
37
# File 'lib/guard/minitest/runner.rb', line 35

def all
  @options[:all]
end

#bundler?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/guard/minitest/runner.rb', line 51

def bundler?
  @options[:bundler]
end

#colour?Boolean Also known as: color?

Returns:

  • (Boolean)


63
64
65
66
# File 'lib/guard/minitest/runner.rb', line 63

def colour?
  gems_can_be_loaded = rubygems? || bundler?
  gems_can_be_loaded && (@options[:colour] || @options[:color])
end

#drb?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/guard/minitest/runner.rb', line 59

def drb?
  @options[:drb]
end

#notify?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/guard/minitest/runner.rb', line 47

def notify?
  @options[:notify]
end

#rubygems?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/guard/minitest/runner.rb', line 55

def rubygems?
  !bundler? && @options[:rubygems]
end

#run(paths, options = {}) ⇒ Object



29
30
31
32
33
# File 'lib/guard/minitest/runner.rb', line 29

def run(paths, options = {})
  message = options[:message] || "Running: #{paths.join(' ')}"
  UI.info message, :reset => true
  system(minitest_command(paths))
end

#seedObject



39
40
41
# File 'lib/guard/minitest/runner.rb', line 39

def seed
  @options[:seed]
end

#verbose?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/guard/minitest/runner.rb', line 43

def verbose?
  @options[:verbose]
end