Skip to content

Instantly share code, notes, and snippets.

@rounders
Created May 25, 2015 04: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 rounders/a092fc0e693ffce1759a to your computer and use it in GitHub Desktop.
Save rounders/a092fc0e693ffce1759a to your computer and use it in GitHub Desktop.
capistrano 3 compile assets locally then rsync
namespace :deploy
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
@nju520
Copy link

nju520 commented Jun 9, 2018

missing
namespace deploy do

@greatghoul
Copy link

saved my day, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment