Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. namespace :deploy do
  2. namespace :assets do
  3. Rake::Task['deploy:assets:precompile'].clear_actions
  4.  
  5. desc "Precompile assets on local machine and upload them to the server."
  6. task :precompile do
  7. run_locally do
  8. execute 'RAILS_ENV=production bundle exec rake assets:precompile'
  9. end
  10.  
  11. on roles(:web) do
  12. within release_path do
  13. asset_full_path = "#{release_path}/public/#{fetch(:assets_prefix)}"
  14. asset_parent_path = File.dirname(asset_full_path)
  15. execute "mkdir -p #{asset_full_path}"
  16. upload! "./public/#{fetch(:assets_prefix)}", asset_parent_path, recursive: true
  17. end
  18. end
  19.  
  20. run_locally do
  21. execute "rm -r ./public/#{fetch(:assets_prefix)}"
  22. end
  23. end
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement