diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-18 15:37:18 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-18 15:37:58 -0600 |
commit | 59cd044310d4bb454d492addffb8bd60dd8a23a9 (patch) | |
tree | 10caddd62cef767ab919210339680a2f61a206a6 /railties | |
parent | 9e7ec2a9f13aa52cdf07cf9308e8031548dcddc0 (diff) | |
download | rails-59cd044310d4bb454d492addffb8bd60dd8a23a9.tar.gz rails-59cd044310d4bb454d492addffb8bd60dd8a23a9.tar.bz2 rails-59cd044310d4bb454d492addffb8bd60dd8a23a9.zip |
Add all folders in app/* to the load path
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/bootstrap.rb | 11 | ||||
-rw-r--r-- | railties/lib/rails/configuration.rb | 18 |
2 files changed, 11 insertions, 18 deletions
diff --git a/railties/lib/rails/bootstrap.rb b/railties/lib/rails/bootstrap.rb index b7cf70747a..5db663f9ef 100644 --- a/railties/lib/rails/bootstrap.rb +++ b/railties/lib/rails/bootstrap.rb @@ -23,8 +23,8 @@ module Rails # the load_once paths. initializer :set_autoload_paths do require 'active_support/dependencies' - ActiveSupport::Dependencies.load_paths = config.load_paths.uniq - ActiveSupport::Dependencies.load_once_paths = config.load_once_paths.uniq + ActiveSupport::Dependencies.load_paths = expand_load_path(config.load_paths) + ActiveSupport::Dependencies.load_once_paths = expand_load_path(config.load_once_paths) extra = ActiveSupport::Dependencies.load_once_paths - ActiveSupport::Dependencies.load_paths unless extra.empty? @@ -140,7 +140,7 @@ module Rails end end - initializer :initialize_notifications do + initializer :initialize_notifications do require 'active_support/notifications' if config.colorize_logging == false @@ -152,5 +152,10 @@ module Rails Rails::Subscriber.dispatch(args) end end + + private + def expand_load_path(load_paths) + load_paths.map { |path| Dir.glob(path.to_s) }.flatten.uniq + end end end diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 45e2e521ef..b76a7ac2d8 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -200,12 +200,7 @@ module Rails end def eager_load_paths - @eager_load_paths ||= %w( - app/metal - app/models - app/controllers - app/helpers - ).map { |dir| "#{root}/#{dir}" }.select { |dir| File.directory?(dir) } + @eager_load_paths ||= ["#{root}/app/*"] end def load_paths @@ -215,20 +210,13 @@ module Rails # Add the old mock paths only if the directories exists paths.concat(Dir["#{root}/test/mocks/#{Rails.env}"]) if File.exists?("#{root}/test/mocks/#{Rails.env}") - # Add the app's controller directory - paths.concat(Dir["#{root}/app/controllers/"]) - # Followed by the standard includes. paths.concat %w( app - app/metal - app/models - app/controllers - app/helpers - app/services + app/* lib vendor - ).map { |dir| "#{root}/#{dir}" }.select { |dir| File.directory?(dir) } + ).map { |dir| "#{root}/#{dir}" } paths.concat builtin_directories end |