mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Properly deprecate config.load_paths and config.gem
This commit is contained in:
@@ -48,6 +48,33 @@ module Rails
|
||||
def autoload_paths
|
||||
@autoload_paths ||= paths.autoload_paths
|
||||
end
|
||||
|
||||
def load_paths
|
||||
ActiveSupport::Deprecation.warn "config.load_paths is deprecated. Please use config.autoload_paths instead."
|
||||
autoload_paths
|
||||
end
|
||||
|
||||
def load_paths=(paths)
|
||||
ActiveSupport::Deprecation.warn "config.load_paths= is deprecated. Please use config.autoload_paths instead."
|
||||
self.autoload_paths = paths
|
||||
end
|
||||
|
||||
# Rails 3, by default, uses bundler, which shims the Kernel#gem method so that it should
|
||||
# behave correctly for this deprecation.
|
||||
def gem(name, options = {})
|
||||
super name, options[:version] || ">= 0"
|
||||
require options[:lib] || name
|
||||
rescue Gem::LoadError
|
||||
msg = "config.gem is deprecated, and you tried to activate the '#{name}' gem using it.\n"
|
||||
|
||||
if File.exist?("#{Rails.root}/Gemfile")
|
||||
msg << "Please add '#{name}' to your Gemfile."
|
||||
else
|
||||
msg << "Please update your application to use bundler."
|
||||
end
|
||||
ActiveSupport::Deprecation.warn(msg, caller)
|
||||
exit
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user