ruby-changes:25610
From: drbrain <ko1@a...>
Date: Fri, 16 Nov 2012 07:35:28 +0900 (JST)
Subject: [ruby-changes:25610] drbrain:r37667 (trunk): * lib/rake*: Updated to rake 0.9.4
drbrain 2012-11-16 07:32:34 +0900 (Fri, 16 Nov 2012) New Revision: 37667 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37667 Log: * 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 Modified files: trunk/ChangeLog trunk/NEWS trunk/lib/rake/application.rb trunk/lib/rake/contrib/ftptools.rb trunk/lib/rake/contrib/sys.rb trunk/lib/rake/file_list.rb trunk/lib/rake/phony.rb trunk/lib/rake/rake_module.rb trunk/lib/rake/runtest.rb trunk/lib/rake/testtask.rb trunk/lib/rake/version.rb trunk/test/rake/helper.rb trunk/test/rake/test_rake_functional.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 37666) +++ ChangeLog (revision 37667) @@ -1,3 +1,11 @@ +Fri Nov 16 07:23:18 2012 Eric Hodel <drbrain@s...> + + * 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 + Fri Nov 16 06:58:52 2012 Eric Hodel <drbrain@s...> * lib/rake*: Updated to rake 0.9.3. See Index: lib/rake/testtask.rb =================================================================== --- lib/rake/testtask.rb (revision 37666) +++ lib/rake/testtask.rb (revision 37667) @@ -96,9 +96,12 @@ 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 Index: lib/rake/application.rb =================================================================== --- lib/rake/application.rb (revision 37666) +++ lib/rake/application.rb (revision 37667) @@ -2,6 +2,7 @@ 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 @@ 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 @@ end def glob(path, &block) - Rake.glob(path.gsub("\\", '/')).each(&block) + FileList.glob(path.gsub("\\", '/')).each(&block) end private :glob Index: lib/rake/version.rb =================================================================== --- lib/rake/version.rb (revision 37666) +++ lib/rake/version.rb (revision 37667) @@ -3,7 +3,7 @@ NUMBERS = [ MAJOR = 0, MINOR = 9, - BUILD = 3, + BUILD = 4, ] end VERSION = Version::NUMBERS.join('.') Index: lib/rake/rake_module.rb =================================================================== --- lib/rake/rake_module.rb (revision 37666) +++ lib/rake/rake_module.rb (revision 37667) @@ -32,13 +32,6 @@ 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 Index: lib/rake/phony.rb =================================================================== --- lib/rake/phony.rb (revision 37666) +++ lib/rake/phony.rb (revision 37667) @@ -8,6 +8,8 @@ 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 Index: lib/rake/contrib/sys.rb =================================================================== --- lib/rake/contrib/sys.rb (revision 37666) +++ lib/rake/contrib/sys.rb (revision 37667) @@ -10,6 +10,7 @@ rescue LoadError end require 'rbconfig' +require 'rake/file_list' ###################################################################### # Sys provides a number of file manipulation tools for the convenience @@ -27,7 +28,7 @@ # 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 @@ # 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 @@ # 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 @@ # 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 @@ 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) Index: lib/rake/contrib/ftptools.rb =================================================================== --- lib/rake/contrib/ftptools.rb (revision 37666) +++ lib/rake/contrib/ftptools.rb (revision 37667) @@ -5,6 +5,7 @@ require 'date' require 'net/ftp' +require 'rake/file_list' module Rake # :nodoc: @@ -127,8 +128,7 @@ # 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 Index: lib/rake/runtest.rb =================================================================== --- lib/rake/runtest.rb (revision 37666) +++ lib/rake/runtest.rb (revision 37667) @@ -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 Index: lib/rake/file_list.rb =================================================================== --- lib/rake/file_list.rb (revision 37666) +++ lib/rake/file_list.rb (revision 37667) @@ -340,7 +340,7 @@ # 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 @@ 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 Index: NEWS =================================================================== --- NEWS (revision 37666) +++ NEWS (revision 37667) @@ -182,13 +182,15 @@ * Pathname#find returns an enumerator if no block is given. * rake - * rake has been updated to version 0.9.3. + * rake has been updated to version 0.9.4. This version is backwards-compatible with previous rake versions and - contains many bug fixes. See - http://rake.rubyforge.org/doc/release_notes/rake-0_9_3_rdoc.html for a list - of changes in rake 0.9.3 + contains many bug fixes. + See + http://rake.rubyforge.org/doc/release_notes/rake-0_9_4_rdoc.html for a list + of changes in rake 0.9.3 and 0.9.4. + * resolv * new methods: * Resolv::DNS#timeouts= Index: test/rake/test_rake_functional.rb =================================================================== --- test/rake/test_rake_functional.rb (revision 37666) +++ test/rake/test_rake_functional.rb (revision 37667) @@ -439,6 +439,21 @@ end end + def test_failing_test_sets_exit_status + rakefile_failing_test_task + rake + assert_equal 1, @exit.exitstatus + end + + def test_stand_alone_filelist + rakefile_stand_alone_filelist + + run_ruby @ruby_options + ["stand_alone_filelist.rb"] + + assert_match(/^stand_alone_filelist\.rb$/, @out) + assert_equal 0, @exit.exitstatus + end + private # Run a shell Ruby command with command line options (using the @@ -458,14 +473,16 @@ def run_ruby(option_list) puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose - inn, out, err = Open3.popen3(Gem.ruby, *option_list) + inn, out, err, wait = Open3.popen3(Gem.ruby, *option_list) inn.close @out = out.read @err = err.read + @exit = wait.value puts "OUTPUT: [#{@out}]" if @verbose puts "ERROR: [#{@err}]" if @verbose + puts "EXIT: [#{@exit.inspect}]" if @verbose puts "PWD: [#{Dir.pwd}]" if @verbose end Index: test/rake/helper.rb =================================================================== --- test/rake/helper.rb (revision 37666) +++ test/rake/helper.rb (revision 37667) @@ -519,4 +519,31 @@ end end + def rakefile_failing_test_task + rakefile <<-TEST_TASK +require 'rake/testtask' + +task :default => :test +Rake::TestTask.new(:test) do |t| + t.test_files = ['a_test.rb'] end + TEST_TASK + open 'a_test.rb', 'w' do |io| + io << "require 'minitest/autorun'\n" + io << "class ExitTaskTest < MiniTest::Unit::TestCase\n" + io << " def test_exit\n" + io << " assert false, 'this should fail'\n" + io << " end\n" + io << "end\n" + end + end + + def rakefile_stand_alone_filelist + open 'stand_alone_filelist.rb', 'w' do |io| + io << "require 'rake/file_list'\n" + io << "FL = Rake::FileList['*.rb']\n" + io << "puts FL\n" + end + end + +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/