5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 05:14:16 +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 f019805314
commit 4ade0944de
No known key found for this signature in database
3 changed files with 42 additions and 3 deletions

View file

@ -100,6 +100,11 @@ class Deploy < ApplicationRecord
@local_env ||= {}
end
# Devuelve opciones para jekyll build
#
# @return [String,nil]
def flags_for_build(**args); end
# Trae todas las dependencias
#
# @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
end
# TODO: Esto significa que todos los sitios van a tener activity pub
# activado
def jekyll_build(output: false)
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
@ -173,4 +173,14 @@ class DeployLocal < Deploy
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

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