From 2619f216fef06c9fca948ca729a0e23b62996f09 Mon Sep 17 00:00:00 2001 From: drbrain Date: Tue, 28 Jun 2011 02:45:29 +0000 Subject: * lib/rake: Update rake to fix some bugs and hide deprecated features from RDoc. * lib/rake/version.rb: Bump version to 0.9.2.1 to distinguish it from the released version. * NEWS: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rake.rb | 2 ++ lib/rake/classic_namespace.rb | 2 ++ lib/rake/clean.rb | 1 + lib/rake/dsl_definition.rb | 9 ++++++++- lib/rake/ext/time.rb | 6 +++--- lib/rake/file_utils.rb | 16 +++++++++------- lib/rake/file_utils_ext.rb | 5 ++++- lib/rake/gempackagetask.rb | 2 ++ lib/rake/rake_test_loader.rb | 21 +++++++++++++++------ lib/rake/rdoctask.rb | 2 ++ lib/rake/task_arguments.rb | 4 ++++ lib/rake/version.rb | 4 ++-- 12 files changed, 54 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/rake.rb b/lib/rake.rb index d88cf6cfe6..31fa1fa579 100644 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -23,7 +23,9 @@ require 'rake/version' +# :stopdoc: RAKEVERSION = Rake::VERSION +# :startdoc: require 'rbconfig' require 'fileutils' diff --git a/lib/rake/classic_namespace.rb b/lib/rake/classic_namespace.rb index d87aba0f33..6e71012da4 100644 --- a/lib/rake/classic_namespace.rb +++ b/lib/rake/classic_namespace.rb @@ -3,7 +3,9 @@ # 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: diff --git a/lib/rake/clean.rb b/lib/rake/clean.rb index 62f27d5751..5c9cbcdb24 100644 --- a/lib/rake/clean.rb +++ b/lib/rake/clean.rb @@ -13,6 +13,7 @@ require 'rake' +# :stopdoc: CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"] CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f") == 'core' && File.directory?(fn) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index e0b9c6fd0e..3294f9e6c0 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -2,11 +2,18 @@ require 'rake/file_utils_ext' module Rake + + ## + # DSL is a module that provides #task, #desc, #namespace, etc. Use this + # when you'd like to use rake outside the top level scope. + module DSL + #-- # Include the FileUtils file manipulation functions in the top # level module, but mark them private so that they don't # unintentionally define methods on other objects. + #++ include FileUtilsExt private(*FileUtils.instance_methods(false)) @@ -139,7 +146,7 @@ module Rake end end - module DeprecatedObjectDSL + module DeprecatedObjectDSL # :nodoc: Commands = Object.new.extend DSL DSL.private_instance_methods(false).each do |name| line = __LINE__+1 diff --git a/lib/rake/ext/time.rb b/lib/rake/ext/time.rb index ca3ea2a795..7877abf0ce 100644 --- a/lib/rake/ext/time.rb +++ b/lib/rake/ext/time.rb @@ -1,6 +1,6 @@ -# ########################################################################### +#-- # Extensions to time to allow comparisons with an early time class. -# + class Time alias rake_original_time_compare :<=> def <=>(other) @@ -10,5 +10,5 @@ class Time rake_original_time_compare(other) end end -end # class Time +end diff --git a/lib/rake/file_utils.rb b/lib/rake/file_utils.rb index 9e0198e644..e02d541ab8 100644 --- a/lib/rake/file_utils.rb +++ b/lib/rake/file_utils.rb @@ -1,10 +1,9 @@ require 'rbconfig' require 'fileutils' -# ########################################################################### +#-- # This a FileUtils extension that defines several additional commands to be # added to the FileUtils utility functions. -# module FileUtils # Path to the currently running Ruby program RUBY = File.join( @@ -38,6 +37,7 @@ module FileUtils options[:noop] ||= Rake::FileUtilsExt.nowrite_flag Rake.rake_check_options options, :noop, :verbose Rake.rake_output_message cmd.join(" ") if options[:verbose] + unless options[:noop] res = rake_system(*cmd) status = $? @@ -46,7 +46,7 @@ module FileUtils end end - def create_shell_runner(cmd) + def create_shell_runner(cmd) # :nodoc: show_command = cmd.join(" ") show_command = show_command[0,42] + "..." unless $trace lambda { |ok, status| @@ -55,14 +55,16 @@ module FileUtils end private :create_shell_runner - def set_verbose_option(options) - if options[:verbose].nil? - options[:verbose] = Rake::FileUtilsExt.verbose_flag.nil? || Rake::FileUtilsExt.verbose_flag + def set_verbose_option(options) # :nodoc: + unless options.key? :verbose + options[:verbose] = + Rake::FileUtilsExt.verbose_flag == Rake::FileUtilsExt::DEFAULT || + Rake::FileUtilsExt.verbose_flag end end private :set_verbose_option - def rake_system(*cmd) + def rake_system(*cmd) # :nodoc: Rake::AltSystem.system(*cmd) end private :rake_system diff --git a/lib/rake/file_utils_ext.rb b/lib/rake/file_utils_ext.rb index 7c22f80687..557420df80 100644 --- a/lib/rake/file_utils_ext.rb +++ b/lib/rake/file_utils_ext.rb @@ -12,7 +12,10 @@ module Rake class << self attr_accessor :verbose_flag, :nowrite_flag end - FileUtilsExt.verbose_flag = nil + + DEFAULT = Object.new + + FileUtilsExt.verbose_flag = DEFAULT FileUtilsExt.nowrite_flag = false $fileutils_verbose = true diff --git a/lib/rake/gempackagetask.rb b/lib/rake/gempackagetask.rb index 51e92236fc..5f1fc4def8 100644 --- a/lib/rake/gempackagetask.rb +++ b/lib/rake/gempackagetask.rb @@ -7,6 +7,8 @@ require 'rubygems/package_task' require 'rake' +# :stopdoc: + module Rake GemPackageTask = Gem::PackageTask end diff --git a/lib/rake/rake_test_loader.rb b/lib/rake/rake_test_loader.rb index 045a12fdce..7e3a6b3f35 100644 --- a/lib/rake/rake_test_loader.rb +++ b/lib/rake/rake_test_loader.rb @@ -1,13 +1,22 @@ require 'rake' # Load the test files from the command line. +argv = ARGV.select do |argument| + case argument + when /^-/ then + argument + when /\*/ then + FileList[argument].to_a.each do |file| + require File.expand_path file + end -ARGV.each do |f| - next if f =~ /^-/ - - if f =~ /\*/ - FileList[f].to_a.each { |fn| require File.expand_path(fn) } + false else - require File.expand_path(f) + require File.expand_path argument + + false end end + +ARGV.replace argv + diff --git a/lib/rake/rdoctask.rb b/lib/rake/rdoctask.rb index 5faf836b37..b6ae224a9e 100644 --- a/lib/rake/rdoctask.rb +++ b/lib/rake/rdoctask.rb @@ -13,6 +13,8 @@ begin rescue LoadError, Gem::LoadError end +# :stopdoc: + if defined?(RDoc::Task) then module Rake RDocTask = RDoc::Task unless const_defined? :RDocTask diff --git a/lib/rake/task_arguments.rb b/lib/rake/task_arguments.rb index ab404d67f5..02d01b99f9 100644 --- a/lib/rake/task_arguments.rb +++ b/lib/rake/task_arguments.rb @@ -43,6 +43,10 @@ module Rake @hash.each(&block) end + def values_at(*keys) + keys.map { |k| lookup(k) } + end + def method_missing(sym, *args, &block) lookup(sym.to_sym) end diff --git a/lib/rake/version.rb b/lib/rake/version.rb index 7f22595640..3afad7f25a 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -1,7 +1,7 @@ module Rake - VERSION = '0.9.2' + VERSION = '0.9.2.1' - module Version + module Version # :nodoc: all MAJOR, MINOR, BUILD = VERSION.split '.' NUMBERS = [ MAJOR, MINOR, BUILD ] end -- cgit v1.2.3