Class: Cucumber::Cli::Main
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #execute!(step_mother) ⇒ Object
-
#initialize(args, out_stream = STDOUT, error_stream = STDERR) ⇒ Main
constructor
A new instance of Main.
- #load_files ⇒ Object
- #load_plain_text_features ⇒ Object
Constructor Details
#initialize(args, out_stream = STDOUT, error_stream = STDERR) ⇒ Main
Returns a new instance of Main.
30 31 32 33 34 |
# File 'lib/cucumber/cli/main.rb', line 30 def initialize(args, out_stream = STDOUT, error_stream = STDERR) @args = args @out_stream = out_stream == STDOUT ? Formatter::ColorIO.new : out_stream @error_stream = error_stream end |
Class Method Details
.execute(args) ⇒ Object
25 26 27 |
# File 'lib/cucumber/cli/main.rb', line 25 def execute(args) new(args).execute!(@step_mother) end |
.step_mother ⇒ Object
15 16 17 |
# File 'lib/cucumber/cli/main.rb', line 15 def step_mother @step_mother end |
.step_mother=(step_mother) ⇒ Object
19 20 21 22 23 |
# File 'lib/cucumber/cli/main.rb', line 19 def step_mother=(step_mother) @step_mother = step_mother @step_mother.extend(StepMother) @step_mother.snippet_generator = StepDefinition end |
Instance Method Details
#configuration ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/cucumber/cli/main.rb', line 86 def configuration return @configuration if @configuration @configuration = Configuration.new(@out_stream, @error_stream) @configuration.parse!(@args) @configuration end |
#execute!(step_mother) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cucumber/cli/main.rb', line 36 def execute!(step_mother) trap_interrupt if configuration.drb? begin return DRbClient.run(@args, @error_stream, @out_stream) rescue DRbClientError => e @error_stream.puts "WARNING: #{e.} Running features locally:" end end step_mother. = configuration. # Feature files must be loaded before files are required. # This is because i18n step methods are only aliased when # features are loaded. If we swap the order, the requires # will fail. features = load_plain_text_features require_files enable_diffing visitor = configuration.build_formatter_broadcaster(step_mother) step_mother.visitor = visitor # Needed to support World#announce visitor.visit_features(features) failure = if configuration.wip? step_mother.scenarios(:passed).any? else step_mother.scenarios(:failed).any? || (configuration.strict? && step_mother.steps(:undefined).any?) end rescue ProfilesNotDefinedError, YmlLoadError, ProfileNotFound => e @error_stream.puts e. true end |
#load_files ⇒ Object
94 95 96 |
# File 'lib/cucumber/cli/main.rb', line 94 def load_files each_lib{|lib| load(lib)} end |
#load_plain_text_features ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/cucumber/cli/main.rb', line 70 def load_plain_text_features features = Ast::Features.new verbose_log("Features:") configuration.feature_files.each do |f| feature_file = FeatureFile.new(f) feature = feature_file.parse(configuration.) if feature features.add_feature(feature) verbose_log(" * #{f}") end end verbose_log("\n"*2) features end |