From cc839affb866b040e84e836a95be2294ab872934 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 29 Apr 2022 17:43:06 -0300 Subject: [PATCH] tener en cuenta todos los directorios posibles por ejemplo DeployLocalizedDomain en la otra rama tiene otras rutas --- app/jobs/uri_collection_job.rb | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/jobs/uri_collection_job.rb b/app/jobs/uri_collection_job.rb index bea388a7..8504f006 100644 --- a/app/jobs/uri_collection_job.rb +++ b/app/jobs/uri_collection_job.rb @@ -115,11 +115,17 @@ class UriCollectionJob < PeriodicJob STAT_NAME end + # Obtiene todas las ubicaciones de archivos + # # @return [String] # # TODO: Cambiar al mergear origin-referer - def destination - @destination ||= site.deploys.find_by(type: 'DeployLocal').destination + def destinations + @destinations ||= site.deploys.map(&:destination).select do |d| + File.directory?(d) + end.map do |d| + File.realpath(d) + end.uniq end # Recolecta todas las URIs menos imágenes @@ -127,14 +133,16 @@ class UriCollectionJob < PeriodicJob # @return [Array] def uris @uris ||= - locales.map do |locale| - uri = "/#{locale}/".squeeze('/') - dir = File.join(destination, locale) + destinations.map do |destination| + locales.map do |locale| + uri = "/#{locale}/".squeeze('/') + dir = File.join(destination, locale) - files(dir).map do |f| - uri + f + files(dir).map do |f| + uri + f + end end - end.flatten(2) + end.flatten(3) end # @return [Array]