mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 07:46:21 +00:00
Merge branch 'issue-1849' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
commit
d88f88baa6
2 changed files with 11 additions and 15 deletions
|
@ -54,10 +54,6 @@ class Site < ApplicationRecord
|
||||||
before_create :clone_skel!
|
before_create :clone_skel!
|
||||||
# Elimina el directorio al destruir un sitio
|
# Elimina el directorio al destruir un sitio
|
||||||
before_destroy :remove_directories!
|
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
|
# Cambiar el nombre del directorio
|
||||||
before_update :update_name!
|
before_update :update_name!
|
||||||
before_save :add_private_key_if_missing!
|
before_save :add_private_key_if_missing!
|
||||||
|
@ -357,9 +353,15 @@ class Site < ApplicationRecord
|
||||||
status == 'building'
|
status == 'building'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def jekyll?
|
||||||
|
File.directory? path
|
||||||
|
end
|
||||||
|
|
||||||
def jekyll
|
def jekyll
|
||||||
run_in_path do
|
|
||||||
@jekyll ||=
|
@jekyll ||=
|
||||||
|
begin
|
||||||
|
install_gems
|
||||||
|
|
||||||
Jekyll::Site.new(configuration).tap do |site|
|
Jekyll::Site.new(configuration).tap do |site|
|
||||||
site.reader = JekyllData::Reader.new(site) if site.theme
|
site.reader = JekyllData::Reader.new(site) if site.theme
|
||||||
end
|
end
|
||||||
|
@ -456,7 +458,7 @@ class Site < ApplicationRecord
|
||||||
# Clona el esqueleto de Sutty para crear el sitio nuevo, no pasa nada
|
# Clona el esqueleto de Sutty para crear el sitio nuevo, no pasa nada
|
||||||
# si el sitio ya existe
|
# si el sitio ya existe
|
||||||
def clone_skel!
|
def clone_skel!
|
||||||
return if File.directory? path
|
return if jekyll?
|
||||||
|
|
||||||
Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path
|
Rugged::Repository.clone_at ENV['SKEL_SUTTY'], path
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,13 +14,7 @@
|
||||||
%table.table.table-condensed
|
%table.table.table-condensed
|
||||||
%tbody
|
%tbody
|
||||||
- @sites.each do |site|
|
- @sites.each do |site|
|
||||||
-# Los sitios pueden fallar en cargar si los eliminamos físicamente del disco
|
- next unless site.jekyll?
|
||||||
- begin
|
|
||||||
- next unless site.jekyll
|
|
||||||
- rescue StandardError => e
|
|
||||||
- ExceptionNotifier.notify_exception(e, data: { site: site.name, usuarie: current_usuarie.id })
|
|
||||||
- next
|
|
||||||
|
|
||||||
- rol = current_usuarie.rol_for_site(site)
|
- rol = current_usuarie.rol_for_site(site)
|
||||||
-#
|
-#
|
||||||
TODO: Solo les usuaries cachean porque tenemos que separar
|
TODO: Solo les usuaries cachean porque tenemos que separar
|
||||||
|
|
Loading…
Reference in a new issue