Permalink
Browse files

Applied Edwin's patch to fix the -I lib problem.

  • Loading branch information...
1 parent 2cec731 commit 172c984a86b2be7f98a1bf020add0c1a6ed8bb2c @jimweirich committed Jul 3, 2008
Showing with 9 additions and 9 deletions.
  1. +6 −5 lib/rake.rb
  2. +2 −2 test/session_functional.rb
  3. +1 −2 test/test_application.rb
View
11 lib/rake.rb
@@ -1867,8 +1867,7 @@ def run
def init(app_name='rake')
standard_exception_handling do
@name = app_name
- handle_options
- collect_tasks
+ collect_tasks handle_options
end
end
@@ -2103,6 +2102,7 @@ def handle_options
# opts = GetoptLong.new(*command_line_options)
# opts.each { |opt, value| do_option(opt, value) }
+ parsed_argv = nil
opts = OptionParser.new do |opts|
opts.banner = "rake [-f rakefile] {options} targets..."
opts.separator ""
@@ -2114,7 +2114,7 @@ def handle_options
end
op_options.each { |args| opts.on(*args) }
- opts.parse(ARGV)
+ parsed_argv = opts.parse(ARGV)
end
# If class namespaces are requested, set the global options
@@ -2126,6 +2126,7 @@ def handle_options
$dryrun = options.dryrun
$silent = options.silent
end
+ return parsed_argv
rescue NoMethodError => ex
raise OptionParser::InvalidOption, "While parsing options, error = #{ex.class}:#{ex.message}"
end
@@ -2167,9 +2168,9 @@ def raw_load_rakefile # :nodoc:
# Collect the list of tasks on the command line. If no tasks are
# given, return a list containing only the default task.
# Environmental assignments are processed at this time as well.
- def collect_tasks
+ def collect_tasks(argv)
@top_level_tasks = []
- ARGV.each do |arg|
+ argv.each do |arg|
if arg =~ /^(\w+)=(.*)$/
ENV[$1] = $2
else
View
4 test/session_functional.rb
@@ -147,12 +147,12 @@ def test_file_creation_task
end
def test_dash_f_with_no_arg_foils_rakefile_lookup
- rake "-Itest/data/rakelib -rtest1 -f"
+ rake "-I test/data/rakelib -rtest1 -f"
assert_match(/^TEST1$/, @out)
end
def test_dot_rake_files_can_be_laoded_with_dash_r
- rake "-Itest/data/rakelib -rtest2 -f"
+ rake "-I test/data/rakelib -rtest2 -f"
assert_match(/^TEST2$/, @out)
end
View
3 test/test_application.rb
@@ -450,8 +450,7 @@ def @app.exit(*args)
throw :system_exit, :exit
end
@app.instance_eval do
- handle_options
- collect_tasks
+ collect_tasks handle_options
end
@tasks = @app.top_level_tasks
@app.options

0 comments on commit 172c984

Please sign in to comment.