1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
drbrain 2012-11-15 22:32:34 +00:00
parent e9c28d0fce
commit 1b023030a8
13 changed files with 90 additions and 28 deletions

View file

@ -1,3 +1,11 @@
Fri Nov 16 07:23:18 2012 Eric Hodel <drbrain@segment7.net>
* 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@segment7.net> Fri Nov 16 06:58:52 2012 Eric Hodel <drbrain@segment7.net>
* lib/rake*: Updated to rake 0.9.3. See * lib/rake*: Updated to rake 0.9.3. See

10
NEWS
View file

@ -182,12 +182,14 @@ with all sufficient information, see the ChangeLog file.
* Pathname#find returns an enumerator if no block is given. * Pathname#find returns an enumerator if no block is given.
* rake * 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 This version is backwards-compatible with previous rake versions and
contains many bug fixes. See contains many bug fixes.
http://rake.rubyforge.org/doc/release_notes/rake-0_9_3_rdoc.html for a list
of changes in rake 0.9.3 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 * resolv
* new methods: * new methods:

View file

@ -2,6 +2,7 @@ require 'shellwords'
require 'optparse' require 'optparse'
require 'rake/task_manager' require 'rake/task_manager'
require 'rake/file_list'
require 'rake/thread_pool' require 'rake/thread_pool'
require 'rake/thread_history_display' require 'rake/thread_history_display'
require 'rake/win32' require 'rake/win32'
@ -204,7 +205,7 @@ module Rake
def have_rakefile def have_rakefile
@rakefiles.each do |fn| @rakefiles.each do |fn|
if File.exist?(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 return others.size == 1 ? others.first : fn
elsif fn == '' elsif fn == ''
return fn return fn
@ -609,7 +610,7 @@ module Rake
end end
def glob(path, &block) def glob(path, &block)
Rake.glob(path.gsub("\\", '/')).each(&block) FileList.glob(path.gsub("\\", '/')).each(&block)
end end
private :glob private :glob

View file

@ -5,6 +5,7 @@
require 'date' require 'date'
require 'net/ftp' require 'net/ftp'
require 'rake/file_list'
module Rake # :nodoc: module Rake # :nodoc:
@ -127,8 +128,7 @@ module Rake # :nodoc:
# Upload all files matching +wildcard+ to the uploader's root # Upload all files matching +wildcard+ to the uploader's root
# path. # path.
def upload_files(wildcard) def upload_files(wildcard)
fail "OUCH" FileList.glob(wildcard).each do |fn|
Rake.glob(wildcard).each do |fn|
upload(fn) upload(fn)
end end
end end

View file

@ -10,6 +10,7 @@ begin
rescue LoadError rescue LoadError
end end
require 'rbconfig' require 'rbconfig'
require 'rake/file_list'
###################################################################### ######################################################################
# Sys provides a number of file manipulation tools for the convenience # 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+ # Install all the files matching +wildcard+ into the +dest_dir+
# directory. The permission mode is set to +mode+. # directory. The permission mode is set to +mode+.
def install(wildcard, dest_dir, 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) File.install(fn, dest_dir, mode, $verbose)
end end
end end
@ -81,7 +82,7 @@ module Sys
# recursively delete directories. # recursively delete directories.
def delete(*wildcards) def delete(*wildcards)
wildcards.each do |wildcard| wildcards.each do |wildcard|
Rake.glob(wildcard).each do |fn| FileList.glob(wildcard).each do |fn|
if File.directory?(fn) if File.directory?(fn)
log "Deleting directory #{fn}" log "Deleting directory #{fn}"
Dir.delete(fn) Dir.delete(fn)
@ -96,10 +97,10 @@ module Sys
# Recursively delete all files and directories matching +wildcard+. # Recursively delete all files and directories matching +wildcard+.
def delete_all(*wildcards) def delete_all(*wildcards)
wildcards.each do |wildcard| wildcards.each do |wildcard|
Rake.glob(wildcard).each do |fn| FileList.glob(wildcard).each do |fn|
next if ! File.exist?(fn) next if ! File.exist?(fn)
if File.directory?(fn) if File.directory?(fn)
Rake.glob("#{fn}/*").each do |subfn| FileList.glob("#{fn}/*").each do |subfn|
next if subfn=='.' || subfn=='..' next if subfn=='.' || subfn=='..'
delete_all(subfn) delete_all(subfn)
end end
@ -161,7 +162,7 @@ module Sys
# Perform a block with each file matching a set of wildcards. # Perform a block with each file matching a set of wildcards.
def for_files(*wildcards) def for_files(*wildcards)
wildcards.each do |wildcard| wildcards.each do |wildcard|
Rake.glob(wildcard).each do |fn| FileList.glob(wildcard).each do |fn|
yield(fn) yield(fn)
end end
end end
@ -172,7 +173,7 @@ module Sys
private # ---------------------------------------------------------- private # ----------------------------------------------------------
def for_matching_files(wildcard, dest_dir) 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) dest_file = File.join(dest_dir, fn)
parent = File.dirname(dest_file) parent = File.dirname(dest_file)
makedirs(parent) if ! File.directory?(parent) makedirs(parent) if ! File.directory?(parent)

View file

@ -340,7 +340,7 @@ module Rake
# Add matching glob patterns. # Add matching glob patterns.
def add_matching(pattern) def add_matching(pattern)
Rake.glob(pattern).each do |fn| FileList.glob(pattern).each do |fn|
self << fn unless exclude?(fn) self << fn unless exclude?(fn)
end end
end end
@ -383,6 +383,13 @@ module Rake
def [](*args) def [](*args)
new(*args) new(*args)
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
end end
end end

View file

@ -8,6 +8,8 @@ require 'rake'
task :phony task :phony
def (Rake::Task[:phony]).timestamp Rake::Task[:phony].tap do |task|
Time.at 0 def task.timestamp # :nodoc:
Time.at 0
end
end end

View file

@ -32,13 +32,6 @@ module Rake
application.options.rakelib << file application.options.rakelib << file
end end
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
end end

View file

@ -1,11 +1,12 @@
require 'test/unit' require 'test/unit'
require 'test/unit/assertions' require 'test/unit/assertions'
require 'rake/file_list'
module Rake module Rake
include Test::Unit::Assertions include Test::Unit::Assertions
def run_tests(pattern='test/test*.rb', log_enabled=false) 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 $stderr.puts fn if log_enabled
begin begin
require fn require fn

View file

@ -96,9 +96,12 @@ module Rake
desc "Run tests" + (@name==:test ? "" : " for #{@name}") desc "Run tests" + (@name==:test ? "" : " for #{@name}")
task @name do task @name do
FileUtilsExt.verbose(@verbose) 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? if !ok && status.respond_to?(:signaled?) && status.signaled?
raise SignalException.new(status.termsig) raise SignalException.new(status.termsig)
elsif !ok
fail "Command failed with status (#{status.exitstatus}): [ruby #{args}]"
end end
end end
end end

View file

@ -3,7 +3,7 @@ module Rake
NUMBERS = [ NUMBERS = [
MAJOR = 0, MAJOR = 0,
MINOR = 9, MINOR = 9,
BUILD = 3, BUILD = 4,
] ]
end end
VERSION = Version::NUMBERS.join('.') VERSION = Version::NUMBERS.join('.')

View file

@ -519,4 +519,31 @@ task :default => :test
end end
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 end

View file

@ -439,6 +439,21 @@ class TestRakeFunctional < Rake::TestCase
end end
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 private
# Run a shell Ruby command with command line options (using the # Run a shell Ruby command with command line options (using the
@ -458,14 +473,16 @@ class TestRakeFunctional < Rake::TestCase
def run_ruby(option_list) def run_ruby(option_list)
puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose 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 inn.close
@out = out.read @out = out.read
@err = err.read @err = err.read
@exit = wait.value
puts "OUTPUT: [#{@out}]" if @verbose puts "OUTPUT: [#{@out}]" if @verbose
puts "ERROR: [#{@err}]" if @verbose puts "ERROR: [#{@err}]" if @verbose
puts "EXIT: [#{@exit.inspect}]" if @verbose
puts "PWD: [#{Dir.pwd}]" if @verbose puts "PWD: [#{Dir.pwd}]" if @verbose
end end