public
Created — forked from stympy/deploy.rb

Skip asset pre-compilation when deploying if the assets didn't change

  • Download Gist
deploy.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12
namespace :deploy do
namespace :assets do
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 %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.