mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* NEWS (with all sufficient information):
* lib/rake: Update to rake 10.1.0 * bin/rake: ditto. * test/rake: ditto. * NEWS: Update NEWS to include rake 10.1.0 and links to release notes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
52c1331763
commit
9cadc95b28
83 changed files with 1724 additions and 2954 deletions
|
@ -41,10 +41,11 @@ module Rake
|
|||
|
||||
# List of array methods (that are not in +Object+) that need to be
|
||||
# delegated.
|
||||
ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).map { |n| n.to_s }
|
||||
ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).
|
||||
map { |n| n.to_s }
|
||||
|
||||
# List of additional methods that must be delegated.
|
||||
MUST_DEFINE = %w[to_a inspect <=>]
|
||||
MUST_DEFINE = %w[inspect <=>]
|
||||
|
||||
# List of methods that should not be delegated here (we define special
|
||||
# versions of them explicitly below).
|
||||
|
@ -58,12 +59,13 @@ module Rake
|
|||
+ - & |
|
||||
]
|
||||
|
||||
DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).collect{ |s| s.to_s }.sort.uniq
|
||||
DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).
|
||||
map { |s| s.to_s }.sort.uniq
|
||||
|
||||
# Now do the delegation.
|
||||
DELEGATING_METHODS.each_with_index do |sym, i|
|
||||
DELEGATING_METHODS.each do |sym|
|
||||
if SPECIAL_RETURN.include?(sym)
|
||||
ln = __LINE__+1
|
||||
ln = __LINE__ + 1
|
||||
class_eval %{
|
||||
def #{sym}(*args, &block)
|
||||
resolve
|
||||
|
@ -72,7 +74,7 @@ module Rake
|
|||
end
|
||||
}, __FILE__, ln
|
||||
else
|
||||
ln = __LINE__+1
|
||||
ln = __LINE__ + 1
|
||||
class_eval %{
|
||||
def #{sym}(*args, &block)
|
||||
resolve
|
||||
|
@ -149,10 +151,8 @@ module Rake
|
|||
patterns.each do |pat|
|
||||
@exclude_patterns << pat
|
||||
end
|
||||
if block_given?
|
||||
@exclude_procs << block
|
||||
end
|
||||
resolve_exclude if ! @pending
|
||||
@exclude_procs << block if block_given?
|
||||
resolve_exclude unless @pending
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -219,7 +219,7 @@ module Rake
|
|||
private :resolve_add
|
||||
|
||||
def resolve_exclude
|
||||
reject! { |fn| exclude?(fn) }
|
||||
reject! { |fn| excluded_from_list?(fn) }
|
||||
self
|
||||
end
|
||||
private :resolve_exclude
|
||||
|
@ -231,7 +231,7 @@ module Rake
|
|||
# FileList['a.c', 'b.c'].sub(/\.c$/, '.o') => ['a.o', 'b.o']
|
||||
#
|
||||
def sub(pat, rep)
|
||||
inject(FileList.new) { |res, fn| res << fn.sub(pat,rep) }
|
||||
inject(FileList.new) { |res, fn| res << fn.sub(pat, rep) }
|
||||
end
|
||||
|
||||
# Return a new FileList with the results of running +gsub+ against each
|
||||
|
@ -242,18 +242,18 @@ module Rake
|
|||
# => ['lib\\test\\file', 'x\\y']
|
||||
#
|
||||
def gsub(pat, rep)
|
||||
inject(FileList.new) { |res, fn| res << fn.gsub(pat,rep) }
|
||||
inject(FileList.new) { |res, fn| res << fn.gsub(pat, rep) }
|
||||
end
|
||||
|
||||
# Same as +sub+ except that the original file list is modified.
|
||||
def sub!(pat, rep)
|
||||
each_with_index { |fn, i| self[i] = fn.sub(pat,rep) }
|
||||
each_with_index { |fn, i| self[i] = fn.sub(pat, rep) }
|
||||
self
|
||||
end
|
||||
|
||||
# Same as +gsub+ except that the original file list is modified.
|
||||
def gsub!(pat, rep)
|
||||
each_with_index { |fn, i| self[i] = fn.gsub(pat,rep) }
|
||||
each_with_index { |fn, i| self[i] = fn.gsub(pat, rep) }
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -341,13 +341,19 @@ module Rake
|
|||
# Add matching glob patterns.
|
||||
def add_matching(pattern)
|
||||
FileList.glob(pattern).each do |fn|
|
||||
self << fn unless exclude?(fn)
|
||||
self << fn unless excluded_from_list?(fn)
|
||||
end
|
||||
end
|
||||
private :add_matching
|
||||
|
||||
# Should the given file name be excluded?
|
||||
def exclude?(fn)
|
||||
# Should the given file name be excluded from the list?
|
||||
#
|
||||
# NOTE: This method was formally named "exclude?", but Rails
|
||||
# introduced an exclude? method as an array method and setup a
|
||||
# conflict with file list. We renamed the method to avoid
|
||||
# confusion. If you were using "FileList#exclude?" in your user
|
||||
# code, you will need to update.
|
||||
def excluded_from_list?(fn)
|
||||
return true if @exclude_patterns.any? do |pat|
|
||||
case pat
|
||||
when Regexp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue