Skip to content

Commit

Permalink
handle restore of multiple asset manifests on rollback (#226)
Browse files Browse the repository at this point in the history
* handle restore of multiple asset manifests on rollback

* cosmetic changes

* correctly copy sources to targets on asset rollback

* Update lib/capistrano/tasks/assets.rake

Co-authored-by: Matt Brictson <mattbrictson@users.noreply.github.com>

Co-authored-by: Matt Brictson <mattbrictson@users.noreply.github.com>
  • Loading branch information
lennart and mattbrictson authored May 11, 2020
1 parent dec4805 commit d86a8db
Showing 1 changed file with 9 additions and 4 deletions.
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 = sources.zip(targets)
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

0 comments on commit d86a8db

Please sign in to comment.