Created
February 5, 2014 11:20
-
-
Save joonty/8821526 to your computer and use it in GitHub Desktop.
Capistrano local asset compilation
This file contains hidden or 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 :assets do | |
desc 'Run the precompile task locally and rsync with shared' | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
unless ENV['SKIP_ASSETS'] | |
if ENV['FORCE_ASSETS'] || releases.length <= 1 || capture("cd #{latest_release} && #{source.local.log(source.next_revision(current_revision))} vendor/assets/ app/assets/ | wc -l").to_i > 0 | |
system('bundle exec rake assets:precompile') | |
puts "syncing assets with shared directory..." | |
%x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}} | |
system('bundle exec rake assets:clean') | |
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