From 25296e2de4dcccf42381018351c98855def3de24 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Thu, 11 Aug 2011 16:56:46 +0400 Subject: [PATCH] suggested fix for issue #117 --- lib/cucumber/cli/options.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/cucumber/cli/options.rb b/lib/cucumber/cli/options.rb index ebced3b4c9..e11bc82903 100644 --- a/lib/cucumber/cli/options.rb +++ b/lib/cucumber/cli/options.rb @@ -46,7 +46,8 @@ class Options NO_PROFILE_SHORT_FLAG = '-P' PROFILE_LONG_FLAG = '--profile' NO_PROFILE_LONG_FLAG = '--no-profile' - + REQUIRE_SHORT_FLAG = '-r' + REQUIRE_LONG_FLAG = '--require' def self.parse(args, out_stream, error_stream, options = {}) new(out_stream, error_stream, options).parse!(args) @@ -77,7 +78,10 @@ def expanded_args_without_drb return @expanded_args_without_drb if @expanded_args_without_drb @expanded_args_without_drb = ( previous_flag_was_profile = false + previous_flag_was_require = false + @expanded_args.reject do |arg| + # ignore profiles if previous_flag_was_profile previous_flag_was_profile = false next true @@ -86,6 +90,16 @@ def expanded_args_without_drb previous_flag_was_profile = true next true end + + # accept all require options + if previous_flag_was_require + previous_flag_was_require = false + next false + end + if [REQUIRE_SHORT_FLAG, REQUIRE_LONG_FLAG].include?(arg) + previous_flag_was_require = true + next false + end arg == DRB_FLAG || @overridden_paths.include?(arg) end )