Remove load 'deploy/assets'
from Capfile
or config/deploy.rb
and add the following lines to config/deploy.rb
:
set: assets_role, [: web,: app]
set: normalize_asset_timestamps, false
set: assets_tar_path, "# {release_name} -assets.tar.gz"
before "deploy: update" do
run_locally "rake assets: precompile"
run_locally "cd public; tar czf # {Dir.tmpdir} / # {assets_tar_path} assets"
end
before "deploy: finalize_update",: roles => assets_role,: except => {: no_release => true} do
upload "# {Dir.tmpdir} / # {assets_tar_path}", "# {shared_path} / # {assets_tar_path}"
run "cd # {shared_path}; / bin / tar xzf # {assets_tar_path}"
run "/ bin / ln -s # {shared_path} / assets # {release_path} / public"
run "/ bin / rm # {shared_path} / # {assets_tar_path}"
end
If you are using turbo-sprockets-rails3 , add this to the last block:
run "cd # {release_path}; # {rake} assets: clean_expired 2> / dev / null"
source share