2023-08-30 13:58:52 +00:00
|
|
|
# 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|
|
2023-08-30 14:09:08 +00:00
|
|
|
key = Shellwords.escape file.path
|
|
|
|
dest = Shellwords.escape destination
|
|
|
|
|
|
|
|
run %(bundle exec jekyll notify --trace --key #{key} --destination "#{dest}"), output: output
|
2023-08-30 13:58:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-08-30 14:09:08 +00:00
|
|
|
# Igual que DeployLocal
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
def destination
|
|
|
|
File.join(Rails.root, '_deploy', site.hostname)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Solo uno
|
|
|
|
#
|
|
|
|
# @return [Integer]
|
|
|
|
def limit
|
|
|
|
1
|
|
|
|
end
|
|
|
|
|
|
|
|
# Espacio ocupado, pero no podemos calcularlo
|
|
|
|
#
|
|
|
|
# @return [Integer]
|
|
|
|
def size
|
|
|
|
0
|
|
|
|
end
|
|
|
|
|
|
|
|
# El perfil de actor
|
|
|
|
#
|
|
|
|
# @return [String,nil]
|
|
|
|
def url
|
|
|
|
site.data.dig('activity_pub', 'actor')
|
|
|
|
end
|
|
|
|
|
2023-08-30 13:58:52 +00:00
|
|
|
# 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
|