Skip to content

Instantly share code, notes, and snippets.

@melnikaite
Created July 9, 2014 17:32
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save melnikaite/3fa6850b4283865f1543 to your computer and use it in GitHub Desktop.
Save melnikaite/3fa6850b4283865f1543 to your computer and use it in GitHub Desktop.
# lib/capistrano/tasks/assets.rake
Rake::Task['deploy:assets:precompile'].clear
namespace :deploy do
namespace :assets do
desc 'Precompile assets locally and then rsync to remote servers'
task :precompile do
local_manifest_path = %x{ls public/assets/manifest*}.strip
%x{bundle exec rake assets:precompile assets:clean}
on roles(fetch(:assets_roles)) do |server|
%x{rsync -av ./public/assets/ #{server.user}@#{server.hostname}:#{release_path}/public/assets/}
%x{rsync -av ./#{local_manifest_path} #{server.user}@#{server.hostname}:#{release_path}/assets_manifest#{File.extname(local_manifest_path)}}
end
%x{bundle exec rake assets:clobber}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment