5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 00:54:16 +00:00

no crear archivos durante la migración

This commit is contained in:
f 2020-11-11 15:31:15 -03:00
parent 97d330435d
commit 4767e0567b

View file

@ -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'),