Skip to content

Instantly share code, notes, and snippets.

@bhenerey
Forked from olegykz/deploy.rb
Created January 24, 2013 03:34
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 bhenerey/4617413 to your computer and use it in GitHub Desktop.
Save bhenerey/4617413 to your computer and use it in GitHub Desktop.
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
begin
from = source.next_revision(current_revision) # <-- Fail here at first-time deploy because of current/REVISION absence
rescue
err_no = true
end
if err_no || 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment