Quick assets deploy with capistrano
namespace :assets do
desc "Precompile assets"
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run_locally("rm -rf public/assets/*")
run_locally("bundle exec rake assets:precompile")
run_locally("rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{domain}:#{shared_path}")
run_locally("rm -rf public/assets/*")
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
Written by Timur Valeev
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Capistrano
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#