5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-10-06 22:36:56 +00:00

Merge branch 'issue-1849' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
f 2022-12-30 10:57:18 -03:00
commit d88f88baa6
2 changed files with 11 additions and 15 deletions

View file

@ -54,10 +54,6 @@ class Site < ApplicationRecord
before_create :clone_skel!
# Elimina el directorio al destruir un sitio
before_destroy :remove_directories!
# Carga el sitio Jekyll una vez que se inicializa el modelo o después
# de crearlo
after_initialize :install_gems, :load_jekyll
after_create :install_gems, :load_jekyll
# Cambiar el nombre del directorio
before_update :update_name!
before_save :add_private_key_if_missing!
@ -357,13 +353,19 @@ class Site < ApplicationRecord
status == 'building'
end
def jekyll?
File.directory? path
end
def jekyll
run_in_path do
@jekyll ||=
@jekyll ||=
begin
install_gems
Jekyll::Site.new(configuration).tap do |site|
site.reader = JekyllData::Reader.new(site) if site.theme
end
end
end
end
# Cargar el sitio Jekyll
@ -456,7 +458,7 @@ class Site < ApplicationRecord
# Clona el esqueleto de Sutty para crear el sitio nuevo, no pasa nada
# si el sitio ya existe
def clone_skel!
return if File.directory? path
return if jekyll?
Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path
end

View file

@ -14,13 +14,7 @@
%table.table.table-condensed
%tbody
- @sites.each do |site|
-# Los sitios pueden fallar en cargar si los eliminamos físicamente del disco
- begin
- next unless site.jekyll
- rescue StandardError => e
- ExceptionNotifier.notify_exception(e, data: { site: site.name, usuarie: current_usuarie.id })
- next
- next unless site.jekyll?
- rol = current_usuarie.rol_for_site(site)
-#
TODO: Solo les usuaries cachean porque tenemos que separar