mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 18:26:21 +00:00
feat: los deploys pueden pasar opciones de compilación
This commit is contained in:
parent
f019805314
commit
4ade0944de
3 changed files with 42 additions and 3 deletions
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
24
app/models/deploy_social_distributed_press.rb
Normal file
24
app/models/deploy_social_distributed_press.rb
Normal 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
|
Loading…
Reference in a new issue