5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 17:26:22 +00:00

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

This commit is contained in:
f 2023-06-15 12:10:55 -03:00
commit 552b6675e0
9 changed files with 30 additions and 27 deletions

View file

@ -36,6 +36,7 @@ gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'safely_block', '~> 0.3.0'
gem 'blazer'
gem 'chartkick'
gem 'commonmarker'

View file

@ -209,7 +209,9 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
fast_blank (1.0.1)
fast_blank (1.0.1-x86_64-linux-musl)
fast_jsonparser (0.5.0)
fast_jsonparser (0.5.0-x86_64-linux-musl)
ffi (1.15.5-x86_64-linux-musl)
flamegraph (0.9.5)
@ -249,7 +251,9 @@ GEM
railties (>= 4.0.1)
heapy (0.2.0)
thor
hiredis (0.6.3)
hiredis (0.6.3-x86_64-linux-musl)
http_parser.rb (0.8.0)
http_parser.rb (0.8.0-x86_64-linux-musl)
httparty (0.21.0)
mini_mime (>= 1.0.0)
@ -653,8 +657,9 @@ DEPENDENCIES
rubyzip
rugged
safe_yaml
safely_block (~> 0.3.0)
sassc-rails
selenium-webdriver
selenium-webdriver (~> 4.8.0)
sourcemap
spring
spring-watcher-listen

View file

@ -111,19 +111,13 @@ save: ## Subir la imagen Docker al nodo delegado
date +%F | xargs -I {} git tag -f $(container)-{}
@echo -e "\a"
ota: assets ## Actualizar Rails en el nodo delegado
ota: ## Actualizar Rails en el nodo delegado
git push
ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull
ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune
ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl
ssh $(delegate) docker exec $(container) rails reload
# Todos los archivos de assets. Si alguno cambia, se van a recompilar
# los assets que luego se suben al nodo delegado.
assets := package.json yarn.lock $(shell find app/assets/ app/javascript/ -type f)
public/packs/manifest.json.br: $(assets)
$(hain) 'PANEL_URL=https://panel.sutty.nl RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile assets:clean'
# Correr un test en particular por ejemplo
# `make test/models/usuarie_test.rb`
tests := $(shell find test/ -name "*_test.rb")

View file

@ -5,6 +5,7 @@ class EnvController < ActionController::Base
def index
@site = Site.find_by_name('panel')
stale? @site
stale? @site if @site
end
end

View file

@ -8,8 +8,6 @@ class Site
extend ActiveSupport::Concern
included do
# TODO: Debería ser un Job?
after_create :index_posts!
has_many :indexed_posts, dependent: :destroy
def index_posts!

View file

@ -33,6 +33,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
add_licencias &&
add_code_of_conduct &&
add_privacy_policy &&
site.index_posts! &&
deploy
end

View file

@ -1,3 +1,4 @@
- if @site
= cache @site do
:plain
window.env = {

View file

@ -4,5 +4,5 @@ ActiveJob::Serializers.add_serializers ActiveJob::Serializers::ExceptionSerializ
# Notificar los errores
Que.error_notifier = proc do |error, job|
ExceptionNotifier.notify_exception(error, data: (job || {}))
ExceptionNotifier.notify_exception(error, data: (job.dup || {}))
end

View file

@ -16,12 +16,14 @@ licencias.each do |l|
licencia.update l
end
unless Rails.env.test?
YAML.safe_load(File.read('db/seeds/sites.yml')).each do |site|
site = Site.find_or_create_by name: site['name']
if CodeOfConduct.count.zero?
YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc|
CodeOfConduct.new(**coc).save!
end
end
site.update licencia: Licencia.first, design: Design.first,
title: site.name, description: 'x' * 50,
deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys
if PrivacyPolicy.count.zero?
YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp|
PrivacyPolicy.new(**pp).save!
end
end