mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 04:56:22 +00:00
Merge branch 'informative-deploys' into panel.sutty.nl
This commit is contained in:
commit
4c3e56ac60
12 changed files with 52 additions and 10 deletions
|
@ -29,7 +29,13 @@ class DeployJob < ApplicationJob
|
|||
|
||||
@site.update status: 'building'
|
||||
# Asegurarse que DeployLocal sea el primero!
|
||||
@deployed = { deploy_local: deploy_locally }
|
||||
@deployed = {
|
||||
deploy_local: {
|
||||
status: deploy_locally,
|
||||
seconds: deploy_local.build_stats.last.seconds,
|
||||
url: site.url
|
||||
}
|
||||
}
|
||||
|
||||
# No es opcional
|
||||
unless @deployed[:deploy_local]
|
||||
|
@ -62,7 +68,11 @@ class DeployJob < ApplicationJob
|
|||
|
||||
def deploy_others
|
||||
@site.deploys.where.not(type: 'DeployLocal').find_each do |d|
|
||||
@deployed[d.type.underscore.to_sym] = d.deploy(output: @output)
|
||||
@deployed[d.type.underscore.to_sym] = {
|
||||
status: d.deploy(output: @output),
|
||||
seconds: d.build_stats.last.seconds,
|
||||
url: d.url
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,6 +15,10 @@ class Deploy < ApplicationRecord
|
|||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def url
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def limit
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
|
|
@ -18,6 +18,10 @@ class DeployAlternativeDomain < Deploy
|
|||
end
|
||||
|
||||
def destination
|
||||
File.join(Rails.root, '_deploy', hostname.gsub(/\.\z/, ''))
|
||||
@destination ||= File.join(Rails.root, '_deploy', hostname.gsub(/\.\z/, ''))
|
||||
end
|
||||
|
||||
def url
|
||||
"https://#{File.basename destination}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,6 +13,6 @@ class DeployHiddenService < DeployWww
|
|||
end
|
||||
|
||||
def url
|
||||
'http://' + fqdn
|
||||
"http://#{fqdn}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,6 +25,10 @@ class DeployLocal < Deploy
|
|||
1
|
||||
end
|
||||
|
||||
def url
|
||||
site.url
|
||||
end
|
||||
|
||||
# Obtener el tamaño de todos los archivos y directorios (los
|
||||
# directorios son archivos :)
|
||||
def size
|
||||
|
|
|
@ -16,6 +16,10 @@ class DeployPrivate < DeployLocal
|
|||
File.join(Rails.root, '_private', site.name)
|
||||
end
|
||||
|
||||
def url
|
||||
"#{ENV['PANEL_URL']}/sites/private/#{site.name}"
|
||||
end
|
||||
|
||||
# No usar recursos en compresión y habilitar los datos privados
|
||||
def env
|
||||
@env ||= super.merge({
|
||||
|
|
|
@ -27,6 +27,10 @@ class DeployWww < Deploy
|
|||
"www.#{site.hostname}"
|
||||
end
|
||||
|
||||
def url
|
||||
"https://www.#{site.hostname}/"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remove_destination!
|
||||
|
|
|
@ -49,6 +49,10 @@ class DeployZip < Deploy
|
|||
"#{site.hostname}.zip"
|
||||
end
|
||||
|
||||
def url
|
||||
"#{site.url}#{file}"
|
||||
end
|
||||
|
||||
def path
|
||||
File.join(destination, file)
|
||||
end
|
||||
|
|
|
@ -8,10 +8,15 @@
|
|||
%tr
|
||||
%th= t('.th.type')
|
||||
%th= t('.th.status')
|
||||
%th= t('.th.url')
|
||||
%th= t('.th.seconds')
|
||||
%tbody
|
||||
- @deploys.each do |deploy, value|
|
||||
- @deploys.each_pair do |deploy, value|
|
||||
%tr
|
||||
%td= t(".#{deploy}.title")
|
||||
%td= value ? t(".#{deploy}.success") : t(".#{deploy}.error")
|
||||
%td= value[:status] ? t(".#{deploy}.success") : t(".#{deploy}.error")
|
||||
%td= link_to value[:url], value[:url]
|
||||
%td
|
||||
%time{ datetime: "PT#{value[:seconds]}S" }= distance_of_time_in_words value[:seconds].seconds
|
||||
|
||||
= sanitize_markdown t('.help'), tags: %w[p a strong em]
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
= t('.explanation', fqdn: @deploy_local.site.hostname)
|
||||
\
|
||||
= Terminal::Table.new do |table|
|
||||
- table << [t('.th.type'), t('.th.status')]
|
||||
- table << [t('.th.type'), t('.th.status'), t('.th.url'), t('.th.seconds')]
|
||||
- table.add_separator
|
||||
- @deploys.each do |deploy, value|
|
||||
- table << [t(".#{deploy}.title"),
|
||||
value ? t(".#{deploy}.success") : t(".#{deploy}.error")]
|
||||
- @deploys.each_pair do |deploy, value|
|
||||
- table << [ t(".#{deploy}.title"), value[:status] ? t(".#{deploy}.success") : t(".#{deploy}.error"), value[:url], distance_of_time_in_words(value[:seconds].seconds) ]
|
||||
\
|
||||
= t('.help')
|
||||
|
|
|
@ -78,6 +78,8 @@ en:
|
|||
th:
|
||||
type: Type
|
||||
status: Status
|
||||
seconds: Duration
|
||||
url: Address
|
||||
deploy_local:
|
||||
title: Build the site
|
||||
success: Success!
|
||||
|
|
|
@ -78,6 +78,8 @@ es:
|
|||
th:
|
||||
type: Tipo
|
||||
status: Estado
|
||||
seconds: Duración
|
||||
url: Dirección
|
||||
deploy_local:
|
||||
title: Generar el sitio
|
||||
success: ¡Éxito!
|
||||
|
|
Loading…
Reference in a new issue