Skip to content

Commit

Permalink
Merge fixes for 10.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jimweirich committed Nov 14, 2012
2 parents 00d3a81 + 19b64f1 commit 89cb487
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 30 deletions.
12 changes: 0 additions & 12 deletions README.rdoc
Expand Up @@ -31,18 +31,6 @@ Download and install rake with the following.

gem install rake

=== Normal Installation

You can download the source tarball of the latest version of Rake from

* http://rubyforge.org/project/showfiles.php?group_id=50

Extract the tarball and run

% ruby install.rb

from its distribution directory.

== Usage

=== Simple Example
Expand Down
5 changes: 3 additions & 2 deletions lib/rake/application.rb
Expand Up @@ -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'
Expand Down Expand Up @@ -205,7 +206,7 @@ def has_chain?(exception)
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
Expand Down Expand Up @@ -588,7 +589,7 @@ def raw_load_rakefile # :nodoc:
end

def glob(path, &block)
Rake.glob(path.gsub("\\", '/')).each(&block)
FileList.glob(path.gsub("\\", '/')).each(&block)
end
private :glob

Expand Down
4 changes: 2 additions & 2 deletions lib/rake/contrib/ftptools.rb
Expand Up @@ -5,6 +5,7 @@

require 'date'
require 'net/ftp'
require 'rake/file_list'

module Rake # :nodoc:

Expand Down Expand Up @@ -127,8 +128,7 @@ def makedirs(path)
# 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
Expand Down
9 changes: 8 additions & 1 deletion lib/rake/file_list.rb
Expand Up @@ -340,7 +340,7 @@ def to_s

# 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
Expand Down Expand Up @@ -383,6 +383,13 @@ class << self
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
Expand Down
6 changes: 4 additions & 2 deletions lib/rake/phony.rb
Expand Up @@ -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
7 changes: 0 additions & 7 deletions lib/rake/rake_module.rb
Expand Up @@ -32,13 +32,6 @@ def add_rakelib(*files)
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
3 changes: 2 additions & 1 deletion 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
Expand Down
5 changes: 4 additions & 1 deletion lib/rake/testtask.rb
Expand Up @@ -96,9 +96,12 @@ def define
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
Expand Down
2 changes: 1 addition & 1 deletion lib/rake/version.rb
Expand Up @@ -3,7 +3,7 @@ module Version # :nodoc: all
NUMBERS = [
MAJOR = 10,
MINOR = 0,
BUILD = 0,
BUILD = 1,
]
end
VERSION = Version::NUMBERS.join('.')
Expand Down
27 changes: 27 additions & 0 deletions test/helper.rb
Expand Up @@ -519,4 +519,31 @@ def rakefile_test_signal
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
19 changes: 18 additions & 1 deletion test/test_rake_functional.rb
Expand Up @@ -439,6 +439,21 @@ def test_signal_propagation_in_tests
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
Expand All @@ -458,14 +473,16 @@ def rake(*rake_options)
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

Expand Down

0 comments on commit 89cb487

Please sign in to comment.