aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rake/file_list.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-06 09:31:37 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-06 09:31:37 +0000
commitf6d2b4858891376dec83e43dccfa028d4b32b184 (patch)
tree053f00bd120e730616a371793eb579edddba29e4 /lib/rake/file_list.rb
parent6057695c87cf8281f3ff9aa37cfdf1c317e1f9c1 (diff)
downloadruby-f6d2b4858891376dec83e43dccfa028d4b32b184.tar.gz
* lib/rake.rb, lib/rake/*, test/rake/*: Update latest rake master(e47d023)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/file_list.rb')
-rw-r--r--lib/rake/file_list.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb
index b01dbbb341..006ec7703e 100644
--- a/lib/rake/file_list.rb
+++ b/lib/rake/file_list.rb
@@ -49,7 +49,7 @@ module Rake
# List of methods that should not be delegated here (we define special
# versions of them explicitly below).
- MUST_NOT_DEFINE = %w[to_a to_ary partition *]
+ MUST_NOT_DEFINE = %w[to_a to_ary partition * <<]
# List of delegated methods that return new array values which need
# wrapping.
@@ -119,7 +119,7 @@ module Rake
if fn.respond_to? :to_ary
include(*fn.to_ary)
else
- @pending_add << fn
+ @pending_add << Rake.from_pathname(fn)
end
end
@pending = true
@@ -149,7 +149,7 @@ module Rake
#
def exclude(*patterns, &block)
patterns.each do |pat|
- @exclude_patterns << pat
+ @exclude_patterns << Rake.from_pathname(pat)
end
@exclude_procs << block if block_given?
resolve_exclude unless @pending
@@ -196,6 +196,12 @@ module Rake
end
end
+ def <<(obj)
+ resolve
+ @items << Rake.from_pathname(obj)
+ self
+ end
+
# Resolve all the pending adds now.
def resolve
if @pending
@@ -346,7 +352,7 @@ module Rake
# Should the given file name be excluded from the list?
#
- # NOTE: This method was formally named "exclude?", but Rails
+ # NOTE: This method was formerly 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
@@ -410,5 +416,13 @@ module Rake
dir = File.dirname(dir)
end
end
+
+ # Convert Pathname and Pathname-like objects to strings;
+ # leave everything else alone
+ def from_pathname(path) # :nodoc:
+ path = path.to_path if path.respond_to?(:to_path)
+ path = path.to_str if path.respond_to?(:to_str)
+ path
+ end
end
end # module Rake