1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Rename option to config.asset_pipeline

This commit is contained in:
Joshua Peek 2011-03-29 21:23:05 -05:00
parent 612454e00e
commit 651d371a24
5 changed files with 23 additions and 19 deletions

View file

@ -21,7 +21,7 @@ module ActionController
paths = app.config.paths paths = app.config.paths
options = app.config.action_controller 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.assets_dir ||= paths["public"].first
options.javascripts_dir ||= paths["public/javascripts"].first options.javascripts_dir ||= paths["public/javascripts"].first
options.stylesheets_dir ||= paths["public/stylesheets"].first options.stylesheets_dir ||= paths["public/stylesheets"].first

View file

@ -142,7 +142,7 @@ module Rails
end end
def build_asset_environment def build_asset_environment
return nil if !config.use_sprockets return unless config.asset_pipeline
require 'sprockets' require 'sprockets'
env = Sprockets::Environment.new(root.to_s) env = Sprockets::Environment.new(root.to_s)
env.static_root = root.join("public/assets") env.static_root = root.join("public/assets")
@ -150,16 +150,18 @@ module Rails
end end
initializer :add_sprockets_paths do |app| initializer :add_sprockets_paths do |app|
[ if config.asset_pipeline
"app/javascripts", [
"app/stylesheets", "app/javascripts",
"vendor/plugins/*/app/javascripts", "app/stylesheets",
"vendor/plugins/*/app/stylesheets", "vendor/plugins/*/app/javascripts",
"vendor/plugins/*/javascripts", "vendor/plugins/*/app/stylesheets",
"vendor/plugins/*/stylesheets" "vendor/plugins/*/javascripts",
].each do |pattern| "vendor/plugins/*/stylesheets"
Dir[app.root.join(pattern)].each do |dir| ].each do |pattern|
app.assets.paths << dir Dir[app.root.join(pattern)].each do |dir|
app.assets.paths << dir
end
end end
end end
end end

View file

@ -10,7 +10,7 @@ module Rails
:preload_frameworks, :reload_plugins, :preload_frameworks, :reload_plugins,
:secret_token, :serve_static_assets, :session_options, :secret_token, :serve_static_assets, :session_options,
:time_zone, :whiny_nils, :time_zone, :whiny_nils,
:use_sprockets, :compile_assets :asset_pipeline, :compile_assets
attr_writer :log_level attr_writer :log_level
@ -29,7 +29,7 @@ module Rails
@log_level = nil @log_level = nil
@middleware = app_middleware @middleware = app_middleware
@generators = app_generators @generators = app_generators
@use_sprockets = false @asset_pipeline = false
@compile_assets = [] @compile_assets = []
end end

View file

@ -34,13 +34,19 @@ module Rails
end end
initializer :add_sprockets_route do |app| initializer :add_sprockets_route do |app|
if config.use_sprockets if config.asset_pipeline
app.routes.append do app.routes.append do
mount app.assets => "/assets" mount app.assets => "/assets"
end end
end 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 initializer :build_middleware_stack do
build_middleware_stack build_middleware_stack
end end

View file

@ -535,10 +535,6 @@ module Rails
# consistently executed after all the initializers above across all engines. # consistently executed after all the initializers above across all engines.
end end
initializer "sprockets.logger" do
assets.logger = Rails.logger
end
rake_tasks do rake_tasks do
next if self.is_a?(Rails::Application) next if self.is_a?(Rails::Application)