Class: Guard::FastSpec::Runner
- Inherits:
-
Object
- Object
- Guard::FastSpec::Runner
- Defined in:
- lib/guard/fast_spec/runner.rb
Constant Summary collapse
- FAILURE_EXIT_CODE =
2
Instance Attribute Summary collapse
-
#fast_spec_version ⇒ Object
readonly
Returns the value of attribute fast_spec_version.
Instance Method Summary collapse
- #failure_exit_code_supported? ⇒ Boolean
- #fast_spec_class ⇒ Object
- #fast_spec_executable ⇒ Object
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #run(paths, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/guard/fast_spec/runner.rb', line 8 def initialize( = {}) @options = { :bundler => true, :binstubs => false, :rvm => nil, :cli => nil, :notification => true }.merge() deprecations_warnings end |
Instance Attribute Details
#fast_spec_version ⇒ Object (readonly)
Returns the value of attribute fast_spec_version.
4 5 6 |
# File 'lib/guard/fast_spec/runner.rb', line 4 def fast_spec_version @fast_spec_version end |
Instance Method Details
#failure_exit_code_supported? ⇒ Boolean
46 47 48 49 50 51 52 53 54 |
# File 'lib/guard/fast_spec/runner.rb', line 46 def failure_exit_code_supported? @failure_exit_code_supported ||= begin cmd_parts = [] cmd_parts << "bundle exec" if bundler? cmd_parts << fast_spec_executable cmd_parts << "--help" `#{cmd_parts.join(' ')}`.include? "--failure-exit-code" end end |
#fast_spec_class ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/guard/fast_spec/runner.rb', line 56 def fast_spec_class @fast_spec_class ||= case fast_spec_version when 1 "Spec" when 2 "RSpec" end end |
#fast_spec_executable ⇒ Object
39 40 41 42 43 44 |
# File 'lib/guard/fast_spec/runner.rb', line 39 def fast_spec_executable @fast_spec_executable ||= begin exec = fast_spec_class.downcase binstubs? ? "bin/#{exec}" : exec end end |
#run(paths, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/guard/fast_spec/runner.rb', line 20 def run(paths, = {}) return false if paths.empty? = [:message] || "Running: #{paths.join(' ')}" UI.info(, :reset => true) = @options.merge() if drb_used? run_via_drb(paths, ) else run_via_shell(paths, ) end end |