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]