Skip to content

Instantly share code, notes, and snippets.

@benwalsh
Created July 30, 2018 11:45
Show Gist options
  • Save benwalsh/2e397a84f6dc1df0ca72a196ca9d1bd6 to your computer and use it in GitHub Desktop.
Save benwalsh/2e397a84f6dc1df0ca72a196ca9d1bd6 to your computer and use it in GitHub Desktop.
set :assets_roles, :assets
after :compile_assets, :copy_manifest
task :copy_manifest do
on roles(:assets) do
within(shared_path) do
set(:manifest_path, capture(:ls, '-t', 'public/assets/.sprockets-*.json', '|', 'head', '-n1'))
set(:manifest_filename, fetch(:manifest_path).split('/').last)
download!(fetch(:manifest_path), "tmp/#{fetch(:manifest_filename)}")
end
end
on roles(:all) do
within(shared_path) do
execute(:rm, '-f', 'public/assets/.sprockets-*.json')
upload!("tmp/#{fetch(:manifest_filename)}", fetch(:manifest_path))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment