5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-04 00:05:45 +00:00

fix: sincronizar aunque algunos destinos todavía no existan

por ejemplo la dependencia en hidden service hace que no se sincronice
el sitio principal.
This commit is contained in:
f 2023-03-24 14:23:34 -03:00
parent c53391b21c
commit da192ef14c

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class DeployFullRsync < DeployRsync class DeployFullRsync < DeployRsync
DEPENDENCIES = %i[ SOFT_DEPENDENCIES = %i[
deploy_alternative_domain deploy_alternative_domain
deploy_hidden_service deploy_hidden_service
deploy_local deploy_local
@ -9,16 +9,24 @@ class DeployFullRsync < DeployRsync
deploy_zip deploy_zip
] ]
# Sincroniza las ubicaciones alternativas también # Sincroniza las ubicaciones alternativas también, ignorando las que
# todavía no se generaron. Solo falla si ningún sitio fue
# sincronizado o si alguna sincronización falló.
# #
# @param :output [Boolean] # @param :output [Boolean]
# @return [Boolean] # @return [Boolean]
def rsync(output: false) def rsync(output: false)
DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| result =
site.deploys.where(type: dependency).find_each.map do |deploy| SOFT_DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency|
run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output site.deploys.where(type: dependency).find_each.map do |deploy|
end next unless File.exist? deploy.destination
end.flatten.all?
run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output
rescue StandardError
end
end.flatten.compact
result.present? && result.all?
end end
def url def url