2010-01-23 10:07:20 -05:00
|
|
|
module Rails
|
|
|
|
class Application
|
|
|
|
module Finisher
|
|
|
|
include Initializable
|
|
|
|
|
2010-01-23 11:13:25 -05:00
|
|
|
initializer :ensure_load_once_paths_as_subset do
|
|
|
|
extra = ActiveSupport::Dependencies.load_once_paths -
|
|
|
|
ActiveSupport::Dependencies.load_paths
|
|
|
|
|
|
|
|
unless extra.empty?
|
|
|
|
abort <<-end_error
|
|
|
|
load_once_paths must be a subset of the load_paths.
|
|
|
|
Extra items in load_once_paths: #{extra * ','}
|
|
|
|
end_error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-01-23 10:07:20 -05:00
|
|
|
initializer :add_builtin_route do |app|
|
|
|
|
if Rails.env.development?
|
2010-01-24 08:48:00 -05:00
|
|
|
RoutesReloader.paths << File.join(RAILTIES_PATH, 'builtin', 'routes.rb')
|
2010-01-23 10:07:20 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
initializer :build_middleware_stack do |app|
|
|
|
|
app.app
|
|
|
|
end
|
|
|
|
|
|
|
|
# Fires the user-supplied after_initialize block (config#after_initialize)
|
|
|
|
initializer :after_initialize do |app|
|
|
|
|
app.config.after_initialize_blocks.each do |block|
|
|
|
|
block.call(app)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Disable dependency loading during request cycle
|
|
|
|
initializer :disable_dependency_loading do |app|
|
|
|
|
if app.config.cache_classes && !app.config.dependency_loading
|
|
|
|
ActiveSupport::Dependencies.unhook!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|