Properly deprecate config.load_paths and config.gem

This commit is contained in:
wycats
2010-08-02 23:39:17 -07:00
parent 4dc2521028
commit f73e9d2df8

View File

@@ -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