2020-02-19 22:29:06 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Soportar dominios alternativos
|
|
|
|
class DeployAlternativeDomain < Deploy
|
|
|
|
store :values, accessors: %i[hostname], coder: JSON
|
|
|
|
|
2023-03-18 16:42:47 +00:00
|
|
|
DEPENDENCIES = %i[deploy_local]
|
2023-03-17 21:38:47 +00:00
|
|
|
|
2020-02-19 22:29:06 +00:00
|
|
|
# Generar un link simbólico del sitio principal al alternativo
|
2022-03-16 21:19:04 +00:00
|
|
|
def deploy(**)
|
2020-02-19 22:29:06 +00:00
|
|
|
File.symlink?(destination) ||
|
|
|
|
File.symlink(site.hostname, destination).zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
# No hay límite para los dominios alternativos
|
|
|
|
def limit; end
|
|
|
|
|
|
|
|
def size
|
|
|
|
File.size destination
|
|
|
|
end
|
|
|
|
|
|
|
|
def destination
|
2023-03-18 18:50:05 +00:00
|
|
|
@destination ||= File.join(Rails.root, '_deploy', fqdn)
|
|
|
|
end
|
|
|
|
|
|
|
|
def fqdn
|
|
|
|
hostname.gsub(/\.\z/, '')
|
2022-04-06 23:07:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def url
|
|
|
|
"https://#{File.basename destination}"
|
2020-02-19 22:29:06 +00:00
|
|
|
end
|
|
|
|
end
|