5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-01 22:46:07 +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
class DeployFullRsync < DeployRsync
DEPENDENCIES = %i[
SOFT_DEPENDENCIES = %i[
deploy_alternative_domain
deploy_hidden_service
deploy_local
@ -9,16 +9,24 @@ class DeployFullRsync < DeployRsync
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]
# @return [Boolean]
def rsync(output: false)
DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency|
site.deploys.where(type: dependency).find_each.map do |deploy|
run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output
end
end.flatten.all?
result =
SOFT_DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency|
site.deploys.where(type: dependency).find_each.map do |deploy|
next unless File.exist? deploy.destination
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
def url