Skip to content

Instantly share code, notes, and snippets.

@rtdp
Created February 17, 2012 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtdp/1854622 to your computer and use it in GitHub Desktop.
Save rtdp/1854622 to your computer and use it in GitHub Desktop.
helps avoiding asset pre-compilation, if assets are not changed.
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 "*"*100
logger.info "Skipping asset pre-compilation because there were no asset changes"
logger.info "*"*100
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment