diff options
author | José Valim <jose.valim@gmail.com> | 2010-02-17 00:15:21 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-17 00:18:12 +0100 |
commit | 23fd1f12801c8585ff3b114e74264b67ad6264e9 (patch) | |
tree | 92c0b9ab00655be3447c6384d21c628bbcbef85d /railties/lib | |
parent | e8ef12e39d4af20c5211cd92aa560590fa5387cd (diff) | |
download | rails-23fd1f12801c8585ff3b114e74264b67ad6264e9.tar.gz rails-23fd1f12801c8585ff3b114e74264b67ad6264e9.tar.bz2 rails-23fd1f12801c8585ff3b114e74264b67ad6264e9.zip |
Show deprecation message for rails/init.rb in plugins.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/plugin.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 64d03e7599..882f2dc28e 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -29,7 +29,7 @@ module Rails unless extra_tasks.empty? ActiveSupport::Deprecation.warn "Having rake tasks in PLUGIN_PATH/tasks or " << - "PLUGIN_PATH/rails/tasks is deprecated. Use to PLUGIN_PATH/lib/tasks instead" + "PLUGIN_PATH/rails/tasks is deprecated. Use PLUGIN_PATH/lib/tasks instead" extra_tasks.sort.each { |ext| load(ext) } end end @@ -44,7 +44,13 @@ module Rails end initializer :load_init_rb, :before => :load_application_initializers do |app| - file = Dir["#{root}/{rails/init,init}.rb"].first + if File.file?(file = File.expand_path("rails/init.rb", root)) + ActiveSupport::Deprecation.warn "PLUGIN_PATH/rails/init.rb in plugins is deprecated. " << + "Use PLUGIN_PATH/init.rb instead" + else + file = File.expand_path("init.rb", root) + end + config = app.config eval(File.read(file), binding, file) if file && File.file?(file) end |