mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 17:36:22 +00:00
refactor: convertir deploy en un servicio
This commit is contained in:
parent
9681f15b70
commit
8b479d1743
2 changed files with 6 additions and 3 deletions
|
@ -68,9 +68,7 @@ class SitesController < ApplicationController
|
|||
def enqueue
|
||||
authorize site
|
||||
|
||||
# XXX: Convertir en una máquina de estados?
|
||||
site.enqueue!
|
||||
DeployJob.perform_async site.id
|
||||
SiteService.new(site: site).deploy
|
||||
|
||||
redirect_to site_posts_path(site, locale: site.default_locale)
|
||||
end
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
# Se encargar de guardar cambios en sitios
|
||||
# TODO: Implementar rollback en la configuración
|
||||
SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||
def deploy
|
||||
site.enqueue!
|
||||
DeployJob.perform_async site.id
|
||||
end
|
||||
|
||||
# Crea un sitio, agrega un rol nuevo y guarda los cambios a la
|
||||
# configuración en el repositorio git
|
||||
def create
|
||||
|
|
Loading…
Reference in a new issue