2023-03-18 18:50:05 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class DeployFullRsync < DeployRsync
|
2023-03-24 17:23:34 +00:00
|
|
|
SOFT_DEPENDENCIES = %i[
|
2023-03-18 18:50:05 +00:00
|
|
|
deploy_alternative_domain
|
|
|
|
deploy_hidden_service
|
|
|
|
deploy_local
|
|
|
|
deploy_www
|
2023-03-18 22:33:25 +00:00
|
|
|
deploy_zip
|
2023-03-18 18:50:05 +00:00
|
|
|
]
|
|
|
|
|
2023-03-24 17:23:34 +00:00
|
|
|
# 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ó.
|
2023-03-18 18:50:05 +00:00
|
|
|
#
|
|
|
|
# @param :output [Boolean]
|
|
|
|
# @return [Boolean]
|
|
|
|
def rsync(output: false)
|
2023-03-24 17:23:34 +00:00
|
|
|
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?
|
2023-03-18 18:50:05 +00:00
|
|
|
end
|
2023-03-18 19:52:36 +00:00
|
|
|
|
|
|
|
def url
|
|
|
|
"https://#{user_host.last}/"
|
|
|
|
end
|
2023-03-18 18:50:05 +00:00
|
|
|
end
|