diff options
author | José Valim <jose.valim@gmail.com> | 2011-04-17 10:51:07 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-17 10:51:07 +0200 |
commit | 8f75c3abcde4f2ff64e855178027e1bd93976de9 (patch) | |
tree | f073004714ccc0430cda2d926b30b4a9ecc79294 /railties/lib | |
parent | 16b9547a881eb2e201c6f17ec7850bc05c8f6a52 (diff) | |
download | rails-8f75c3abcde4f2ff64e855178027e1bd93976de9.tar.gz rails-8f75c3abcde4f2ff64e855178027e1bd93976de9.tar.bz2 rails-8f75c3abcde4f2ff64e855178027e1bd93976de9.zip |
Move app initializers to sprockets railtie.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 9 | ||||
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 18 |
2 files changed, 2 insertions, 25 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 7af0735c14..0c3c7737ea 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -139,15 +139,6 @@ module Rails alias :build_middleware_stack :app - def build_asset_environment - require 'sprockets' - env = Sprockets::Environment.new(root.to_s) - env.static_root = File.join(root.join("public"), config.assets.prefix) - env.paths.concat config.assets.paths - env.logger = Rails.logger - @assets = env - end - def default_middleware_stack ActionDispatch::MiddlewareStack.new.tap do |middleware| if rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 838e50de6c..bf865ce466 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -33,22 +33,6 @@ module Rails end end - initializer :add_sprockets_route do |app| - assets = config.assets - if assets.enabled - build_asset_environment - app.routes.append do - mount app.assets => assets.prefix - end - end - end - - initializer :index_sprockets_environment do |app| - if config.assets.enabled && config.action_controller.perform_caching - app.assets = app.assets.index - end - end - initializer :build_middleware_stack do build_middleware_stack end @@ -69,6 +53,8 @@ module Rails end # Force routes to be loaded just at the end and add it to to_prepare callbacks + # This needs to be after the finisher hook to ensure routes added in the hook + # are still loaded. initializer :set_routes_reloader do |app| reloader = lambda { app.routes_reloader.execute_if_updated } reloader.call |