diff options
Diffstat (limited to 'railties/lib/rails/paths.rb')
-rw-r--r-- | railties/lib/rails/paths.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index b37421c09c..d9c47c0498 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -55,13 +55,13 @@ module Rails end def []=(path, value) - value = Path.new(self, path, value) unless value.is_a?(Path) + value = Path.new(self, path, [value].flatten) unless value.is_a?(Path) super(path, value) end def add(path, options={}) with = options[:with] || path - self[path] = Path.new(self, path, with, options) + self[path] = Path.new(self, path, [with].flatten, options) end def all_paths @@ -104,9 +104,8 @@ module Rails attr_reader :path attr_accessor :glob - def initialize(root, current, *paths) - options = paths.last.is_a?(::Hash) ? paths.pop : {} - super(paths.flatten) + def initialize(root, current, paths, options = {}) + super(paths) @current = current @root = root @@ -156,8 +155,10 @@ module Rails each do |p| path = File.expand_path(p, @root.path) - if @glob - result.concat Dir[File.join(path, @glob)].sort + if @glob && File.directory?(path) + result.concat Dir.chdir(path) { + Dir.glob(@glob).map { |file| File.join path, file }.sort + } else result << path end |