diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-03-12 16:00:01 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-03-12 16:00:01 +0000 |
commit | e68bfaf1fe1a7890a67af6f444281185f507cf9e (patch) | |
tree | 5e73caccdcdd65d0ac97f9eb92195928f30925f2 /railties/lib/rails/plugin.rb | |
parent | ef6462c73003b28c8e060a06120abb9cd67b6d52 (diff) | |
parent | 16846553b8866eab2aa3b128a2a23a221a25f7e3 (diff) | |
download | rails-e68bfaf1fe1a7890a67af6f444281185f507cf9e.tar.gz rails-e68bfaf1fe1a7890a67af6f444281185f507cf9e.tar.bz2 rails-e68bfaf1fe1a7890a67af6f444281185f507cf9e.zip |
Merge remote branch 'mainstream/master'
Conflicts:
activerecord/lib/active_record/base.rb
railties/lib/rails/configuration.rb
railties/lib/rails/log_subscriber.rb
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r-- | railties/lib/rails/plugin.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 2a746e0fa6..0997be1b6f 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,4 +1,5 @@ require 'rails/engine' +require 'active_support/core_ext/array/conversions' module Rails # Rails::Plugin is nothing more than a Rails::Engine, but since it's loaded too late @@ -40,12 +41,14 @@ module Rails def load_tasks super - extra_tasks = Dir["#{root}/{tasks,rails/tasks}/**/*.rake"] + load_deprecated_tasks + end - 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" - extra_tasks.sort.each { |ext| load(ext) } + def load_deprecated_tasks + tasks = Dir["#{root}/{tasks,rails/tasks}/**/*.rake"].sort + if tasks.any? + ActiveSupport::Deprecation.warn "Rake tasks in #{tasks.to_sentence} are deprecated. Use lib/tasks instead" + tasks.each { |ext| load(ext) } end end @@ -59,9 +62,14 @@ module Rails end initializer :load_init_rb, :before => :load_application_initializers do |app| - file = Dir["#{root}/{rails/init,init}.rb"].first - config = app.config - eval(File.read(file), binding, file) if file && File.file?(file) + 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 end initializer :sanity_check_railties_collision do |