From 651d371a247b0c473fb35a62076e480d95d84a35 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 29 Mar 2011 21:23:05 -0500 Subject: [PATCH] Rename option to config.asset_pipeline --- actionpack/lib/action_controller/railtie.rb | 2 +- railties/lib/rails/application.rb | 24 ++++++++++--------- .../lib/rails/application/configuration.rb | 4 ++-- railties/lib/rails/application/finisher.rb | 8 ++++++- railties/lib/rails/engine.rb | 4 ---- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 0f87295d47..175b7744d7 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -21,7 +21,7 @@ module ActionController paths = app.config.paths options = app.config.action_controller - options.use_sprockets ||= app.config.use_sprockets + options.use_sprockets ||= app.config.asset_pipeline options.assets_dir ||= paths["public"].first options.javascripts_dir ||= paths["public/javascripts"].first options.stylesheets_dir ||= paths["public/stylesheets"].first diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 032a505f26..754b03258a 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -142,7 +142,7 @@ module Rails end def build_asset_environment - return nil if !config.use_sprockets + return unless config.asset_pipeline require 'sprockets' env = Sprockets::Environment.new(root.to_s) env.static_root = root.join("public/assets") @@ -150,16 +150,18 @@ module Rails end initializer :add_sprockets_paths do |app| - [ - "app/javascripts", - "app/stylesheets", - "vendor/plugins/*/app/javascripts", - "vendor/plugins/*/app/stylesheets", - "vendor/plugins/*/javascripts", - "vendor/plugins/*/stylesheets" - ].each do |pattern| - Dir[app.root.join(pattern)].each do |dir| - app.assets.paths << dir + if config.asset_pipeline + [ + "app/javascripts", + "app/stylesheets", + "vendor/plugins/*/app/javascripts", + "vendor/plugins/*/app/stylesheets", + "vendor/plugins/*/javascripts", + "vendor/plugins/*/stylesheets" + ].each do |pattern| + Dir[app.root.join(pattern)].each do |dir| + app.assets.paths << dir + end end end end diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 8dbc596357..81127e5e5f 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -10,7 +10,7 @@ module Rails :preload_frameworks, :reload_plugins, :secret_token, :serve_static_assets, :session_options, :time_zone, :whiny_nils, - :use_sprockets, :compile_assets + :asset_pipeline, :compile_assets attr_writer :log_level @@ -29,7 +29,7 @@ module Rails @log_level = nil @middleware = app_middleware @generators = app_generators - @use_sprockets = false + @asset_pipeline = false @compile_assets = [] end diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index b57af48615..3cfd8f5707 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -34,13 +34,19 @@ module Rails end initializer :add_sprockets_route do |app| - if config.use_sprockets + if config.asset_pipeline app.routes.append do mount app.assets => "/assets" end end end + initializer :set_sprockets_logger do |app| + if config.asset_pipeline + app.assets.logger = Rails.logger + end + end + initializer :build_middleware_stack do build_middleware_stack end diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 8adeafaff5..4fc23fe277 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -535,10 +535,6 @@ module Rails # consistently executed after all the initializers above across all engines. end - initializer "sprockets.logger" do - assets.logger = Rails.logger - end - rake_tasks do next if self.is_a?(Rails::Application)