Class: Guard::Test::Runner
- Inherits:
-
Object
- Object
- Guard::Test::Runner
- Defined in:
- lib/guard/test/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #bundler? ⇒ Boolean
- #drb? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Runner
constructor
A new instance of Runner.
- #rubygems? ⇒ Boolean
- #run(paths, opts = {}) ⇒ Object
- #spring? ⇒ Boolean
- #zeus? ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/guard/test/runner.rb', line 9 def initialize(opts = {}) @options = { bundler: File.exist?("#{Dir.pwd}/Gemfile"), rubygems: false, rvm: [], include: %w[lib:test], drb: false, zeus: false, spring: false, cli: '' }.merge(opts) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/guard/test/runner.rb', line 7 def @options end |
Instance Method Details
#bundler? ⇒ Boolean
30 31 32 33 34 35 |
# File 'lib/guard/test/runner.rb', line 30 def bundler? if @bundler.nil? @bundler = [:bundler] && !drb? && !zeus? && !spring? end @bundler end |
#drb? ⇒ Boolean
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/guard/test/runner.rb', line 41 def drb? if @drb.nil? @drb = [:drb] begin require 'spork-testunit' rescue LoadError end Compat::UI.info('Using testdrb to run the tests') if @drb end @drb end |
#rubygems? ⇒ Boolean
37 38 39 |
# File 'lib/guard/test/runner.rb', line 37 def rubygems? !bundler? && !zeus? && !spring? && [:rubygems] end |
#run(paths, opts = {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/guard/test/runner.rb', line 22 def run(paths, opts = {}) return true if paths.empty? Compat::UI.info(opts[:message] || "Running: #{paths.join(' ')}", reset: true) system(test_unit_command(paths)) end |
#spring? ⇒ Boolean
61 62 63 64 65 66 67 |
# File 'lib/guard/test/runner.rb', line 61 def spring? if @spring.nil? @spring = [:spring] Compat::UI.info('Using spring to run the tests') if @spring end @spring end |
#zeus? ⇒ Boolean
53 54 55 56 57 58 59 |
# File 'lib/guard/test/runner.rb', line 53 def zeus? if @zeus.nil? @zeus = [:zeus] Compat::UI.info('Using zeus to run the tests') if @zeus end @zeus end |