update dedigest_assets rake task

This commit is contained in:
2015-05-29 15:28:42 +02:00
parent 1313fdda9b
commit 2ca3b79e4c
+2 -2
View File
@@ -1,8 +1,8 @@
task dedigest_assets: :environment do
extensions = %w[jpg png js css gif]
Dir.glob(Rails.root.join('public/assets/**', "*.{#{extensions.join(',')}}")).each do |asset_path|
next unless asset_path =~ /-[a-f0-9]{32}\.(#{extensions.join('|')})\Z/
dedigest_path = asset_path.sub(/-[a-f0-9]{32}/, '')
next unless asset_path =~ /-[a-f0-9]{32,64}\.(#{extensions.join('|')})\Z/
dedigest_path = asset_path.sub(/-[a-f0-9]{32,64}/, '')
`cp '#{asset_path}' '#{dedigest_path}' 2>/dev/null`
end
end