ruby-changes:36645
From: hsbt <ko1@a...>
Date: Sat, 6 Dec 2014 09:23:02 +0900 (JST)
Subject: [ruby-changes:36645] hsbt:r48726 (trunk): * lib/rake: Update to rake 10.4.2
hsbt 2014-12-06 09:22:51 +0900 (Sat, 06 Dec 2014) New Revision: 48726 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48726 Log: * lib/rake: Update to rake 10.4.2 * test/rake: ditto. Modified files: trunk/ChangeLog trunk/lib/rake/application.rb trunk/lib/rake/dsl_definition.rb trunk/lib/rake.rb trunk/test/rake/test_rake_application.rb trunk/test/rake/test_rake_application_options.rb trunk/test/rake/test_rake_test_task.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 48725) +++ ChangeLog (revision 48726) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Dec 6 09:22:45 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> + + * lib/rake: Update to rake 10.4.2 + * test/rake: ditto. + Sat Dec 6 06:48:03 2014 Eric Wong <e@8...> * compile.c (rb_iseq_build_from_ary): remove misc handling Index: lib/rake/dsl_definition.rb =================================================================== --- lib/rake/dsl_definition.rb (revision 48725) +++ lib/rake/dsl_definition.rb (revision 48726) @@ -159,6 +159,8 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/dsl_definition.rb#L159 end # Describes the next rake task. Duplicate descriptions are discarded. + # Descriptions are shown with <code>rake -T</code> (up to the first + # sentence) and <code>rake -D</code> (the entire description). # # Example: # desc "Run the Unit Tests" Index: lib/rake/application.rb =================================================================== --- lib/rake/application.rb (revision 48725) +++ lib/rake/application.rb (revision 48726) @@ -20,9 +20,6 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L20 include TaskManager include TraceOutput - # The command-line arguments rake is using (defaults to ARGV) - attr_reader :argv # :nodoc: - # The name of the application (typically 'rake') attr_reader :name @@ -48,7 +45,6 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L45 # Initialize a Rake::Application object. def initialize super - @argv = ARGV.dup @name = 'rake' @rakefiles = DEFAULT_RAKEFILES.dup @rakefile = nil @@ -77,8 +73,6 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L73 # call +top_level+ to run your top level tasks. def run standard_exception_handling do - @argv = argv - init load_rakefile top_level @@ -89,8 +83,8 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L83 def init(app_name='rake') standard_exception_handling do @name = app_name - handle_options - collect_command_line_tasks + args = handle_options + collect_command_line_tasks(args) end end @@ -622,7 +616,9 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L616 end private :select_trace_output - # Read and handle the command line options. + # Read and handle the command line options. Returns the command line + # arguments that we didn't understand, which should (in theory) be just + # task names and env vars. def handle_options # :nodoc: options.rakelib = ['rakelib'] options.trace_output = $stderr @@ -639,7 +635,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L635 standard_rake_options.each { |args| opts.on(*args) } opts.environment('RAKEOPT') - end.parse! @argv + end.parse(ARGV) end # Similar to the regular Ruby +require+ command, but will check @@ -733,9 +729,14 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L729 # 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_command_line_tasks # :nodoc: + # + # `args` is the list of arguments to peruse to get the list of tasks. + # It should be the command line that was given to rake, less any + # recognised command-line options, which OptionParser.parse will + # have taken care of already. + def collect_command_line_tasks(args) # :nodoc: @top_level_tasks = [] - @argv.each do |arg| + args.each do |arg| if arg =~ /^(\w+)=(.*)$/m ENV[$1] = $2 else Index: lib/rake.rb =================================================================== --- lib/rake.rb (revision 48725) +++ lib/rake.rb (revision 48726) @@ -21,7 +21,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake.rb#L21 #++ module Rake - VERSION = '10.4.0' + VERSION = '10.4.2' end require 'rake/version' Index: test/rake/test_rake_application_options.rb =================================================================== --- test/rake/test_rake_application_options.rb (revision 48725) +++ test/rake/test_rake_application_options.rb (revision 48726) @@ -457,8 +457,8 @@ class TestRakeApplicationOptions < Rake: https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application_options.rb#L457 throw :system_exit, :exit end @app.instance_eval do - handle_options - collect_command_line_tasks + args = handle_options + collect_command_line_tasks(args) end @tasks = @app.top_level_tasks @app.options Index: test/rake/test_rake_test_task.rb =================================================================== --- test/rake/test_rake_test_task.rb (revision 48725) +++ test/rake/test_rake_test_task.rb (revision 48726) @@ -97,17 +97,22 @@ class TestRakeTestTask < Rake::TestCase https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_test_task.rb#L97 end def test_run_code_rake_default_gem + skip 'this ruby does not have default gems' unless + Gem::Specification.method_defined? :default_specifications_dir + default_spec = Gem::Specification.new 'rake', 0 default_spec.loaded_from = File.join Gem::Specification.default_specifications_dir, 'rake-0.gemspec' - rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec + begin + rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec - test_task = Rake::TestTask.new do |t| - t.loader = :rake - end + test_task = Rake::TestTask.new do |t| + t.loader = :rake + end - assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code) - ensure - Gem.loaded_specs['rake'] = rake + assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code) + ensure + Gem.loaded_specs['rake'] = rake + end end def test_run_code_testrb_ruby_1_8_2 Index: test/rake/test_rake_application.rb =================================================================== --- test/rake/test_rake_application.rb (revision 48725) +++ test/rake/test_rake_application.rb (revision 48726) @@ -10,9 +10,9 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L10 end def setup_command_line(*options) - @app.argv.clear + ARGV.clear options.each do |option| - @app.argv << option + ARGV << option end end @@ -268,7 +268,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L268 end def test_load_rakefile_not_found - @app.argv.clear + ARGV.clear Dir.chdir @tempdir ENV['RAKE_SYSTEM'] = 'not_exist' @@ -370,7 +370,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L370 # HACK no assertions end - def test_handle_options_should_strip_options_from_argv + def test_handle_options_should_not_strip_options_from_argv assert !@app.options.trace valid_option = '--trace' @@ -378,7 +378,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L378 @app.handle_options - assert !@app.argv.include?(valid_option) + assert ARGV.include?(valid_option) assert @app.options.trace end @@ -406,14 +406,14 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L406 setup_command_line("--trace", "sometask") @app.handle_options - assert @app.argv.include?("sometask") + assert ARGV.include?("sometask") assert @app.options.trace end def test_good_run ran = false - @app.argv << '--rakelib=""' + ARGV << '--rakelib=""' @app.options.silent = true @@ -468,7 +468,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L468 } assert_match(/see full trace/i, err) ensure - @app.argv.clear + ARGV.clear end def test_bad_run_with_trace @@ -479,7 +479,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L479 } refute_match(/see full trace/i, err) ensure - @app.argv.clear + ARGV.clear end def test_bad_run_with_backtrace @@ -492,7 +492,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L492 } refute_match(/see full trace/, err) ensure - @app.argv.clear + ARGV.clear end CustomError = Class.new(RuntimeError) @@ -549,7 +549,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L549 end assert_match(/Secondary Error/, err) ensure - @app.argv.clear + ARGV.clear end def test_run_with_bad_options @@ -559,7 +559,7 @@ class TestRakeApplication < Rake::TestCa https://github.com/ruby/ruby/blob/trunk/test/rake/test_rake_application.rb#L559 capture_io { @app.run } } ensure - @app.argv.clear + ARGV.clear end def test_standard_exception_handling_invalid_option -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/