My deployments are slow, they take at least 3 minutes. The slow Capistrano task during deploy is assets:precompile. This takes probably 99% of the total deploy time. How can
The solution that Ben Curtis propose does not work for me, because I do not copy the .git folder when deploying (slow and useless) :
set :scm, :git
set :deploy_via, :remote_cache
set :copy_exclude, ['.git']
I'm using the following snippet, whitout load 'deploy/assets'
task :assets, :roles => :app do
run <<-EOF
cd #{release_path} &&
rm -rf public/assets &&
mkdir -p #{shared_path}/assets &&
ln -s #{shared_path}/assets public/assets &&
export FROM=`[ -f #{current_path}/REVISION ] && (cat #{current_path}/REVISION | perl -pe 's/$/../')` &&
export TO=`cat #{release_path}/REVISION` &&
echo ${FROM}${TO} &&
cd #{shared_path}/cached-copy &&
git log ${FROM}${TO} -- app/assets vendor/assets | wc -l | egrep '^0$' ||
(
echo "Recompiling assets" &&
cd #{release_path} &&
source .rvmrc &&
RAILS_ENV=production bundle exec rake assets:precompile --trace
)
EOF
end