5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 16:06:23 +00:00

guardar el destino y otros valores previene los cambios de nombres

This commit is contained in:
f 2019-09-25 13:05:18 -03:00
parent e5a17c7f8a
commit e6b2793953
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
2 changed files with 15 additions and 19 deletions

View file

@ -3,9 +3,8 @@
# Alojamiento local, solo genera el sitio, con lo que no necesita hacer
# nada más
class DeployLocal < Deploy
store :values, accessors: %i[destination], coder: JSON
store :values, accessors: %i[], coder: JSON
before_create :destination!
before_destroy :remove_destination!
# Realizamos la construcción del sitio usando Jekyll y un entorno
@ -32,6 +31,10 @@ class DeployLocal < Deploy
end.inject(:+)
end
def destination
File.join(Rails.root, '_deploy', site.hostname)
end
private
def mkdir
@ -69,13 +72,11 @@ class DeployLocal < Deploy
run %(bundle install --no-cache --path="#{gems_dir}")
end
# rubocop:disable Metrics/LineLength
def jekyll_build
run "bundle exec jekyll build --destination \"#{escaped_destination}\""
end
def destination!
self.destination ||= File.join(Rails.root, '_deploy', site.hostname)
run "bundle exec jekyll build --trace --destination \"#{escaped_destination}\""
end
# rubocop:enable Metrics/LineLength
# no debería haber espacios ni caracteres especiales, pero por si
# acaso...

View file

@ -6,10 +6,7 @@ require 'zip'
#
# TODO: Firmar con minisign
class DeployZip < Deploy
store :values, accessors: %i[destination file path], coder: JSON
before_create :destination!
before_create :file!, :path!
store :values, accessors: %i[], coder: JSON
# Una vez que el sitio está generado, tomar todos los archivos y
# y generar un zip accesible públicamente.
@ -44,17 +41,15 @@ class DeployZip < Deploy
File.size path
end
private
def destination!
self.destination ||= File.join(Rails.root, '_deploy', site.hostname)
def destination
File.join(Rails.root, '_deploy', site.hostname)
end
def file!
self.file ||= "#{site.hostname}.zip"
def file
"#{site.hostname}.zip"
end
def path!
self.path = File.join(destination, file)
def path
File.join(destination, file)
end
end