2019-10-01 19:41:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Vincula la versión del sitio con www a la versión sin
|
|
|
|
class DeployWww < Deploy
|
|
|
|
store :values, accessors: %i[], coder: JSON
|
|
|
|
|
2023-03-17 21:38:47 +00:00
|
|
|
DEPENDENCIES = %i[local]
|
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
before_destroy :remove_destination!
|
|
|
|
|
2022-03-16 21:19:04 +00:00
|
|
|
def deploy(**)
|
2019-10-01 19:41:33 +00:00
|
|
|
File.symlink?(destination) ||
|
|
|
|
File.symlink(site.hostname, destination).zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
def limit
|
|
|
|
1
|
|
|
|
end
|
|
|
|
|
|
|
|
def size
|
|
|
|
File.size destination
|
|
|
|
end
|
|
|
|
|
|
|
|
def destination
|
|
|
|
File.join(Rails.root, '_deploy', fqdn)
|
|
|
|
end
|
|
|
|
|
|
|
|
def fqdn
|
|
|
|
"www.#{site.hostname}"
|
|
|
|
end
|
|
|
|
|
2022-04-06 23:07:14 +00:00
|
|
|
def url
|
|
|
|
"https://www.#{site.hostname}/"
|
|
|
|
end
|
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def remove_destination!
|
2020-06-19 18:42:24 +00:00
|
|
|
FileUtils.rm_f destination
|
2019-10-01 19:41:33 +00:00
|
|
|
end
|
|
|
|
end
|