Skip to content

Commit

Permalink
suggested fix for issue cucumber#117
Browse files Browse the repository at this point in the history
  • Loading branch information
iromeo committed Aug 11, 2011
1 parent 6c09406 commit 25296e2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/cucumber/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
)
Expand Down

0 comments on commit 25296e2

Please sign in to comment.