ruby-changes:31185
From: drbrain <ko1@a...>
Date: Sat, 12 Oct 2013 06:35:54 +0900 (JST)
Subject: [ruby-changes:31185] drbrain:r43264 (trunk): * NEWS (with all sufficient information):
drbrain 2013-10-12 06:35:01 +0900 (Sat, 12 Oct 2013) New Revision: 43264 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43264 Log: * NEWS (with all sufficient information): * lib/rake: Update to rake 10.1.0 * bin/rake: ditto. * test/rake: ditto. * NEWS: Update NEWS to include rake 10.1.0 and links to release notes. Added directories: trunk/test/rake/support/ Added files: trunk/lib/rake/linked_list.rb trunk/lib/rake/scope.rb trunk/test/rake/support/rakefile_definitions.rb trunk/test/rake/support/ruby_runner.rb trunk/test/rake/test_rake_linked_list.rb trunk/test/rake/test_rake_scope.rb Removed directories: trunk/lib/rake/doc/ trunk/test/rake/data/ Removed files: trunk/lib/rake/classic_namespace.rb trunk/test/rake/test_rake_rdoc_task.rb trunk/test/rake/test_sys.rb Modified files: trunk/ChangeLog trunk/NEWS trunk/bin/rake trunk/lib/rake/alt_system.rb trunk/lib/rake/application.rb trunk/lib/rake/backtrace.rb trunk/lib/rake/clean.rb trunk/lib/rake/contrib/ftptools.rb trunk/lib/rake/contrib/sys.rb trunk/lib/rake/dsl_definition.rb trunk/lib/rake/ext/core.rb trunk/lib/rake/ext/module.rb trunk/lib/rake/ext/string.rb trunk/lib/rake/file_list.rb trunk/lib/rake/file_task.rb trunk/lib/rake/file_utils.rb trunk/lib/rake/file_utils_ext.rb trunk/lib/rake/gempackagetask.rb trunk/lib/rake/invocation_chain.rb trunk/lib/rake/name_space.rb trunk/lib/rake/packagetask.rb trunk/lib/rake/promise.rb trunk/lib/rake/pseudo_status.rb trunk/lib/rake/rdoctask.rb trunk/lib/rake/ruby182_test_unit_fix.rb trunk/lib/rake/runtest.rb trunk/lib/rake/task.rb trunk/lib/rake/task_arguments.rb trunk/lib/rake/task_manager.rb trunk/lib/rake/tasklib.rb trunk/lib/rake/testtask.rb trunk/lib/rake/thread_history_display.rb trunk/lib/rake/thread_pool.rb trunk/lib/rake/trace_output.rb trunk/lib/rake/version.rb trunk/lib/rake/win32.rb trunk/lib/rake.rb trunk/test/rake/helper.rb trunk/test/rake/test_rake_application.rb trunk/test/rake/test_rake_application_options.rb trunk/test/rake/test_rake_backtrace.rb trunk/test/rake/test_rake_clean.rb trunk/test/rake/test_rake_definitions.rb trunk/test/rake/test_rake_dsl.rb trunk/test/rake/test_rake_file_creation_task.rb trunk/test/rake/test_rake_file_list.rb trunk/test/rake/test_rake_file_task.rb trunk/test/rake/test_rake_file_utils.rb trunk/test/rake/test_rake_ftp_file.rb trunk/test/rake/test_rake_functional.rb trunk/test/rake/test_rake_invocation_chain.rb trunk/test/rake/test_rake_makefile_loader.rb trunk/test/rake/test_rake_multi_task.rb trunk/test/rake/test_rake_name_space.rb trunk/test/rake/test_rake_path_map.rb trunk/test/rake/test_rake_rake_test_loader.rb trunk/test/rake/test_rake_reduce_compat.rb trunk/test/rake/test_rake_rules.rb trunk/test/rake/test_rake_task.rb trunk/test/rake/test_rake_task_arguments.rb trunk/test/rake/test_rake_task_manager.rb trunk/test/rake/test_rake_task_manager_argument_resolution.rb trunk/test/rake/test_rake_task_with_arguments.rb trunk/test/rake/test_rake_test_task.rb trunk/test/rake/test_rake_thread_pool.rb trunk/test/rake/test_rake_top_level_functions.rb trunk/test/rake/test_thread_history_display.rb trunk/test/rake/test_trace_output.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 43263) +++ ChangeLog (revision 43264) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +2013-10-11 Eric Hodel <drbrain@s...> + + * lib/rake: Update to rake 10.1.0 + * bin/rake: ditto. + * test/rake: ditto. + + * NEWS: Update NEWS to include rake 10.1.0 and links to release notes. + Sat Oct 12 03:26:04 2013 Koichi Sasada <ko1@a...> * class.c, variable.c, gc.c (rb_class_tbl): removed. Index: lib/rake/classic_namespace.rb =================================================================== --- lib/rake/classic_namespace.rb (revision 43263) +++ lib/rake/classic_namespace.rb (revision 43264) @@ -1,11 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake/classic_namespace.rb#L0 -# The following classes used to be in the top level namespace. -# Loading this file enables compatibility with older Rakefile that -# referenced Task from the top level. - -warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake." -# :stopdoc: -Task = Rake::Task -FileTask = Rake::FileTask -FileCreationTask = Rake::FileCreationTask -RakeApp = Rake::Application -# :startdoc: Index: lib/rake/thread_history_display.rb =================================================================== --- lib/rake/thread_history_display.rb (revision 43263) +++ lib/rake/thread_history_display.rb (revision 43264) @@ -25,7 +25,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/thread_history_display.rb#L25 (stat[:time] * 1_000_000).round, stat[:thread], stat[:event], - stat[:data].map { |k,v| "#{k}:#{v}" }.join(" ")) + stat[:data].map do |k, v| "#{k}:#{v}" end.join(" ")) end end Index: lib/rake/trace_output.rb =================================================================== --- lib/rake/trace_output.rb (revision 43263) +++ lib/rake/trace_output.rb (revision 43264) @@ -11,7 +11,10 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/trace_output.rb#L11 if strings.empty? output = sep else - output = strings.map { |s| s.end_with?(sep) ? s : s + sep }.join + output = strings.map { |s| + next if s.nil? + s =~ /#{sep}$/ ? s : s + sep + }.join end out.print(output) end Index: lib/rake/backtrace.rb =================================================================== --- lib/rake/backtrace.rb (revision 43263) +++ lib/rake/backtrace.rb (revision 43264) @@ -1,13 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake/backtrace.rb#L1 module Rake module Backtrace - SUPPRESSED_PATHS = - RbConfig::CONFIG.values_at(*RbConfig::CONFIG. - keys.grep(/(prefix|libdir)/)).uniq + [ - File.join(File.dirname(__FILE__), ".."), - ].map { |f| Regexp.quote(File.expand_path(f)) } - SUPPRESSED_PATHS.reject! { |s| s.nil? || s =~ /^ *$/ } + SYS_KEYS = RbConfig::CONFIG.keys.grep(/(prefix|libdir)/) + SYS_PATHS = RbConfig::CONFIG.values_at(*SYS_KEYS).uniq + + [ File.join(File.dirname(__FILE__), "..") ] - SUPPRESS_PATTERN = %r!(\A#{SUPPRESSED_PATHS.join('|')}|bin/rake:\d+)!i + SUPPRESSED_PATHS = SYS_PATHS. + map { |s| s.gsub("\\", "/") }. + map { |f| File.expand_path(f) }. + reject { |s| s.nil? || s =~ /^ *$/ } + SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|") + SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i def self.collapse(backtrace) pattern = Rake.application.options.suppress_backtrace_pattern || Index: lib/rake/clean.rb =================================================================== --- lib/rake/clean.rb (revision 43263) +++ lib/rake/clean.rb (revision 43264) @@ -14,19 +14,42 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake/clean.rb#L14 require 'rake' # :stopdoc: -CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"] + +module Rake + module Cleaner + extend FileUtils + + module_function + + def cleanup_files(file_names) + file_names.each do |file_name| + cleanup(file_name) + end + end + + def cleanup(file_name, opts={}) + begin + rm_r file_name, opts + rescue StandardError => ex + puts "Failed to remove #{file_name}: #{ex}" + end + end + end +end + +CLEAN = ::Rake::FileList["**/*~", "**/*.bak", "**/core"] CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f").downcase == 'core' && File.directory?(fn) } desc "Remove any temporary products." task :clean do - CLEAN.each { |fn| rm_r fn rescue nil } + Rake::Cleaner.cleanup_files(CLEAN) end -CLOBBER = Rake::FileList.new +CLOBBER = ::Rake::FileList.new desc "Remove any generated file." task :clobber => [:clean] do - CLOBBER.each { |fn| rm_r fn rescue nil } + Rake::Cleaner.cleanup_files(CLOBBER) end Index: lib/rake/tasklib.rb =================================================================== --- lib/rake/tasklib.rb (revision 43263) +++ lib/rake/tasklib.rb (revision 43264) @@ -14,7 +14,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/tasklib.rb#L14 # libraries depend on this so I can't remove it without breaking # other people's code. So for now it stays for backwards # compatibility. BUT DON'T USE IT. - def paste(a,b) # :nodoc: + def paste(a, b) # :nodoc: (a.to_s + b.to_s).intern end end Index: lib/rake/dsl_definition.rb =================================================================== --- lib/rake/dsl_definition.rb (revision 43263) +++ lib/rake/dsl_definition.rb (revision 43264) @@ -32,7 +32,6 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/dsl_definition.rb#L32 Rake::Task.define_task(*args, &block) end - # Declare a file task. # # Example: @@ -67,7 +66,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/dsl_definition.rb#L66 dir, _ = *Rake.application.resolve_args(args) Rake.each_dir_parent(dir) do |d| file_create d do |t| - mkdir_p t.name if ! File.exist?(t.name) + mkdir_p t.name unless File.exist?(t.name) end end result @@ -117,6 +116,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/dsl_definition.rb#L116 end # Describe the next rake task. + # Duplicate descriptions are discarded. # # Example: # desc "Run the Unit Tests" @@ -147,31 +147,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/dsl_definition.rb#L147 Rake.application.add_import(fn) end end - end - - DeprecatedCommands = Object.new.extend(DSL) - - module DeprecatedObjectDSL # :nodoc: - DSL.private_instance_methods(false).each do |name| - line = __LINE__+1 - class_eval %{ - def #{name}(*args, &block) - unless Rake.application.options.ignore_deprecate - unless @rake_dsl_warning - $stderr.puts "WARNING: Global access to Rake DSL methods is deprecated. Please include" - $stderr.puts " ... Rake::DSL into classes and modules which use the Rake DSL methods." - @rake_dsl_warning = true - end - $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}" - end - Rake::DeprecatedCommands.send(:#{name}, *args, &block) - end - private :#{name} - }, __FILE__, line - end - end unless defined? Rake::REDUCE_COMPAT - extend FileUtilsExt end @@ -179,4 +155,3 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rake/dsl_definition.rb#L155 # calls to task, etc. to work from a Rakefile without polluting the # object inheritance tree. self.extend Rake::DSL -include Rake::DeprecatedObjectDSL unless defined? Rake::REDUCE_COMPAT Index: lib/rake/ext/module.rb =================================================================== --- lib/rake/ext/module.rb (revision 43263) +++ lib/rake/ext/module.rb (revision 43264) @@ -1,39 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/rake/ext/module.rb#L0 -require 'rake/ext/core' -require 'rake/task' -require 'rake/file_task' -require 'rake/file_creation_task' -require 'rake/application' -require 'rake/task_manager' - -###################################################################### -# Rake extensions to Module. -# -class Module - - # Rename the original handler to make it available. - alias :rake_original_const_missing :const_missing - - # Check for deprecated uses of top level (i.e. in Object) uses of - # Rake class names. If someone tries to reference the constant - # name, display a warning and return the proper object. Using the - # --classic-namespace command line option will define these - # constants in Object and avoid this handler. - def const_missing(const_name) - case const_name - when :Task - Rake.application.const_warning(const_name) - Rake::Task - when :FileTask - Rake.application.const_warning(const_name) - Rake::FileTask - when :FileCreationTask - Rake.application.const_warning(const_name) - Rake::FileCreationTask - when :RakeApp - Rake.application.const_warning(const_name) - Rake::Application - else - rake_original_const_missing(const_name) - end - end -end unless defined? Rake::REDUCE_COMPAT Index: lib/rake/ext/string.rb =================================================================== --- lib/rake/ext/string.rb (revision 43263) +++ lib/rake/ext/string.rb (revision 43264) @@ -13,9 +13,7 @@ class String https://github.com/ruby/ruby/blob/trunk/lib/rake/ext/string.rb#L13 # +ext+ is a user added method for the String class. def ext(newext='') return self.dup if ['.', '..'].include? self - if newext != '' - newext = (newext =~ /^\./) ? newext : ("." + newext) - end + newext = (newext =~ /^\./) ? newext : ("." + newext) if newext != '' self.chomp(File.extname(self)) << newext end end Index: lib/rake/ext/core.rb =================================================================== --- lib/rake/ext/core.rb (revision 43263) +++ lib/rake/ext/core.rb (revision 43264) @@ -19,7 +19,8 @@ class Module https://github.com/ruby/ruby/blob/trunk/lib/rake/ext/core.rb#L19 # def rake_extension(method) if method_defined?(method) - $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists" + $stderr.puts "WARNING: Possible conflict with Rake extension: " + + "#{self}##{method} already exists" else yield end Index: lib/rake/file_utils.rb =================================================================== --- lib/rake/file_utils.rb (revision 43263) +++ lib/rake/file_utils.rb (revision 43264) @@ -41,24 +41,26 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/rake/file_utils.rb#L41 unless options[:noop] res = rake_system(*cmd) status = $? - status = PseudoStatus.new(1) if !res && status.nil? + status = Rake::PseudoStatus.new(1) if !res && status.nil? shell_runner.call(res, status) end end def create_shell_runner(cmd) # :nodoc: show_command = cmd.join(" ") - show_command = show_command[0,42] + "..." unless $trace - lambda { |ok, status| - ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]" - } + show_command = show_command[0, 42] + "..." unless $trace + lambda do |ok, status| + ok or + fail "Command failed with status (#{status.exitstatus}): " + + "[#{show_command}]" + end end private :create_shell_runner def set_verbose_option(options) # :nodoc: unless options.key? :verbose options[:verbose] = - Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT || + (Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT) || Rake::FileUtilsExt.verbose_flag end end @@ -74,9 +76,9 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/rake/file_utils.rb#L76 # Example: # ruby %{-pe '$_.upcase!' <README} # - def ruby(*args,&block) + def ruby(*args, &block) options = (Hash === args.last) ? args.pop : {} - if args.length > 1 then + if args.length > 1 sh(*([RUBY] + args + [options]), &block) else sh("#{RUBY} #{args.first}", options, &block) @@ -88,7 +90,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/rake/file_utils.rb#L90 # Attempt to do a normal file link, but fall back to a copy if the link # fails. def safe_ln(*args) - unless LN_SUPPORTED[0] + if ! LN_SUPPORTED[0] cp(*args) else begin Index: lib/rake/file_task.rb =================================================================== --- lib/rake/file_task.rb (revision 43263) +++ lib/rake/file_task.rb (revision 43264) @@ -29,7 +29,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/file_task.rb#L29 # Are there any prerequisites with a later time than the given time stamp? def out_of_date?(stamp) - @prerequisites.any? { |n| application[n, @scope].timestamp > stamp} + @prerequisites.any? { |n| application[n, @scope].timestamp > stamp } end # ---------------------------------------------------------------- @@ -44,4 +44,3 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/file_task.rb#L44 end end end - Index: lib/rake/testtask.rb =================================================================== --- lib/rake/testtask.rb (revision 43263) +++ lib/rake/testtask.rb (revision 43264) @@ -64,7 +64,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/testtask.rb#L64 # attr_accessor :loader - # Array of commandline options to pass to Ruby when running test loader. + # Array of commandline options to pass to ruby when running test loader. attr_accessor :ruby_opts # Explicitly define the list of test files to be included in a @@ -93,15 +93,18 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/testtask.rb#L93 # Create the tasks defined by this task lib. def define - desc "Run tests" + (@name==:test ? "" : " for #{@name}") + desc "Run tests" + (@name == :test ? "" : " for #{@name}") task @name do FileUtilsExt.verbose(@verbose) do - args = "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}" + args = + "#{ruby_opts_string} #{run_code} " + + "#{file_list_string} #{option_list}" ruby args do |ok, status| if !ok && status.respond_to?(:signaled?) && status.signaled? raise SignalException.new(status.termsig) elsif !ok - fail "Command failed with status (#{status.exitstatus}): [ruby #{args}]" + fail "Command failed with status (#{status.exitstatus}): " + + "[ruby #{args}]" end end end @@ -120,8 +123,8 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/testtask.rb#L123 def ruby_opts_string opts = @ruby_opts.dup - opts.unshift( "-I\"#{lib_path}\"" ) unless @libs.empty? - opts.unshift( "-w" ) if @warning + opts.unshift("-I\"#{lib_path}\"") unless @libs.empty? + opts.unshift("-w") if @warning opts.join(" ") end @@ -130,12 +133,12 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/testtask.rb#L133 end def file_list_string - file_list.collect { |fn| "\"#{fn}\"" }.join(' ') + file_list.map { |fn| "\"#{fn}\"" }.join(' ') end def file_list # :nodoc: if ENV['TEST'] - FileList[ ENV['TEST'] ] + FileList[ENV['TEST']] else result = [] result += @test_files.to_a if @test_files Index: lib/rake/win32.rb =================================================================== --- lib/rake/win32.rb (revision 43263) +++ lib/rake/win32.rb (revision 43264) @@ -40,8 +40,9 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/win32.rb#L40 win32_shared_path ||= ENV['APPDATA'] win32_shared_path ||= ENV['USERPROFILE'] - raise Win32HomeError, "Unable to determine home path environment variable." if - win32_shared_path.nil? or win32_shared_path.empty? + raise Win32HomeError, + "Unable to determine home path environment variable." if + win32_shared_path.nil? or win32_shared_path.empty? normalize(File.join(win32_shared_path, 'Rake')) end Index: lib/rake/application.rb =================================================================== --- lib/rake/application.rb (revision 43263) +++ lib/rake/application.rb (revision 43264) @@ -35,7 +35,12 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L35 # List of the top level task names (task names from the command line). attr_reader :top_level_tasks - DEFAULT_RAKEFILES = ['rakefile', 'Rakefile', 'rakefile.rb', 'Rakefile.rb'].freeze + DEFAULT_RAKEFILES = [ + 'rakefile', + 'Rakefile', + 'rakefile.rb', + 'Rakefile.rb' + ].freeze # Initialize a Rake::Application object. def initialize @@ -115,7 +120,8 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L120 puts "Maximum active threads: #{stats[:max_active_threads]}" puts "Total threads in play: #{stats[:total_threads_in_play]}" end - ThreadHistoryDisplay.new(thread_pool.history).show if options.job_stats == :history + ThreadHistoryDisplay.new(thread_pool.history).show if + options.job_stats == :history end # Add a loader to handle imported files ending in the extension @@ -132,7 +138,7 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L138 # Return the thread pool used for multithreaded processing. def thread_pool # :nodoc: - @thread_pool ||= ThreadPool.new(options.thread_pool_size||FIXNUM_MAX) + @thread_pool ||= ThreadPool.new(options.thread_pool_size || FIXNUM_MAX) end # private ---------------------------------------------------------------- @@ -156,19 +162,23 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L162 # Provide standard exception handling for the given block. def standard_exception_handling - begin - yield - rescue SystemExit => ex - # Exit silently with current status - raise - rescue OptionParser::InvalidOption => ex - $stderr.puts ex.message - exit(false) - rescue Exception => ex - # Exit with error message - display_error_message(ex) - exit(false) - end + yield + rescue SystemExit + # Exit silently with current status + raise + rescue OptionParser::InvalidOption => ex + $stderr.puts ex.message + exit(false) + rescue Exception => ex + # Exit with error message + display_error_message(ex) + exit_because_of_exception(ex) + end + + # Exit the program because of an unhandle exception. + # (may be overridden by subclasses) + def exit_because_of_exception(ex) + exit(false) end # Display the error message that caused the exception. @@ -181,7 +191,8 @@ module Rake https://github.com/ruby/ruby/blob/trunk/lib/rake/application.rb#L191 trace Backtrace.collapse(ex.backtrace).join("\n") end trace "Tasks: #{ex.chain}" if has_chain?(ex) - trace "(See full trace by running task with --trace)" unless options.backtrace + trace "(See full trace by running task with --trace)" unless + options.backtrace end # Warn about deprecated usage. @@ -190,10 +201,11 @@ module (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/