Class: Cucumber::Rake::Task
- Defined in:
- lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb
Overview
Defines a task for running features.
Direct Known Subclasses
Constant Summary collapse
- LIB =
File.(File.dirname(__FILE__) + '/../..')
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
- #arguments_for_ruby_execution(task_args = nil) ⇒ Object
- #define_task ⇒ Object
-
#feature_files(task_args = nil) ⇒ Object
:nodoc:.
-
#initialize(task_name = "features", desc = "Run Features with Cucumber") {|_self| ... } ⇒ Task
constructor
Define a task.
-
#step_files(task_args = nil) ⇒ Object
:nodoc:.
Constructor Details
#initialize(task_name = "features", desc = "Run Features with Cucumber") {|_self| ... } ⇒ Task
Define a task
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 19 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_task end |
Instance Attribute Details
#cucumber_opts ⇒ Object
Returns the value of attribute cucumber_opts.
14 15 16 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 14 def cucumber_opts @cucumber_opts end |
#feature_list ⇒ Object
Returns the value of attribute feature_list.
12 13 14 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 12 def feature_list @feature_list end |
#feature_pattern ⇒ Object
Returns the value of attribute feature_pattern.
13 14 15 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 13 def feature_pattern @feature_pattern end |
#libs ⇒ Object
Returns the value of attribute libs.
9 10 11 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 9 def libs @libs end |
#rcov ⇒ Object
Returns the value of attribute rcov.
15 16 17 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 15 def rcov @rcov end |
#rcov_opts ⇒ Object
Returns the value of attribute rcov_opts.
16 17 18 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 16 def rcov_opts @rcov_opts end |
#step_list ⇒ Object
Returns the value of attribute step_list.
10 11 12 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 10 def step_list @step_list end |
#step_pattern ⇒ Object
Returns the value of attribute step_pattern.
11 12 13 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 11 def step_pattern @step_pattern end |
Instance Method Details
#arguments_for_ruby_execution(task_args = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 38 def arguments_for_ruby_execution(task_args = nil) lib_args = ['"%s"' % ([LIB] + libs).join(File::PATH_SEPARATOR)] cucumber_bin = ['"%s"' % Cucumber::BINARY] cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)] step_files(task_args).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(task_args)).flatten else args = (['-I'] + lib_args + cucumber_bin + cuc_opts + feature_files(task_args)).flatten end args end |
#define_task ⇒ Object
31 32 33 34 35 36 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 31 def define_task desc @desc task @task_name do ruby(arguments_for_ruby_execution.join(" ")) # ruby(*args) is broken on Windows end end |
#feature_files(task_args = nil) ⇒ Object
:nodoc:
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 58 def feature_files(task_args = nil) # :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(task_args = nil) ⇒ Object
:nodoc:
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/rake/task.rb', line 69 def step_files(task_args = nil) # :nodoc: if ENV['STEPS'] FileList[ ENV['STEPS'] ] else result = [] result += Array(step_list) if step_list result += Array(FileList[step_pattern]) if step_pattern FileList[result] end end |