From 0d6a2c020c0a7efa0f16c3af41d70cafc41f688a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 Jul 2022 13:49:59 -0300 Subject: [PATCH] reindexar los sitios al terminar de compilarlos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit para poder soportar modificaciones durante la generación del sitio --- app/models/deploy_reindex.rb | 19 +++++++++++++++++++ app/views/deploys/_deploy_reindex.haml | 1 + config/locales/en.yml | 4 ++++ config/locales/es.yml | 4 ++++ 4 files changed, 28 insertions(+) create mode 100644 app/models/deploy_reindex.rb create mode 100644 app/views/deploys/_deploy_reindex.haml diff --git a/app/models/deploy_reindex.rb b/app/models/deploy_reindex.rb new file mode 100644 index 00000000..d2ff0679 --- /dev/null +++ b/app/models/deploy_reindex.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# Reindexa los artículos al terminar la compilación +class DeployReindex < Deploy + def deploy + site.reset + site.indexed_posts.destroy_all + site.index_posts! + site.touch + end + + def limit + 1 + end + + def hostname + nil + end +end diff --git a/app/views/deploys/_deploy_reindex.haml b/app/views/deploys/_deploy_reindex.haml new file mode 100644 index 00000000..af058968 --- /dev/null +++ b/app/views/deploys/_deploy_reindex.haml @@ -0,0 +1 @@ +-# NADA diff --git a/config/locales/en.yml b/config/locales/en.yml index 530a9381..b08ddc95 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -102,6 +102,10 @@ en: title: Alternative domain name success: Success! error: Error + deploy_reindex: + title: Reindex + success: Success! + error: Error help: You can contact us by replying to this e-mail maintenance_mailer: notice: diff --git a/config/locales/es.yml b/config/locales/es.yml index eaa23137..026f2bc5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -102,6 +102,10 @@ es: title: Dominio alternativo success: ¡Éxito! error: Hubo un error + deploy_reindex: + title: Reindexación + success: ¡Éxito! + error: Hubo un error help: Por cualquier duda, responde este correo para contactarte con nosotres. maintenance_mailer: notice: