5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 22:56:22 +00:00

feat: los deploys pueden pasar opciones de compilación

This commit is contained in:
f 2023-08-30 10:58:52 -03:00
parent 66d567733f
commit 8ed88a3183
3 changed files with 42 additions and 3 deletions

View file

@ -100,6 +100,11 @@ class Deploy < ApplicationRecord
@local_env ||= {} @local_env ||= {}
end end
# Devuelve opciones para jekyll build
#
# @return [String,nil]
def flags_for_build(**args); end
# Trae todas las dependencias # Trae todas las dependencias
# #
# @return [Array] # @return [Array]

View file

@ -141,11 +141,11 @@ class DeployLocal < Deploy
run %(bundle install --deployment --no-cache --path="#{gems_dir}" --clean --without test development), output: output run %(bundle install --deployment --no-cache --path="#{gems_dir}" --clean --without test development), output: output
end end
# TODO: Esto significa que todos los sitios van a tener activity pub
# activado
def jekyll_build(output: false) def jekyll_build(output: false)
with_tempfile(site.private_key_pem) do |file| with_tempfile(site.private_key_pem) do |file|
run %(bundle exec jekyll build --trace --profile --key #{file.path} --destination "#{escaped_destination}"), output: output flags = extra_flags(private_key: file)
run %(bundle exec jekyll build --trace --profile #{flags} --destination "#{escaped_destination}"), output: output
end end
end end
@ -173,4 +173,14 @@ class DeployLocal < Deploy
end end
end end
end end
# Genera opciones extra desde los otros deploys
#
# @param :args [Hash]
# @return [String]
def extra_flags(**args)
non_local_deploys.map do |deploy|
deploy.flags_for_build(**args)
end.compact.join(' ')
end
end end

View file

@ -0,0 +1,24 @@
# frozen_string_literal: true
require 'distributed_press/v1/social/client'
# Publicar novedades al Fediverso
class DeploySocialDistributedPress < Deploy
# Solo luego de publicar remotamente
DEPENDENCIES = %i[deploy_distributed_press deploy_rsync deploy_full_rsync]
# Envía las notificaciones
def deploy(output: false)
with_tempfile(site.private_key_pem) do |file|
run %(bundle exec jekyll notify --trace --key #{file.path} --destination "#{escaped_destination}"), output: output
end
end
# Genera la opción de llave privada para jekyll build
#
# @params :args [Hash]
# @return [String]
def flags_for_build(**args)
"--key #{Shellwords.escape args[:private_key].path}"
end
end