-
-
Save emptyflask/cfb848fd4e5b5cb2cb10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# also you need to uncomment next line in Capfile | |
# require 'capistrano/rails/assets' | |
namespace :deploy do | |
namespace :assets do | |
Rake::Task['deploy:assets:precompile'].clear_actions | |
desc 'Precompile assets locally and upload to servers' | |
task :precompile do | |
run_locally do | |
with rails_env: fetch(:rails_env) do | |
execute 'bin/rake assets:precompile' | |
end | |
end | |
on roles(fetch(:assets_roles)) do | |
within release_path do | |
with rails_env: fetch(:rails_env) do | |
old_manifest_path = "#{shared_path}/public/assets/manifest*" | |
execute :rm, old_manifest_path if test "[ -f #{old_manifest_path} ]" | |
upload!('./public/assets/', "#{shared_path}/public/", recursive: true) | |
end | |
end | |
end | |
run_locally { execute 'rm -rf public/assets' } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment