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

* lib/rake: Import Rake 0.9.2

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-06-23 22:11:55 +00:00
parent 3fbc9440fe
commit d001539a05
119 changed files with 6777 additions and 4774 deletions

View file

@ -93,33 +93,37 @@ module Rake
# Create the tasks defined by this task lib.
def define
lib_path = @libs.join(File::PATH_SEPARATOR)
desc "Run tests" + (@name==:test ? "" : " for #{@name}")
task @name do
run_code = ''
RakeFileUtils.verbose(@verbose) do
run_code =
case @loader
when :direct
"-e 'ARGV.each{|f| load f}'"
when :testrb
"-S testrb"
when :rake
rake_loader
end
@ruby_opts.unshift( "-I\"#{lib_path}\"" )
@ruby_opts.unshift( "-w" ) if @warning
ruby @ruby_opts.join(" ") +
" \"#{run_code}\" " +
file_list.collect { |fn| "\"#{fn}\"" }.join(' ') +
" #{option_list}"
FileUtilsExt.verbose(@verbose) do
ruby "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}"
end
end
self
end
def option_list # :nodoc:
ENV['TESTOPTS'] || @options || ""
(ENV['TESTOPTS'] ||
ENV['TESTOPT'] ||
ENV['TEST_OPTS'] ||
ENV['TEST_OPT'] ||
@options ||
"")
end
def ruby_opts_string
opts = @ruby_opts.dup
opts.unshift( "-I\"#{lib_path}\"" ) unless @libs.empty?
opts.unshift( "-w" ) if @warning
opts.join(" ")
end
def lib_path
@libs.join(File::PATH_SEPARATOR)
end
def file_list_string
file_list.collect { |fn| "\"#{fn}\"" }.join(' ')
end
def file_list # :nodoc:
@ -128,8 +132,32 @@ module Rake
else
result = []
result += @test_files.to_a if @test_files
result += FileList[ @pattern ].to_a if @pattern
FileList[result]
result << @pattern if @pattern
result
end
end
def fix # :nodoc:
case ruby_version
when '1.8.2'
"\"#{find_file 'rake/ruby182_test_unit_fix'}\""
else
nil
end || ''
end
def ruby_version
RUBY_VERSION
end
def run_code
case @loader
when :direct
"-e \"ARGV.each{|f| require f}\""
when :testrb
"-S testrb #{fix}"
when :rake
"-I\"#{rake_lib_dir}\" \"#{rake_loader}\""
end
end
@ -146,5 +174,18 @@ module Rake
nil
end
def rake_lib_dir # :nodoc:
find_dir('rake') or
fail "unable to find rake lib"
end
def find_dir(fn) # :nodoc:
$LOAD_PATH.each do |path|
file_path = File.join(path, "#{fn}.rb")
return path if File.exist? file_path
end
nil
end
end
end