Skip to content

Instantly share code, notes, and snippets.

@amaudy
Created January 20, 2015 09:52
Show Gist options
  • Save amaudy/e990e9818a90b4146158 to your computer and use it in GitHub Desktop.
Save amaudy/e990e9818a90b4146158 to your computer and use it in GitHub Desktop.
locally precompile assets
# namespace :deploy do
# task :default do
# update
# assets.precompile
# restart
# cleanup
# # etc
# end
# end
namespace :assets do
desc "Precompile assets locally and then rsync to app servers"
task :precompile, :only => { :primary => true } do
run_locally "bundle exec rake assets:precompile;"
servers = find_servers :roles => [:app], :except => { :no_release => true }
servers.each do |server|
run_locally "rsync -av ./public/assets/ #{user}@#{server}:#{current_path}/public/assets/;"
end
run_locally "rm -rf public/assets"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment