5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-05-19 09:20:49 +00:00
panel/app/models/deploy_full_rsync.rb
f 3a99e1a867
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix: usar el hostname como url
2023-04-24 14:42:02 -03:00

31 lines
945 B
Ruby

# frozen_string_literal: true
class DeployFullRsync < DeployRsync
SOFT_DEPENDENCIES = %i[
deploy_alternative_domain
deploy_localized_domain
deploy_hidden_service
deploy_www
]
# 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)
result =
self.class.all_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
end