Class: Cucumber::Rake::Task::ForkedCucumberRunner
- Includes:
- Rake::DSL
- Defined in:
- lib/cucumber/rake/task.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #bundler_gem_available? ⇒ Boolean
- #cmd ⇒ Object
-
#initialize(libs, cucumber_bin, cucumber_opts, bundler, feature_files) ⇒ ForkedCucumberRunner
constructor
A new instance of ForkedCucumberRunner.
- #load_path(libs) ⇒ Object
- #quoted_binary(cucumber_bin) ⇒ Object
- #run ⇒ Object
- #use_bundler ⇒ Object
Constructor Details
#initialize(libs, cucumber_bin, cucumber_opts, bundler, feature_files) ⇒ ForkedCucumberRunner
Returns a new instance of ForkedCucumberRunner.
61 62 63 64 65 66 67 |
# File 'lib/cucumber/rake/task.rb', line 61 def initialize(libs, cucumber_bin, cucumber_opts, bundler, feature_files) @libs = libs @cucumber_bin = cucumber_bin @cucumber_opts = cucumber_opts @bundler = bundler @feature_files = feature_files end |
Instance Method Details
#bundler_gem_available? ⇒ Boolean
81 82 83 84 85 |
# File 'lib/cucumber/rake/task.rb', line 81 def bundler_gem_available? Gem::Specification.find_by_name('bundler') rescue Gem::LoadError false end |
#cmd ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/cucumber/rake/task.rb', line 87 def cmd if use_bundler [ Cucumber::RUBY_BINARY, '-S', 'bundle', 'exec', 'cucumber', @cucumber_opts, @feature_files ].flatten else [ Cucumber::RUBY_BINARY, '-I', load_path(@libs), quoted_binary(@cucumber_bin), @cucumber_opts, @feature_files ].flatten end end |
#load_path(libs) ⇒ Object
69 70 71 |
# File 'lib/cucumber/rake/task.rb', line 69 def load_path(libs) ['"%s"' % @libs.join(File::PATH_SEPARATOR)] end |
#quoted_binary(cucumber_bin) ⇒ Object
73 74 75 |
# File 'lib/cucumber/rake/task.rb', line 73 def quoted_binary(cucumber_bin) ['"%s"' % cucumber_bin] end |
#run ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/cucumber/rake/task.rb', line 97 def run sh cmd.join(" ") do |ok, res| if !ok exit res.exitstatus end end end |
#use_bundler ⇒ Object
77 78 79 |
# File 'lib/cucumber/rake/task.rb', line 77 def use_bundler @bundler.nil? ? File.exist?("./Gemfile") && bundler_gem_available? : @bundler end |