Skip to content

Commit

Permalink
Respect children paths filter settings
Browse files Browse the repository at this point in the history
E.g. don't eager-load app/assets even if app/* has the eager_load flag set.
  • Loading branch information
elia committed Oct 27, 2012
1 parent 552a3e1 commit 53778ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions railties/CHANGELOG.md
@@ -1,5 +1,7 @@
## Rails 3.2.9 (unreleased)

* Don't eager-load app/assets and app/views *Elia Schito*

* Update supported ruby versions error message in ruby_version_check.rb *Lihan Li*

## Rails 3.2.8 (Aug 9, 2012) ##
Expand Down
17 changes: 11 additions & 6 deletions railties/lib/rails/paths.rb
Expand Up @@ -87,14 +87,15 @@ def load_paths
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
Expand Down Expand Up @@ -194,6 +195,10 @@ def existent_directories
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
Expand Down

0 comments on commit 53778ec

Please sign in to comment.