Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle restore of multiple asset manifests on rollback #226

Merged
merged 5 commits into from
May 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/capistrano/tasks/assets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ namespace :deploy do
task :restore_manifest do
on release_roles(fetch(:assets_roles)) do
within release_path do
target = detect_manifest_path
source = release_path.join('assets_manifest_backup', File.basename(target))
if test "[[ -f #{source} && -f #{target} ]]"
execute :cp, source, target
targets = detect_manifest_path.split(' ')
sources = targets.map do |target|
release_path.join('assets_manifest_backup', File.basename(target))
end
if test(:ls, sources) && test(:ls, targets)
source_map = targets.zip(sources).to_h
source_map.each do |(source, target)|
execute :cp, source, target
end
else
msg = 'Rails assets manifest file (or backup file) not found.'
warn msg
Expand Down