2013-11-03 17:58:34 -05:00
|
|
|
task 'assets:precompile' => 'environment' do
|
|
|
|
# see: https://github.com/rails/sprockets-rails/issues/49
|
|
|
|
# a decision was made no longer to copy non-digested assets
|
|
|
|
# this breaks stuff like the emoji plugin. We could fix it,
|
|
|
|
# but its a major pain with little benefit.
|
|
|
|
if rails4?
|
2013-11-04 17:36:52 -05:00
|
|
|
puts "> Copying non-digested versions of assets"
|
2013-11-03 17:58:34 -05:00
|
|
|
assets = Dir.glob(File.join(Rails.root, 'public/assets/**/*'))
|
|
|
|
regex = /(-{1}[a-z0-9]{32}*\.{1}){1}/
|
|
|
|
assets.each do |file|
|
|
|
|
next if File.directory?(file) || file !~ regex
|
|
|
|
|
|
|
|
source = file.split('/')
|
|
|
|
source.push(source.pop.gsub(regex, '.'))
|
|
|
|
|
|
|
|
non_digested = File.join(source)
|
|
|
|
FileUtils.cp(file, non_digested)
|
|
|
|
end
|
2013-11-04 17:36:52 -05:00
|
|
|
puts "> Removing cache"
|
|
|
|
`rm -fr tmp/cache`
|
2013-11-03 17:58:34 -05:00
|
|
|
end
|
|
|
|
end
|