From 30aaefa474d61463d99b637f9a998263dc364830 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 9 Jan 2016 14:39:32 +0000 Subject: [PATCH] Avoid errors cleaning up assets for older rails trees --- cookbooks/web/templates/default/cleanup-assets.erb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cookbooks/web/templates/default/cleanup-assets.erb b/cookbooks/web/templates/default/cleanup-assets.erb index 132c8260a..175ce8b97 100644 --- a/cookbooks/web/templates/default/cleanup-assets.erb +++ b/cookbooks/web/templates/default/cleanup-assets.erb @@ -3,6 +3,7 @@ use strict; use warnings; +use Errno; use IO::Dir; use IO::File; use JSON::XS; @@ -13,17 +14,17 @@ my $manifest; if (my $file = IO::File->new("${root}/tmp/manifest.json", "r")) { - $manifest = decode_json(join("\n", $file->getlines)); + my $manifest = decode_json(join("\n", $file->getlines)); $file->close; + + expire_assets($manifest, "${root}/public/assets", ""); } else { - die "Can't open ${root}/tmp/manifest.json: $!"; + die "Can't open ${root}/tmp/manifest.json: $!" unless $!{ENOENT}; } -expire_assets($manifest, "${root}/public/assets", ""); - exit 0; sub expire_assets -- 2.39.5