diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-08-29 16:28:11 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-08-31 12:41:28 -0500 |
commit | dffdd829930e664cef522f34730d5987be348596 (patch) | |
tree | 6ccbfc5d488ac58269484e9bc932a269d07bc9ab /actionpack/lib/sprockets/assets.rake | |
parent | 508f33f35c9ce7a8973c1cf3466223313dfcfb24 (diff) | |
download | rails-dffdd829930e664cef522f34730d5987be348596.tar.gz rails-dffdd829930e664cef522f34730d5987be348596.tar.bz2 rails-dffdd829930e664cef522f34730d5987be348596.zip |
Read digests of assets from manifest.yml if config.assets.manifest is on
Diffstat (limited to 'actionpack/lib/sprockets/assets.rake')
-rw-r--r-- | actionpack/lib/sprockets/assets.rake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake index 5698f22080..7ee82ee530 100644 --- a/actionpack/lib/sprockets/assets.rake +++ b/actionpack/lib/sprockets/assets.rake @@ -19,7 +19,8 @@ namespace :assets do config = Rails.application.config env = Rails.application.assets - target = Rails.root.join("public#{config.assets.prefix}") + target = Pathname.new(File.join(Rails.public_path, config.assets.prefix)) + manifest = {} if env.respond_to?(:each_logical_path) config.assets.precompile.each do |path| @@ -31,6 +32,7 @@ namespace :assets do end if asset = env.find_asset(logical_path) + manifest[logical_path] = asset.digest_path filename = target.join(asset.digest_path) mkdir_p filename.dirname asset.write_to(filename) @@ -44,6 +46,12 @@ namespace :assets do assets << {:to => target} env.precompile(*assets) end + + if config.assets.manifest + File.open("#{target}/manifest.yml", 'w') do |f| + YAML.dump(manifest, f) + end + end end end |