Skip to content

Instantly share code, notes, and snippets.

@yachi
Created September 28, 2012 04:38
Show Gist options
  • Save yachi/3797942 to your computer and use it in GitHub Desktop.
Save yachi/3797942 to your computer and use it in GitHub Desktop.
precompile rails 3 assets locally
namespace :deploy do
namespace :assets do
desc 'Run the precompile task locally and rsync with shared'
task :precompile, :roles => :web, :except => { :no_release => true } do
run_locally("bundle exec rake assets:precompile")
servers = find_servers_for_task(current_task)
port_option = port ? " -e 'ssh -p #{port}' " : ''
servers.each do |server|
run_locally("rsync --recursive --times --rsh=ssh --compress --human-readable #{port_option} --progress public/assets #{user}@#{server}:#{shared_path}")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment