Class: Cucumber::Rake::Task::ForkedCucumberRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/rake/task.rb

Overview

:nodoc:

Direct Known Subclasses

RCovCucumberRunner

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(libs, cucumber_bin, cucumber_opts, feature_files) ⇒ ForkedCucumberRunner

Returns a new instance of ForkedCucumberRunner.



50
51
52
53
54
55
56
57
# File 'lib/cucumber/rake/task.rb', line 50

def initialize(libs, cucumber_bin, cucumber_opts, feature_files)
  @args = (
    ['-I'] + load_path(libs) + 
    quoted_binary(cucumber_bin) + 
    cucumber_opts + 
    feature_files
  ).flatten
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



48
49
50
# File 'lib/cucumber/rake/task.rb', line 48

def args
  @args
end

Instance Method Details

#load_path(libs) ⇒ Object



59
60
61
# File 'lib/cucumber/rake/task.rb', line 59

def load_path(libs)
  ['"%s"' % libs.join(File::PATH_SEPARATOR)]
end

#quoted_binary(cucumber_bin) ⇒ Object



63
64
65
# File 'lib/cucumber/rake/task.rb', line 63

def quoted_binary(cucumber_bin)
  ['"%s"' % cucumber_bin]
end

#runObject



71
72
73
# File 'lib/cucumber/rake/task.rb', line 71

def run
  sh((runner + args).join(" "))
end

#runnerObject



67
68
69
# File 'lib/cucumber/rake/task.rb', line 67

def runner
  File.exist?("./Gemfile") && Gem.available?("bundler") ? ["bundle", "exec", RUBY] : [RUBY]
end