Last active
November 19, 2024 18:57
-
-
Save rounders/a092fc0e693ffce1759a to your computer and use it in GitHub Desktop.
capistrano 3 compile assets locally then rsync
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 | |
namespace :assets do | |
desc "precompile and sync assets to app servers" | |
task :sync do | |
on roles(:app), in: :parallel do |role| | |
run_locally do | |
execute "rsync -avr -e ssh ./public/assets/ #{role.username}@#{role.hostname}:#{release_path}/public/assets" | |
end | |
end | |
end | |
desc "Precompile assets locally and then rsync to deploy server" | |
task :precompile do | |
on primary(:app) do | |
run_locally do | |
with rails_env: :production do | |
rake 'assets:precompile' | |
end | |
end | |
end | |
end | |
task :cleanup do | |
run_locally do | |
rake 'assets:clobber' | |
end | |
end | |
before "assets:sync", "assets:precompile" | |
after "assets:sync", "assets:cleanup" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
saved my day, thank you.