Skip to content

Instantly share code, notes, and snippets.

@nirvdrum
Created July 15, 2014 22:36
Show Gist options
  • Save nirvdrum/8d622172ddcd5b8c75ba to your computer and use it in GitHub Desktop.
Save nirvdrum/8d622172ddcd5b8c75ba to your computer and use it in GitHub Desktop.
namespace :deploy do
desc "precompile and deploy the assets to the server"
task :precompile_assets, :roles => :app do
if ENV['SKIP_ASSETS']
run "cp -a #{previous_release}/public/assets #{release_path}/public"
else
run_locally "#{rake} RAILS_ENV=#{rails_env} RAILS_GROUPS=assets assets:precompile"
run "mkdir -p #{release_path}/public/assets"
transfer(:up, "public/assets", "#{release_path}/public/assets", chunk_size: 16_384) { print "." }
run_locally "rm -rf public/assets" # clean up to avoid conflicts with development-mode assets
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment