Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
Last active December 20, 2015 22:39
Show Gist options
  • Save j-mcnally/6206935 to your computer and use it in GitHub Desktop.
Save j-mcnally/6206935 to your computer and use it in GitHub Desktop.
Compile assets locally when working in low-memory environments
namespace :assets do
desc "compile assets locally and upload before finalize_update"
task :deploy do
%x[RAILS_ENV=production bundle exec rake assets:clean && RAILS_ENV=production bundle exec rake assets:precompile]
run "sudo rm -rf #{release_path}/public/assets"
ENV['COMMAND'] = " mkdir '#{release_path}/public/assets'"
invoke
path = File.expand_path("../../public/assets", __FILE__)
puts path
upload path, "#{release_path}/public/assets", {:recursive => true}
%x[bundle exec rake assets:clean]
end
end
after "deploy:finalize_update", "assets:deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment