diff options
author | wycats <wycats@gmail.com> | 2010-03-23 16:34:02 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-23 16:35:14 -0700 |
commit | 45e8cf59dfd6a66f996db1dc02c122bbc66b97aa (patch) | |
tree | bff931fe391bf1bbbc1280376959bf211efcd245 /railties/lib | |
parent | b92963f9f8c8468134d4f726442bb5aae03ecfc6 (diff) | |
download | rails-45e8cf59dfd6a66f996db1dc02c122bbc66b97aa.tar.gz rails-45e8cf59dfd6a66f996db1dc02c122bbc66b97aa.tar.bz2 rails-45e8cf59dfd6a66f996db1dc02c122bbc66b97aa.zip |
init.rb in plugins is here to stay
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/engine.rb | 7 | ||||
-rw-r--r-- | railties/lib/rails/engine/configuration.rb | 36 | ||||
-rw-r--r-- | railties/lib/rails/plugin.rb | 10 |
3 files changed, 22 insertions, 31 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 987573ea03..85b4ff8470 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -109,13 +109,6 @@ module Rails config.generators.templates.unshift(*paths.lib.templates.to_a) end - initializer :load_lib_initializers do |app| - paths.lib.rails.initializers.to_a.sort.each do |initializer| - config = app.config - eval(File.read(initializer), binding, initializer) - end - end - initializer :load_application_initializers do paths.config.initializers.to_a.sort.each do |initializer| load(initializer) diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index 1996b2fb90..b8f1f1009c 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -14,25 +14,23 @@ module Rails def paths @paths ||= begin paths = Rails::Paths::Root.new(@root) - paths.app "app", :eager_load => true, :glob => "*" - paths.app.controllers "app/controllers", :eager_load => true - paths.app.helpers "app/helpers", :eager_load => true - paths.app.models "app/models", :eager_load => true - paths.app.mailers "app/mailers", :eager_load => true - paths.app.metals "app/metal", :eager_load => true - paths.app.views "app/views", :eager_load => true - paths.lib "lib", :load_path => true - paths.lib.rails "lib/rails", :glob => "**/*.rake" - paths.lib.rails.initializers "lib/rails/initializers", :glob => "**/*.rb" - paths.lib.tasks "lib/tasks", :glob => "**/*.rake" - paths.lib.templates "lib/templates" - paths.config "config" - paths.config.initializers "config/initializers", :glob => "**/*.rb" - paths.config.locales "config/locales", :glob => "*.{rb,yml}" - paths.config.routes "config/routes.rb" - paths.public "public" - paths.public.javascripts "public/javascripts" - paths.public.stylesheets "public/stylesheets" + paths.app "app", :eager_load => true, :glob => "*" + paths.app.controllers "app/controllers", :eager_load => true + paths.app.helpers "app/helpers", :eager_load => true + paths.app.models "app/models", :eager_load => true + paths.app.mailers "app/mailers", :eager_load => true + paths.app.metals "app/metal", :eager_load => true + paths.app.views "app/views", :eager_load => true + paths.lib "lib", :load_path => true + paths.lib.tasks "lib/tasks", :glob => "**/*.rake" + paths.lib.templates "lib/templates" + paths.config "config" + paths.config.initializers "config/initializers", :glob => "**/*.rb" + paths.config.locales "config/locales", :glob => "*.{rb,yml}" + paths.config.routes "config/routes.rb" + paths.public "public" + paths.public.javascripts "public/javascripts" + paths.public.stylesheets "public/stylesheets" paths end end diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index a08c5b9143..98f329cc17 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -47,11 +47,11 @@ module Rails end initializer :load_init_rb, :before => :load_application_initializers do |app| - lib_initializers = paths.lib.rails.initializers.to_a - files = %w(rails/init.rb init.rb).map { |path| File.expand_path(path, root) } - - if lib_initializers.empty? && initrb = files.find { |path| File.file?(path) } - ActiveSupport::Deprecation.warn "init.rb is deprecated: #{initrb}. Use lib/rails/initializers/#{name}.rb" + files = %w(rails/init.rb init.rb).map { |path| File.expand_path path, root } + if initrb = files.find { |path| File.file? path } + if initrb == files.first + ActiveSupport::Deprecation.warn "Use toplevel init.rb; rails/init.rb is deprecated: #{initrb}" + end config = app.config eval(File.read(initrb), binding, initrb) end |