From 4767e0567bd0ded53f7363330cafa03542921662 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 11 Nov 2020 15:31:15 -0300 Subject: [PATCH] =?UTF-8?q?no=20crear=20archivos=20durante=20la=20migraci?= =?UTF-8?q?=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site/static_file_migration.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/site/static_file_migration.rb b/app/models/site/static_file_migration.rb index 6b72df5..00bdd8b 100644 --- a/app/models/site/static_file_migration.rb +++ b/app/models/site/static_file_migration.rb @@ -31,8 +31,6 @@ class Site # Ignoramos los documentos cuyo layout no contiene archivos next unless layouts.include? doc.layout.name - remove = true - # Buscamos todos los campos con archivos fields.each do |field| next unless doc.attribute? field @@ -47,12 +45,11 @@ class Site path = Pathname.new(metadata.value['path']) - # Si no existe, agregamos una imagen faltante para no - # romper el sitio en Sutty + # Si no existe vaciamos el campo unless path.exist? - log.write "#{path} no existe\n" - path = Pathname.new(Rails.root.join('app/assets/images/logo.png')) - remove = false + metadata.value['path'] = nil + log.write "el archivo #{path} de #{doc.path.relative} no existe" + next end # Agregamos el archivo al sitio y se lo asignamos al campo @@ -86,6 +83,8 @@ class Site log.close + return if modified.empty? + # TODO: Hacer la migración desde el servicio de creación de sitios? site.repository.commit(file: modified, message: I18n.t('sites.static_file_migration'),