aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2011-08-31 12:47:33 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2011-08-31 13:12:09 -0500
commitf236e00189b5a6cf0cebac5c275f64d41d73428d (patch)
treeb698934e71ef9d329ccc14fef545239faf9f6362 /actionpack/lib
parentfa04c37f45ca9299a5efb426913488b678c178ce (diff)
downloadrails-f236e00189b5a6cf0cebac5c275f64d41d73428d.tar.gz
rails-f236e00189b5a6cf0cebac5c275f64d41d73428d.tar.bz2
rails-f236e00189b5a6cf0cebac5c275f64d41d73428d.zip
Backport f443f9cb0c64 to master
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/sprockets/assets.rake6
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb29
-rw-r--r--actionpack/lib/sprockets/railtie.rb6
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