Created
August 10, 2014 14:41
-
-
Save Hermanverschooten/5b3471d17b8ced329832 to your computer and use it in GitHub Desktop.
Skip asset compilation in Capistrano 3 if no assets have changed since last deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
Rake::Task["deploy:compile_assets"].clear_actions | |
task :compile_assets => [:set_rails_env] do | |
run_locally do | |
if capture("git --no-pager diff #{fetch(:previous_revision)} #{fetch(:current_revision)} app/assets vendor/assets").empty? | |
info "Skipping assets compilation" | |
else | |
invoke 'deploy:assets:precompile' | |
invoke 'deploy:assets:backup_manifest' | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment