From 53778ec2d716f860646fd43957fd53c8db4da2fe Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Sat, 27 Oct 2012 14:05:02 +0200 Subject: Respect children paths filter settings E.g. don't eager-load app/assets even if app/* has the eager_load flag set. --- railties/lib/rails/paths.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'railties/lib/rails/paths.rb') diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 4ac3d88dc2..17eba4c69c 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -87,14 +87,15 @@ module Rails protected def filter_by(constraint) - all = [] + yes = [] + no = [] + all_paths.each do |path| - if path.send(constraint) - paths = path.existent - paths -= path.children.map { |p| p.send(constraint) ? [] : p.existent }.flatten - all.concat(paths) - end + paths = path.existent + path.existent_base_paths + path.send(constraint) ? yes.concat(paths) : no.concat(paths) end + + all = yes - no all.uniq! all end @@ -194,6 +195,10 @@ module Rails expanded.select { |d| File.directory?(d) } end + def existent_base_paths + map { |p| File.expand_path(p, @root.path) }.select{ |f| File.exist? f } + end + alias to_a expanded private -- cgit v1.2.3 From f7de647f2cd099ecf6434fa4a0db1ec297f1c32d Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 29 Oct 2012 10:23:11 +0100 Subject: Deprecate Paths::Path#children which is unused now --- railties/lib/rails/paths.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/rails/paths.rb') diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 17eba4c69c..c24940816d 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -124,6 +124,7 @@ module Rails keys.delete(@current) @root.values_at(*keys.sort) end + deprecate :children def first expanded.first -- cgit v1.2.3