diff options
Diffstat (limited to 'actionpack/lib/sprockets')
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 6 | ||||
-rw-r--r-- | actionpack/lib/sprockets/helpers/rails_helper.rb | 29 | ||||
-rw-r--r-- | actionpack/lib/sprockets/railtie.rb | 6 |
3 files changed, 13 insertions, 28 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 7ee82ee530..54907abb39 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -47,10 +47,8 @@ namespace :assets do env.precompile(*assets) end - if config.assets.manifest - File.open("#{target}/manifest.yml", 'w') do |f| - YAML.dump(manifest, f) - end + File.open("#{target}/manifest.yml", 'w') do |f| + YAML.dump(manifest, f) end end end diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index 8e7eb182fd..975dc9e80c 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -61,7 +61,7 @@ module Sprockets def debug_assets? begin config = Rails.application.config.assets - config.allow_debugging && (config.debug || params[:debug_assets]) + config.compile && (config.debug || params[:debug_assets]) rescue NoMethodError false end @@ -114,22 +114,21 @@ module Sprockets return digest end - if digest.nil? && Rails.application.config.assets.precompile_only - raise AssetNotPrecompiledError - end - - if asset = asset_environment[logical_path] - return asset.digest_path + if Rails.application.config.assets.compile + if asset = asset_environment[logical_path] + return asset.digest_path + end + return logical_path + else + raise AssetNotPrecompiledError.new("#{logical_path} isn't precompiled") end - - logical_path end def rewrite_asset_path(source, dir) if source[0] == ?/ source else - source = digest_for(source) if performing_caching? + source = digest_for(source) if Rails.application.config.assets.digest source = File.join(dir, source) source = "/#{source}" unless source =~ /^\// source @@ -143,16 +142,6 @@ module Sprockets source end end - - def performing_caching? - # When included in Sprockets::Context, we need to ask the - # top-level config as the controller is not available. - if config.action_controller.present? - config.action_controller.perform_caching - else - config.perform_caching - end - end end end end diff --git a/actionpack/lib/sprockets/railtie.rb b/actionpack/lib/sprockets/railtie.rb index 680cb980ff..4adfd000f8 100644 --- a/actionpack/lib/sprockets/railtie.rb +++ b/actionpack/lib/sprockets/railtie.rb @@ -26,10 +26,8 @@ module Sprockets end end - if config.assets.manifest - if File.exist?(path = File.join(Rails.public_path, config.assets.prefix, "manifest.yml")) - config.assets.digests = YAML.load_file(path) - end + if File.exist?(path = File.join(Rails.public_path, config.assets.prefix, "manifest.yml")) + config.assets.digests = YAML.load_file(path) end ActiveSupport.on_load(:action_view) do |