diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-15 22:32:34 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-15 22:32:34 +0000 |
commit | 1b023030a88a35118875b068a1fd725c58a32083 (patch) | |
tree | 07bbdc25e71d98bfa4091f617d82fc87541364c5 /lib/rake | |
parent | e9c28d0fce1fa34bd83e910273981190932ebf63 (diff) | |
download | ruby-1b023030a88a35118875b068a1fd725c58a32083.tar.gz |
* lib/rake*: Updated to rake 0.9.4
http://rake.rubyforge.org/doc/release_notes/rake-0_9_4_rdoc.html for
a list of changes in 0.9.4.
* test/rake*: ditto
* NEWS: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake')
-rw-r--r-- | lib/rake/application.rb | 5 | ||||
-rw-r--r-- | lib/rake/contrib/ftptools.rb | 4 | ||||
-rw-r--r-- | lib/rake/contrib/sys.rb | 13 | ||||
-rw-r--r-- | lib/rake/file_list.rb | 9 | ||||
-rw-r--r-- | lib/rake/phony.rb | 6 | ||||
-rw-r--r-- | lib/rake/rake_module.rb | 7 | ||||
-rw-r--r-- | lib/rake/runtest.rb | 3 | ||||
-rw-r--r-- | lib/rake/testtask.rb | 5 | ||||
-rw-r--r-- | lib/rake/version.rb | 2 |
9 files changed, 31 insertions, 23 deletions
diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 50930938bf..54796312d8 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -2,6 +2,7 @@ require 'shellwords' require 'optparse' require 'rake/task_manager' +require 'rake/file_list' require 'rake/thread_pool' require 'rake/thread_history_display' require 'rake/win32' @@ -204,7 +205,7 @@ module Rake def have_rakefile @rakefiles.each do |fn| if File.exist?(fn) - others = Rake.glob(fn, File::FNM_CASEFOLD) + others = FileList.glob(fn, File::FNM_CASEFOLD) return others.size == 1 ? others.first : fn elsif fn == '' return fn @@ -609,7 +610,7 @@ module Rake end def glob(path, &block) - Rake.glob(path.gsub("\\", '/')).each(&block) + FileList.glob(path.gsub("\\", '/')).each(&block) end private :glob diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb index eaf8885262..d39cde8ed9 100644 --- a/lib/rake/contrib/ftptools.rb +++ b/lib/rake/contrib/ftptools.rb @@ -5,6 +5,7 @@ require 'date' require 'net/ftp' +require 'rake/file_list' module Rake # :nodoc: @@ -127,8 +128,7 @@ module Rake # :nodoc: # Upload all files matching +wildcard+ to the uploader's root # path. def upload_files(wildcard) - fail "OUCH" - Rake.glob(wildcard).each do |fn| + FileList.glob(wildcard).each do |fn| upload(fn) end end diff --git a/lib/rake/contrib/sys.rb b/lib/rake/contrib/sys.rb index aefd4a1913..5e31ea81b4 100644 --- a/lib/rake/contrib/sys.rb +++ b/lib/rake/contrib/sys.rb @@ -10,6 +10,7 @@ begin rescue LoadError end require 'rbconfig' +require 'rake/file_list' ###################################################################### # Sys provides a number of file manipulation tools for the convenience @@ -27,7 +28,7 @@ module Sys # Install all the files matching +wildcard+ into the +dest_dir+ # directory. The permission mode is set to +mode+. def install(wildcard, dest_dir, mode) - Rake.glob(wildcard).each do |fn| + FileList.glob(wildcard).each do |fn| File.install(fn, dest_dir, mode, $verbose) end end @@ -81,7 +82,7 @@ module Sys # recursively delete directories. def delete(*wildcards) wildcards.each do |wildcard| - Rake.glob(wildcard).each do |fn| + FileList.glob(wildcard).each do |fn| if File.directory?(fn) log "Deleting directory #{fn}" Dir.delete(fn) @@ -96,10 +97,10 @@ module Sys # Recursively delete all files and directories matching +wildcard+. def delete_all(*wildcards) wildcards.each do |wildcard| - Rake.glob(wildcard).each do |fn| + FileList.glob(wildcard).each do |fn| next if ! File.exist?(fn) if File.directory?(fn) - Rake.glob("#{fn}/*").each do |subfn| + FileList.glob("#{fn}/*").each do |subfn| next if subfn=='.' || subfn=='..' delete_all(subfn) end @@ -161,7 +162,7 @@ module Sys # Perform a block with each file matching a set of wildcards. def for_files(*wildcards) wildcards.each do |wildcard| - Rake.glob(wildcard).each do |fn| + FileList.glob(wildcard).each do |fn| yield(fn) end end @@ -172,7 +173,7 @@ module Sys private # ---------------------------------------------------------- def for_matching_files(wildcard, dest_dir) - Rake.glob(wildcard).each do |fn| + FileList.glob(wildcard).each do |fn| dest_file = File.join(dest_dir, fn) parent = File.dirname(dest_file) makedirs(parent) if ! File.directory?(parent) diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb index b74ecac4cc..b9b9d7216a 100644 --- a/lib/rake/file_list.rb +++ b/lib/rake/file_list.rb @@ -340,7 +340,7 @@ module Rake # Add matching glob patterns. def add_matching(pattern) - Rake.glob(pattern).each do |fn| + FileList.glob(pattern).each do |fn| self << fn unless exclude?(fn) end end @@ -383,6 +383,13 @@ module Rake def [](*args) new(*args) end + + # Get a sorted list of files matching the pattern. This method + # should be prefered to Dir[pattern] and Dir.glob[pattern] because + # the files returned are guaranteed to be sorted. + def glob(pattern, *args) + Dir.glob(pattern, *args).sort + end end end end diff --git a/lib/rake/phony.rb b/lib/rake/phony.rb index 0552c26a33..29633ae066 100644 --- a/lib/rake/phony.rb +++ b/lib/rake/phony.rb @@ -8,6 +8,8 @@ require 'rake' task :phony -def (Rake::Task[:phony]).timestamp - Time.at 0 +Rake::Task[:phony].tap do |task| + def task.timestamp # :nodoc: + Time.at 0 + end end diff --git a/lib/rake/rake_module.rb b/lib/rake/rake_module.rb index 6f77d1b674..fcf5800064 100644 --- a/lib/rake/rake_module.rb +++ b/lib/rake/rake_module.rb @@ -32,13 +32,6 @@ module Rake application.options.rakelib << file end end - - # Get a sorted list of files matching the pattern. This method - # should be prefered to Dir[pattern] and Dir.glob[pattern] because - # the files returned are guaranteed to be sorted. - def glob(pattern, *args) - Dir.glob(pattern, *args).sort - end end end diff --git a/lib/rake/runtest.rb b/lib/rake/runtest.rb index 9c6469d45e..bd816ccfde 100644 --- a/lib/rake/runtest.rb +++ b/lib/rake/runtest.rb @@ -1,11 +1,12 @@ require 'test/unit' require 'test/unit/assertions' +require 'rake/file_list' module Rake include Test::Unit::Assertions def run_tests(pattern='test/test*.rb', log_enabled=false) - Rake.glob(pattern).each { |fn| + FileList.glob(pattern).each { |fn| $stderr.puts fn if log_enabled begin require fn diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 99094df1c8..19592d80c8 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -96,9 +96,12 @@ module Rake desc "Run tests" + (@name==:test ? "" : " for #{@name}") task @name do FileUtilsExt.verbose(@verbose) do - ruby "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}" do |ok, status| + 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}]" end end end diff --git a/lib/rake/version.rb b/lib/rake/version.rb index 2515e25663..4379fc96ad 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -3,7 +3,7 @@ module Rake NUMBERS = [ MAJOR = 0, MINOR = 9, - BUILD = 3, + BUILD = 4, ] end VERSION = Version::NUMBERS.join('.') |