Class: Cucumber::Rake::Task
- Inherits:
-
Object
- Object
- Cucumber::Rake::Task
- Defined in:
- lib/cucumber/rake/task.rb
Overview
Defines a task for running features.
Constant Summary collapse
- LIB =
File.(File.dirname(__FILE__) + '/../..')
- BINARY =
File.(File.dirname(__FILE__) + '/../../../bin/cucumber')
Instance Attribute Summary collapse
-
#cucumber_opts ⇒ Object
Returns the value of attribute cucumber_opts.
-
#feature_list ⇒ Object
Returns the value of attribute feature_list.
-
#feature_pattern ⇒ Object
Returns the value of attribute feature_pattern.
-
#libs ⇒ Object
Returns the value of attribute libs.
-
#rcov ⇒ Object
Returns the value of attribute rcov.
-
#rcov_opts ⇒ Object
Returns the value of attribute rcov_opts.
-
#step_list ⇒ Object
Returns the value of attribute step_list.
-
#step_pattern ⇒ Object
Returns the value of attribute step_pattern.
Instance Method Summary collapse
- #define_tasks ⇒ Object
-
#feature_files ⇒ Object
:nodoc:.
-
#initialize(task_name = "features", desc = "Run Features with Cucumber") {|_self| ... } ⇒ Task
constructor
Define a task.
-
#step_files ⇒ Object
:nodoc:.
Constructor Details
#initialize(task_name = "features", desc = "Run Features with Cucumber") {|_self| ... } ⇒ Task
Define a task
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cucumber/rake/task.rb', line 18 def initialize(task_name = "features", desc = "Run Features with Cucumber") @task_name, @desc = task_name, desc @libs = [] @rcov_opts = %w{--rails --exclude osx\/objc,gems\/} yield self if block_given? @feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil? @step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil? define_tasks end |
Instance Attribute Details
#cucumber_opts ⇒ Object
Returns the value of attribute cucumber_opts.
13 14 15 |
# File 'lib/cucumber/rake/task.rb', line 13 def cucumber_opts @cucumber_opts end |
#feature_list ⇒ Object
Returns the value of attribute feature_list.
11 12 13 |
# File 'lib/cucumber/rake/task.rb', line 11 def feature_list @feature_list end |
#feature_pattern ⇒ Object
Returns the value of attribute feature_pattern.
12 13 14 |
# File 'lib/cucumber/rake/task.rb', line 12 def feature_pattern @feature_pattern end |
#libs ⇒ Object
Returns the value of attribute libs.
8 9 10 |
# File 'lib/cucumber/rake/task.rb', line 8 def libs @libs end |
#rcov ⇒ Object
Returns the value of attribute rcov.
14 15 16 |
# File 'lib/cucumber/rake/task.rb', line 14 def rcov @rcov end |
#rcov_opts ⇒ Object
Returns the value of attribute rcov_opts.
15 16 17 |
# File 'lib/cucumber/rake/task.rb', line 15 def rcov_opts @rcov_opts end |
#step_list ⇒ Object
Returns the value of attribute step_list.
9 10 11 |
# File 'lib/cucumber/rake/task.rb', line 9 def step_list @step_list end |
#step_pattern ⇒ Object
Returns the value of attribute step_pattern.
10 11 12 |
# File 'lib/cucumber/rake/task.rb', line 10 def step_pattern @step_pattern end |
Instance Method Details
#define_tasks ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cucumber/rake/task.rb', line 30 def define_tasks desc @desc task @task_name do lib_args = ['"%s"' % ([LIB] + libs).join(File::PATH_SEPARATOR)] cucumber_bin = ['"%s"' % BINARY] cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)] step_files.each do |step_file| cuc_opts << '--require' cuc_opts << step_file end if rcov args = (['-I'] + lib_args + ['-S', 'rcov'] + rcov_opts + cucumber_bin + ['--'] + cuc_opts + feature_files).flatten else args = (['-I'] + lib_args + cucumber_bin + cuc_opts + feature_files).flatten end ruby(args.join(" ")) # ruby(*args) is broken on Windows end end |
#feature_files ⇒ Object
:nodoc:
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cucumber/rake/task.rb', line 52 def feature_files # :nodoc: if ENV['FEATURE'] FileList[ ENV['FEATURE'] ] else result = [] result += feature_list.to_a if feature_list result += FileList[feature_pattern].to_a if feature_pattern FileList[result] end end |
#step_files ⇒ Object
:nodoc:
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/cucumber/rake/task.rb', line 63 def step_files # :nodoc: if ENV['STEPS'] FileList[ ENV['STEPS'] ] else result = [] result += step_list.to_a if step_list result += FileList[step_pattern].to_a if step_pattern FileList[result] end end |