mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
plugin rails/init.rb deprecation message
This commit is contained in:
@@ -95,8 +95,8 @@ module Rails
|
||||
|
||||
initializer :add_view_paths do
|
||||
views = paths.app.views.to_a
|
||||
ActionController::Base.view_paths.unshift(*views) if defined?(ActionController)
|
||||
ActionMailer::Base.view_paths.unshift(*views) if defined?(ActionMailer)
|
||||
ActionController::Base.prepend_view_path(views) if defined?(ActionController)
|
||||
ActionMailer::Base.prepend_view_path(views) if defined?(ActionMailer)
|
||||
end
|
||||
|
||||
initializer :add_metals do |app|
|
||||
@@ -132,4 +132,4 @@ module Rails
|
||||
app.config.reload_engines
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,11 +26,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 "Rake tasks in #{extra_tasks.to_sentence} are deprecated. Use 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
|
||||
|
||||
@@ -44,15 +47,14 @@ module Rails
|
||||
end
|
||||
|
||||
initializer :load_init_rb, :before => :load_application_initializers do |app|
|
||||
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)
|
||||
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
|
||||
|
||||
config = app.config
|
||||
eval(File.read(file), binding, file) if file && File.file?(file)
|
||||
end
|
||||
|
||||
initializer :sanity_check_railties_collision do
|
||||
|
||||
Reference in New Issue
Block a user