From 30398a8982a0c06d1da6161eb267392957cc9755 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 11 Apr 2022 14:17:27 -0300 Subject: [PATCH 01/27] incorporar assets en el repositorio usando lfs. esto nos permite hacer deploys con `git pull` --- .gitattributes | 2 ++ .gitignore | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0ede410e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +public/assets/** filter=lfs diff=lfs merge=lfs -text +public/packs/** filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 496b66cb..e6f2adbb 100644 --- a/.gitignore +++ b/.gitignore @@ -34,12 +34,7 @@ /config/master.key /config/credentials.yml.enc -/public/packs /public/packs-test -/public/assets -/public/assets-production -/public/packs -/public/packs-production /node_modules /yarn-error.log yarn-debug.log* @@ -49,8 +44,6 @@ yarn-debug.log* *.key *.crt -/public/packs -/public/packs-test /node_modules /yarn-error.log yarn-debug.log* From 1e0642c45b1b6293dbbe013ecffe11582f3abedc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 14 Apr 2022 18:28:32 -0300 Subject: [PATCH 02/27] unificar ota de js --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 584d07d1..454e42f4 100644 --- a/Makefile +++ b/Makefile @@ -110,12 +110,9 @@ save: ## Subir la imagen Docker al nodo delegado date +%F | xargs -I {} git tag -f $(container)-{} @echo -e "\a" -ota-js: assets ## Actualizar Javascript en el nodo delegado - rsync -avi --delete-after --chown 1000:82 public/ root@$(delegate):/srv/sutty/srv/http/data/_$(public)/ - ssh root@$(delegate) docker exec $(container) sh -c "cat /srv/http/tmp/puma.pid | xargs -r kill -USR2" - ota: ## Actualizar Rails en el nodo delegado ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true + 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 From 30ddcca4a8a960647691a85d7d2ec29ceea45b6d Mon Sep 17 00:00:00 2001 From: f Date: Thu, 14 Apr 2022 18:30:34 -0300 Subject: [PATCH 03/27] enviar cambios --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 454e42f4..da7102e9 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ save: ## Subir la imagen Docker al nodo delegado @echo -e "\a" ota: ## Actualizar Rails en el nodo delegado + git push ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true 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 From 80f135d49587b39a873f03bf158e9184d18e6fba Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 12:19:51 -0300 Subject: [PATCH 04/27] =?UTF-8?q?commitear=20autom=C3=A1ticamente=20los=20?= =?UTF-8?q?assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index da7102e9..4c68d72b 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ help: always ## Ayuda @grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" assets: public/packs/manifest.json.br ## Compilar los assets + git add public && git commit -m "assets [skip ci]" test: always ## Ejecutar los tests $(MAKE) rake args="test RAILS_ENV=test $(args)" @@ -112,7 +113,7 @@ save: ## Subir la imagen Docker al nodo delegado ota: ## Actualizar Rails en el nodo delegado git push - ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true + 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 From ef74013fa3e2ec34749c14d59ea749556cf38077 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 12:20:19 -0300 Subject: [PATCH 05/27] =?UTF-8?q?chequear=20que=20los=20assets=20est=C3=A9?= =?UTF-8?q?n=20actualizados=20al=20actualizar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c68d72b..70cc11d0 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,7 @@ save: ## Subir la imagen Docker al nodo delegado date +%F | xargs -I {} git tag -f $(container)-{} @echo -e "\a" -ota: ## Actualizar Rails en el nodo delegado +ota: assets ## 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 From 2589516b161ee7d25b5e80acbd73cad9e95a137c Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 12:55:51 -0300 Subject: [PATCH 06/27] =?UTF-8?q?fixup!=20commitear=20autom=C3=A1ticamente?= =?UTF-8?q?=20los=20assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 70cc11d0..fd264d89 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ help: always ## Ayuda @grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" assets: public/packs/manifest.json.br ## Compilar los assets - git add public && git commit -m "assets [skip ci]" + git add public/assets/ public/packs/ && git commit -m "assets [skip ci]" test: always ## Ejecutar los tests $(MAKE) rake args="test RAILS_ENV=test $(args)" From 2654a5c977c6c8ff5ffef53d5dfd8f76093e7291 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 16 Mar 2023 12:29:57 -0300 Subject: [PATCH 07/27] fix: los assets los compila la ci --- Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Makefile b/Makefile index fd264d89..5d6c066b 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,6 @@ help: always ## Ayuda @echo -e "\nArgumentos:\n" @grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/" -assets: public/packs/manifest.json.br ## Compilar los assets - git add public/assets/ public/packs/ && git commit -m "assets [skip ci]" - test: always ## Ejecutar los tests $(MAKE) rake args="test RAILS_ENV=test $(args)" @@ -111,19 +108,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") From 39e997d0ca8ad2d41f7c361f458c08f669c679dd Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 20:21:52 -0300 Subject: [PATCH 08/27] BREAKING CHANGE: deprecar sucker punch en favor de que --- Gemfile | 2 +- Gemfile.lock | 8 ++------ app/jobs/application_job.rb | 2 +- config/environments/production.rb | 2 +- config/initializers/sucker_punch.rb | 6 ------ db/migrate/20230328231029_create_que_tables.rb | 12 ++++++++++++ 6 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 config/initializers/sucker_punch.rb create mode 100644 db/migrate/20230328231029_create_que_tables.rb diff --git a/Gemfile b/Gemfile index f3799638..7ff904dd 100644 --- a/Gemfile +++ b/Gemfile @@ -68,7 +68,7 @@ gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' gem 'rugged' gem 'concurrent-ruby-ext' -gem 'sucker_punch' +gem 'que' gem 'symbol-fstring', require: 'fstring/all' gem 'terminal-table' gem 'validates_hostname' diff --git a/Gemfile.lock b/Gemfile.lock index abaf45c9..ac8f6870 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,9 +119,6 @@ GEM colorator (1.1.0) commonmarker (0.21.2-x86_64-linux-musl) ruby-enum (~> 0.5) - concurrent-ruby (1.1.9) - concurrent-ruby-ext (1.1.9-x86_64-linux-musl) - concurrent-ruby (= 1.1.9) crass (1.0.6) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) @@ -374,6 +371,7 @@ GEM pundit (2.1.1) activesupport (>= 3.0.0) racc (1.6.0-x86_64-linux-musl) + que (2.2.0) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) @@ -510,8 +508,6 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2-x86_64-linux-musl) stackprof (0.2.17-x86_64-linux-musl) - sucker_punch (3.0.1) - concurrent-ruby (~> 1.0) sutty-archives (2.5.4) jekyll (>= 3.6, < 5.0) sutty-liquid (0.7.4) @@ -619,6 +615,7 @@ DEPENDENCIES pry puma pundit + que rack-cors rack-mini-profiler rails (~> 6) @@ -638,7 +635,6 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) sqlite3 stackprof - sucker_punch sutty-liquid (>= 0.7.3) symbol-fstring terminal-table diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index f3673f0a..06690c53 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -2,7 +2,7 @@ # Base para trabajos class ApplicationJob < ActiveJob::Base - include SuckerPunch::Job + include Que::ActiveJob::JobExtensions private diff --git a/config/environments/production.rb b/config/environments/production.rb index d121bdbd..ed737146 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -66,7 +66,7 @@ Rails.application.configure do # Use a real queuing backend for Active Job (and separate queues per # environment) - config.active_job.queue_adapter = :sucker_punch + config.active_job.queue_adapter = :que config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.action_mailer.perform_caching = false diff --git a/config/initializers/sucker_punch.rb b/config/initializers/sucker_punch.rb deleted file mode 100644 index 865af32d..00000000 --- a/config/initializers/sucker_punch.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# Enviar una notificación cuando falla una tarea -SuckerPunch.exception_handler = lambda { |ex, _klass, _args| - ExceptionNotifier.notify_exception(ex) -} diff --git a/db/migrate/20230328231029_create_que_tables.rb b/db/migrate/20230328231029_create_que_tables.rb new file mode 100644 index 00000000..1ed929f7 --- /dev/null +++ b/db/migrate/20230328231029_create_que_tables.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Que +class CreateQueTables < ActiveRecord::Migration[6.1] + def up + Que.migrate! version: 7 + end + + def down + Que.migrate! version: 0 + end +end From cfc85e6356384e8e5f118badc677aa76fec217fa Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 21:15:55 -0300 Subject: [PATCH 09/27] feat: iniciar que en segundo plano --- Procfile | 1 + config/application.rb | 7 +++++++ config/environments/production.rb | 5 ----- monit.conf | 4 ++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Procfile b/Procfile index 45fe1df7..84842dff 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ cleanup: bundle exec rake cleanup:everything stats: bundle exec rake stats:process_all +que: daemonize -c /srv/ -p /srv/tmp/que.pid -u rails /usr/local/bin/syslogize bundle exec que diff --git a/config/application.rb b/config/application.rb index 97ab244c..86265b24 100644 --- a/config/application.rb +++ b/config/application.rb @@ -38,6 +38,13 @@ module Sutty config.active_storage.variant_processor = :vips + # Que + config.action_mailer.deliver_later_queue_name = :default + config.active_storage.queues.analysis = :default + config.active_storage.queues.purge = :default + config.active_job.queue_adapter = :que + config.active_job.queue_name_prefix = "sutty_#{Rails.env}" + config.to_prepare do # Load application's model / class decorators Dir.glob(File.join(File.dirname(__FILE__), '..', 'app', '**', '*_decorator.rb')).sort.each do |c| diff --git a/config/environments/production.rb b/config/environments/production.rb index ed737146..f13488b8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -64,11 +64,6 @@ Rails.application.configure do # Use a different cache store in production. config.cache_store = :redis_cache_store, { url: ENV['REDIS_SERVER'] } - # Use a real queuing backend for Active Job (and separate queues per - # environment) - config.active_job.queue_adapter = :que - config.active_job.queue_name_prefix = "sutty_#{Rails.env}" - config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. diff --git a/monit.conf b/monit.conf index 39f45d6d..4c7b345a 100644 --- a/monit.conf +++ b/monit.conf @@ -13,3 +13,7 @@ check program stats with path "/usr/bin/foreman run -f /srv/Procfile -d /srv stats" as uid "rails" gid "www-data" every "0 1 * * *" if status != 0 then alert + +check process que with pidfile /srv/tmp/que.pid + start program = "/usr/bin/foreman run -f /srv/Procfile -d /srv que" + stop program = "/bin/sh -c 'cat /srv/tmp/que.pid | xargs -r kill'" From d5db27ac95e296d2c9a9503756276cfef4b37a8d Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 12:34:57 -0300 Subject: [PATCH 10/27] fix: sin prefijo para las colas --- config/application.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 86265b24..e02ddc8b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -43,7 +43,6 @@ module Sutty config.active_storage.queues.analysis = :default config.active_storage.queues.purge = :default config.active_job.queue_adapter = :que - config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.to_prepare do # Load application's model / class decorators From fd56ee4c3ece7d4aa26b070b1494423c1f848388 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:35:00 -0300 Subject: [PATCH 11/27] fix: usar perform_later --- app/controllers/api/v1/contact_controller.rb | 2 +- app/jobs/maintenance_job.rb | 2 +- app/lib/exception_notifier/gitlab_notifier.rb | 2 +- app/models/log_entry.rb | 2 +- app/services/site_service.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v1/contact_controller.rb b/app/controllers/api/v1/contact_controller.rb index deacf4a7..d949dc30 100644 --- a/app/controllers/api/v1/contact_controller.rb +++ b/app/controllers/api/v1/contact_controller.rb @@ -18,7 +18,7 @@ module Api # Si todo salió bien, enviar los correos y redirigir al sitio. # El sitio nos dice a dónde tenemos que ir. - ContactJob.perform_async site.id, + ContactJob.perform_later site.id, params[:form], contact_params.to_h.symbolize_keys, params[:redirect] diff --git a/app/jobs/maintenance_job.rb b/app/jobs/maintenance_job.rb index 4c411d0e..c7a962f9 100644 --- a/app/jobs/maintenance_job.rb +++ b/app/jobs/maintenance_job.rb @@ -10,7 +10,7 @@ # bundle exec rails c # m = Maintenance.create message_en: 'reason', message_es: 'razón', # estimated_from: Time.now, estimated_to: Time.now + 1.hour -# MaintenanceJob.perform_async(maintenance_id: m.id) +# MaintenanceJob.perform_later(maintenance_id: m.id) # # Lo mismo para salir de mantenimiento, agregando el atributo # are_we_back: true al crear el Maintenance. diff --git a/app/lib/exception_notifier/gitlab_notifier.rb b/app/lib/exception_notifier/gitlab_notifier.rb index 18bfc6d4..b596bcf4 100644 --- a/app/lib/exception_notifier/gitlab_notifier.rb +++ b/app/lib/exception_notifier/gitlab_notifier.rb @@ -11,7 +11,7 @@ module ExceptionNotifier # @param [Exception] # @param [Hash] def call(exception, **options) - GitlabNotifierJob.perform_async(exception, **options) + GitlabNotifierJob.perform_later(exception, **options) end end end diff --git a/app/models/log_entry.rb b/app/models/log_entry.rb index 1824da55..9685e0d0 100644 --- a/app/models/log_entry.rb +++ b/app/models/log_entry.rb @@ -11,7 +11,7 @@ class LogEntry < ApplicationRecord def resend return if sent - ContactJob.perform_async site_id, params[:form], params + ContactJob.perform_later site_id, params[:form], params end def params diff --git a/app/services/site_service.rb b/app/services/site_service.rb index f5f415e7..3d971b89 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -5,7 +5,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def deploy site.enqueue! - DeployJob.perform_async site.id + DeployJob.perform_later site.id end # Crea un sitio, agrega un rol nuevo y guarda los cambios a la From fff499d1f823345f6dfd258730633124be0ab787 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:40:57 -0300 Subject: [PATCH 12/27] fix: correr todo en la misma cola --- app/jobs/backtrace_job.rb | 2 -- app/jobs/gitlab_notifier_job.rb | 2 -- 2 files changed, 4 deletions(-) diff --git a/app/jobs/backtrace_job.rb b/app/jobs/backtrace_job.rb index 86a9b2a6..97e6007b 100644 --- a/app/jobs/backtrace_job.rb +++ b/app/jobs/backtrace_job.rb @@ -6,8 +6,6 @@ class BacktraceJob < ApplicationJob EMPTY_SOURCEMAP = { 'mappings' => '' }.freeze - queue_as :low_priority - attr_reader :params, :site_id def perform(site_id:, params:) diff --git a/app/jobs/gitlab_notifier_job.rb b/app/jobs/gitlab_notifier_job.rb index 701c6789..cefe02ab 100644 --- a/app/jobs/gitlab_notifier_job.rb +++ b/app/jobs/gitlab_notifier_job.rb @@ -10,8 +10,6 @@ class GitlabNotifierJob < ApplicationJob # Variables que vamos a acceder luego attr_reader :exception, :options, :issue_data, :cached - queue_as :low_priority - # @param [Exception] la excepción lanzada # @param [Hash] opciones de ExceptionNotifier def perform(exception, **options) From 71afdc16ae8565323788f3e8e95e1d91f62bca36 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 29 Mar 2023 15:41:11 -0300 Subject: [PATCH 13/27] fix: aumentar la prioridad de las publicaciones --- app/jobs/deploy_job.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index e018533c..b3cb2b67 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -7,6 +7,9 @@ class DeployJob < ApplicationJob discard_on ActiveRecord::RecordNotFound + # Lanzar lo antes posible + self.priority = 10 + # rubocop:disable Metrics/MethodLength def perform(site, notify: true, time: Time.now, output: false) @output = output From d3166f2c5a27bf4d1602ac92273236ccc92019ab Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 13:07:25 -0300 Subject: [PATCH 14/27] feat: poder serializar las excepciones --- config/initializers/que.rb | 8 +++++++ .../serializers/exception_serializer.rb | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 config/initializers/que.rb create mode 100644 lib/active_job/serializers/exception_serializer.rb diff --git a/config/initializers/que.rb b/config/initializers/que.rb new file mode 100644 index 00000000..579f57d5 --- /dev/null +++ b/config/initializers/que.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +ActiveJob::Serializers.add_serializers ActiveJob::Serializers::ExceptionSerializer + +# Notificar los errores +Que.error_notifier = proc do |error, job| + ExceptionNotifier.notify_exception(error, data: job) +end diff --git a/lib/active_job/serializers/exception_serializer.rb b/lib/active_job/serializers/exception_serializer.rb new file mode 100644 index 00000000..42b55835 --- /dev/null +++ b/lib/active_job/serializers/exception_serializer.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'json/add/exception' + +module ActiveJob + module Serializers + class ExceptionSerializer < ObjectSerializer # :nodoc: + def serialize(ex) + super('value' => { 'class' => ex.class.name, 'exception' => ex.as_json }) + end + + def deserialize(hash) + hash.dig('value', 'class').constantize.json_create(hash.dig('value', 'exception')) + end + + private + def klass + Exception + end + end + end +end From 691b87b9116a623add90f4add0d0d03e7378ffa0 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 30 Mar 2023 13:11:37 -0300 Subject: [PATCH 15/27] fixup! feat: poder serializar las excepciones --- {lib => app/lib}/active_job/serializers/exception_serializer.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {lib => app/lib}/active_job/serializers/exception_serializer.rb (100%) diff --git a/lib/active_job/serializers/exception_serializer.rb b/app/lib/active_job/serializers/exception_serializer.rb similarity index 100% rename from lib/active_job/serializers/exception_serializer.rb rename to app/lib/active_job/serializers/exception_serializer.rb From f546cb902ad17f65a03ea0eae1f411c4f4ab6318 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 9 Jun 2023 12:13:43 -0300 Subject: [PATCH 16/27] fix: no crea los sitios #1278 --- db/seeds.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 214bbcb0..0ab8be61 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,12 +16,3 @@ 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'] - - site.update licencia: Licencia.first, design: Design.first, - title: site.name, description: 'x' * 50, - deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys - end -end From 3d7394655c9c97f86461889cf872d64c8719925f Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 9 Jun 2023 12:44:40 -0300 Subject: [PATCH 17/27] fix: agrego polizas & codigo de conducta #1278 --- db/seeds.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index 0ab8be61..b9ef96a1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,3 +16,14 @@ licencias.each do |l| licencia.update l end +if CodeOfConduct.count.zero? + YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc| + CodeOfConduct.new(**coc).save! + end +end + +if PrivacyPolicy.count.zero? + YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp| + PrivacyPolicy.new(**pp).save! + end +end From 6c6566422efc9a1de5cd46612b8cca62f8308d89 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 9 Jun 2023 13:11:02 -0300 Subject: [PATCH 18/27] fix: arreglar dependencias --- Gemfile | 11 +- Gemfile.lock | 537 +++++++++++++++++++++++++-------------------------- 2 files changed, 274 insertions(+), 274 deletions(-) diff --git a/Gemfile b/Gemfile index a3b78f05..9be8a763 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ ruby '~> 2.7' gem 'dotenv-rails', require: 'dotenv/rails-now' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6' +gem 'rails', '~> 6.1.0' # Use Puma as the app server gem 'puma' @@ -33,6 +33,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' @@ -51,8 +52,8 @@ gem 'image_processing' gem 'icalendar' gem 'inline_svg' gem 'httparty' -gem 'safe_yaml' -gem 'jekyll', '~> 4.2' +gem 'safe_yaml', require: false +gem 'jekyll', '~> 4.2.0' gem 'jekyll-data' gem 'jekyll-commonmark' gem 'jekyll-images' @@ -65,7 +66,7 @@ gem 'mobility' gem 'pundit' gem 'rails-i18n' gem 'rails_warden' -gem 'redis', require: %w[redis redis/connection/hiredis] +gem 'redis', '~> 4.0', require: %w[redis redis/connection/hiredis] gem 'redis-rails' gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' @@ -111,7 +112,7 @@ group :development, :test do gem 'pry' # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' - gem 'selenium-webdriver' + gem 'selenium-webdriver', '~> 4.8.0' gem 'sqlite3' end diff --git a/Gemfile.lock b/Gemfile.lock index 6b46eaa9..96889531 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,84 +27,86 @@ GIT GEM remote: https://gems.sutty.nl/ specs: - actioncable (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + actioncable (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionmailbox (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (>= 2.7.1) - actionmailer (6.1.4.1) - actionpack (= 6.1.4.1) - actionview (= 6.1.4.1) - activejob (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionmailer (6.1.7.3) + actionpack (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.4.1) - actionview (= 6.1.4.1) - activesupport (= 6.1.4.1) + actionpack (6.1.7.3) + actionview (= 6.1.7.3) + activesupport (= 6.1.7.3) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4.1) - actionpack (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + actiontext (6.1.7.3) + actionpack (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) nokogiri (>= 1.8.5) - actionview (6.1.4.1) - activesupport (= 6.1.4.1) + actionview (6.1.7.3) + activesupport (= 6.1.7.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4.1) - activesupport (= 6.1.4.1) + activejob (6.1.7.3) + activesupport (= 6.1.7.3) globalid (>= 0.3.6) - activemodel (6.1.4.1) - activesupport (= 6.1.4.1) - activerecord (6.1.4.1) - activemodel (= 6.1.4.1) - activesupport (= 6.1.4.1) - activestorage (6.1.4.1) - actionpack (= 6.1.4.1) - activejob (= 6.1.4.1) - activerecord (= 6.1.4.1) - activesupport (= 6.1.4.1) - marcel (~> 1.0.0) + activemodel (6.1.7.3) + activesupport (= 6.1.7.3) + activerecord (6.1.7.3) + activemodel (= 6.1.7.3) + activesupport (= 6.1.7.3) + activestorage (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activesupport (= 6.1.7.3) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4.1) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.3.3.0) + autoprefixer-rails (10.4.13.0) execjs (~> 2) - bcrypt (3.1.16-x86_64-linux-musl) + bcrypt (3.1.18-x86_64-linux-musl) + bcrypt_pbkdf (1.1.0) bcrypt_pbkdf (1.1.0-x86_64-linux-musl) - benchmark-ips (2.9.2) + benchmark-ips (2.12.0) + bindex (0.8.1) bindex (0.8.1-x86_64-linux-musl) - blazer (2.4.7) + blazer (2.6.5) activerecord (>= 5) chartkick (>= 3.2) railties (>= 5) safely_block (>= 0.1.1) - bootstrap (4.6.0) + bootstrap (4.6.2) autoprefixer-rails (>= 9.1.0) - popper_js (>= 1.14.3, < 2) + popper_js (>= 1.16.1, < 2) sassc-rails (>= 2.0.0) - brakeman (5.1.2) + brakeman (5.4.1) builder (3.2.4) capybara (2.18.0) addressable @@ -113,22 +115,26 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - chartkick (4.1.2) - childprocess (4.1.0) + chartkick (5.0.2) climate_control (1.2.0) coderay (1.1.3) colorator (1.1.0) - commonmarker (0.21.2-x86_64-linux-musl) - ruby-enum (~> 0.5) + commonmarker (0.23.9) + commonmarker (0.23.9-x86_64-linux-musl) + concurrent-ruby (1.2.2) + concurrent-ruby-ext (1.2.2-x86_64-linux-musl) + concurrent-ruby (= 1.2.2) crass (1.0.6) - database_cleaner (2.0.1) - database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.1) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - dead_end (3.1.0) - derailed_benchmarks (2.1.1) + date (3.3.3) + date (3.3.3-x86_64-linux-musl) + dead_end (4.0.0) + derailed_benchmarks (2.1.2) benchmark-ips (~> 2) dead_end get_process_mem (~> 0) @@ -140,29 +146,29 @@ GEM rake (> 10, < 14) ruby-statistics (>= 2.1) thor (>= 0.19, < 2) - devise (4.8.0) + devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.10.1) - devise (>= 4.8.0) - devise_invitable (2.0.5) + devise-i18n (1.11.0) + devise (>= 4.9.0) + devise_invitable (2.0.7) actionmailer (>= 5.0) devise (>= 4.6) - distributed-press-api-client (0.2.2) + distributed-press-api-client (0.2.4) addressable (~> 2.3, >= 2.3.0) climate_control dry-schema httparty (~> 0.18) json (~> 2.1, >= 2.1.0) jwt (~> 2.6.0) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) railties (>= 3.2) - down (5.2.4) + down (5.4.1) addressable (~> 2.8) dry-configurable (1.0.1) dry-core (~> 1.0, < 2) @@ -176,65 +182,75 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.0) + dry-schema (1.13.1) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-logic (>= 1.5, < 2) + dry-logic (>= 1.4, < 2) dry-types (>= 1.7, < 2) zeitwerk (~> 2.6) - dry-types (1.7.0) + dry-types (1.7.1) concurrent-ruby (~> 1.0) - dry-core (~> 1.0, < 2) - dry-inflector (~> 1.0, < 2) - dry-logic (>= 1.4, < 2) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) zeitwerk (~> 2.6) - ed25519 (1.2.4-x86_64-linux-musl) + ed25519 (1.3.0) + ed25519 (1.3.0-x86_64-linux-musl) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) - errbase (0.2.1) - erubi (1.10.0) + errbase (0.2.2) + erubi (1.12.0) + eventmachine (1.2.7) eventmachine (1.2.7-x86_64-linux-musl) - exception_notification (4.4.3) - actionmailer (>= 4.0, < 7) - activesupport (>= 4.0, < 7) + exception_notification (4.5.0) + actionmailer (>= 5.2, < 8) + activesupport (>= 5.2, < 8) execjs (2.8.1) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) 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.4-x86_64-linux-musl) + ffi (1.15.5) + ffi (1.15.5-x86_64-linux-musl) flamegraph (0.9.5) forwardable-extended (2.6.0) - friendly_id (5.4.2) + friendly_id (5.5.0) activerecord (>= 4.0.0) get_process_mem (0.2.7) ffi (~> 1.0) - globalid (0.6.0) + globalid (1.1.0) activesupport (>= 5.0) - groupdate (6.1.0) + groupdate (6.2.1) activesupport (>= 5.2) - hairtrigger (0.2.24) - activerecord (>= 5.0, < 7) + hairtrigger (1.0.0) + activerecord (>= 6.0, < 8) ruby2ruby (~> 2.4) ruby_parser (~> 3.10) - haml (5.2.2) - temple (>= 0.8.0) + haml (6.1.1-x86_64-linux-musl) + temple (>= 0.8.2) + thor tilt haml-lint (0.999.999) haml_lint - haml_lint (0.37.1) - haml (>= 4.0, < 5.3) + haml_lint (0.45.0) + haml (>= 4.0, < 6.2) parallel (~> 1.10) rainbow rubocop (>= 0.50.0) sysexits (~> 1.1) - hamlit (2.15.1-x86_64-linux-musl) + hamlit (3.0.3) + temple (>= 0.8.2) + thor + tilt + hamlit (3.0.3-x86_64-linux-musl) temple (>= 0.8.2) thor tilt @@ -245,25 +261,28 @@ 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) multi_xml (>= 0.5.2) - i18n (1.8.11) + i18n (1.13.0) concurrent-ruby (~> 1.0) - icalendar (2.7.1) + icalendar (2.8.0) ice_cube (~> 0.16) ice_cube (0.16.4) - image_processing (1.12.1) + image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - inline_svg (1.7.2) + inline_svg (1.9.0) activesupport (>= 3.0) nokogiri (>= 1.6) - jbuilder (2.11.3) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) - jekyll (4.2.1) + jekyll (4.2.2) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) @@ -278,246 +297,227 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 2.0) - jekyll-commonmark (1.3.2) - commonmarker (~> 0.14, < 0.22) - jekyll (>= 3.7, < 5.0) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) jekyll-data (1.1.2) jekyll (>= 3.3, < 5.0.0) - jekyll-dotenv (0.2.0) - dotenv (~> 2.7) - jekyll (~> 4) - jekyll-feed (0.15.1) - jekyll (>= 3.7, < 5.0) - jekyll-hardlinks (0.1.2) - jekyll (~> 4) - jekyll-ignore-layouts (0.1.2) - jekyll (~> 4) - jekyll-images (0.3.2) + jekyll-images (0.4.1) jekyll (~> 4) ruby-filemagic (~> 0.7) ruby-vips (~> 2) jekyll-include-cache (0.2.1) jekyll (>= 3.7, < 5.0) - jekyll-linked-posts (0.4.2) - jekyll (~> 4) - jekyll-locales (0.1.13) - jekyll-lunr (0.3.0) - loofah (~> 2.4) - jekyll-order (0.1.4) - jekyll-relative-urls (0.0.6) - jekyll (~> 4) - jekyll-sass-converter (2.1.0) + jekyll-sass-converter (2.2.0) sassc (> 2.0.1, < 3.0) - jekyll-seo-tag (2.7.1) - jekyll (>= 3.8, < 5.0) - jekyll-spree-client (0.1.19) - fast_blank (~> 1) - spree-api-client (>= 0.2.4) - jekyll-turbolinks (0.0.5) - jekyll (~> 4) - turbolinks-source (~> 5) - jekyll-unique-urls (0.1.1) - jekyll (~> 4) jekyll-watch (2.2.1) listen (~> 3.0) - jekyll-write-and-commit-changes (0.2.1) - jekyll (~> 4) - rugged (~> 1) + json (2.6.3-x86_64-linux-musl) jwt (2.6.0) - kaminari (1.2.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) - kramdown (2.3.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - launchy (2.5.0) - addressable (~> 2.7) - letter_opener (1.7.0) - launchy (~> 2.2) - liquid (4.0.3) + launchy (2.5.2) + addressable (~> 2.8) + letter_opener (1.8.1) + launchy (>= 2.2, < 3) + liquid (4.0.4) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loaf (0.10.0) railties (>= 3.2) - lockbox (0.6.6) - lograge (0.11.2) + lockbox (1.2.0) + lograge (0.12.0) actionpack (>= 4) activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.12.0) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) - memory_profiler (1.0.0) + memory_profiler (1.0.1) mercenary (0.4.0) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2021.1115) mini_histogram (0.3.1) - mini_magick (4.11.0) + mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.6.1) - minitest (5.14.4) - mobility (1.2.4) + minitest (5.18.0) + mobility (1.2.9) i18n (>= 0.6.10, < 2) request_store (~> 1.0) multi_xml (0.6.0) - net-ssh (6.1.0) - netaddr (2.0.5) - nio4r (2.5.8-x86_64-linux-musl) - nokogiri (1.12.5-x86_64-linux-musl) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + net-ssh (7.1.0) + netaddr (2.0.6) + nio4r (2.5.9-x86_64-linux-musl) njalla-api-client (0.2.0) dry-schema httparty (~> 0.18) + nokogiri (1.15.1-x86_64-linux) + racc (~> 1.4) orm_adapter (0.5.0) - pairing_heap (3.0.0) - parallel (1.21.0) - parser (3.0.2.0) + pairing_heap (3.0.1) + parallel (1.23.0) + parser (3.2.2.1) ast (~> 2.4.1) pathutil (0.16.2) forwardable-extended (~> 2.6) - pg (1.2.3-x86_64-linux-musl) - pg_search (2.3.5) + pg (1.5.3-x86_64-linux-musl) + pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) - popper_js (1.16.0) - prometheus_exporter (1.0.0) + popper_js (1.16.1) + prometheus_exporter (2.0.8) webrick - pry (0.14.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.6) - puma (5.5.2-x86_64-linux-musl) + public_suffix (5.0.1) + puma (6.2.2-x86_64-linux-musl) nio4r (~> 2.0) - pundit (2.1.1) + pundit (2.3.0) activesupport (>= 3.0.0) - racc (1.6.0-x86_64-linux-musl) - que (2.2.0) - rack (2.2.3) - rack-cors (1.1.1) + que (2.2.1) + racc (1.6.2) + racc (1.6.2-x86_64-linux-musl) + rack (2.2.7) + rack-cors (2.0.1) rack (>= 2.0.0) - rack-mini-profiler (2.3.3) + rack-mini-profiler (3.1.0) rack (>= 1.2.0) - rack-proxy (0.7.0) + rack-proxy (0.7.6) rack - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4.1) - actioncable (= 6.1.4.1) - actionmailbox (= 6.1.4.1) - actionmailer (= 6.1.4.1) - actionpack (= 6.1.4.1) - actiontext (= 6.1.4.1) - actionview (= 6.1.4.1) - activejob (= 6.1.4.1) - activemodel (= 6.1.4.1) - activerecord (= 6.1.4.1) - activestorage (= 6.1.4.1) - activesupport (= 6.1.4.1) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.3) + actioncable (= 6.1.7.3) + actionmailbox (= 6.1.7.3) + actionmailer (= 6.1.7.3) + actionpack (= 6.1.7.3) + actiontext (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activemodel (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) bundler (>= 1.15.0) - railties (= 6.1.4.1) + railties (= 6.1.7.3) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) - loofah (~> 2.3) - rails-i18n (6.0.0) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + rails-i18n (7.0.7) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) + railties (>= 6.0.0, < 8) rails_warden (0.6.0) warden (>= 1.2.0) - railties (6.1.4.1) - actionpack (= 6.1.4.1) - activesupport (= 6.1.4.1) + railties (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) - rb-fsevent (0.11.0) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - redis (4.5.1) - redis-actionpack (5.2.0) - actionpack (>= 5, < 7) + redis (4.8.1) + redis-actionpack (5.3.0) + actionpack (>= 5, < 8) redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.2.1) - activesupport (>= 3, < 7) + redis-activesupport (5.3.0) + activesupport (>= 3, < 8) redis-store (>= 1.3, < 2) - redis-rack (2.1.3) + redis-rack (2.1.4) rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.9.0) - redis (>= 4, < 5) - regexp_parser (2.1.1) - request_store (1.5.0) + redis-store (1.9.2) + redis (>= 4, < 6) + regexp_parser (2.8.0) + request_store (1.5.1) rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) - rgl (0.6.2) + rgl (0.6.3) pairing_heap (>= 0.3.0) rexml (~> 3.2, >= 3.2.4) stream (~> 0.5.3) - rouge (3.26.1) - rubocop (1.23.0) + rouge (3.30.0) + rubocop (1.42.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.13.0) - parser (>= 3.0.1.1) - rubocop-rails (2.12.4) + rubocop-ast (1.28.1) + parser (>= 3.2.1.0) + rubocop-rails (2.19.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - ruby-enum (0.9.0) - i18n - ruby-filemagic (0.7.2-x86_64-linux-musl) - ruby-progressbar (1.11.0) - ruby-statistics (3.0.0) + rubocop (>= 1.33.0, < 2.0) + ruby-filemagic (0.7.3) + ruby-filemagic (0.7.3-x86_64-linux-musl) + ruby-progressbar (1.13.0) + ruby-statistics (3.0.2) ruby-vips (2.1.4) ffi (~> 1.12) - ruby2ruby (2.4.4) + ruby2ruby (2.5.0) ruby_parser (~> 3.1) sexp_processor (~> 4.6) ruby_dep (1.5.0) - ruby_parser (3.18.1) + ruby_parser (3.20.1) sexp_processor (~> 4.16) rubyzip (2.3.2) - rugged (1.2.0-x86_64-linux-musl) + rugged (1.6.3) + rugged (1.6.3-x86_64-linux-musl) safe_yaml (1.0.6) safely_block (0.3.0) errbase (>= 0.1.1) + sassc (2.4.0) + ffi (~> 1.9) sassc (2.4.0-x86_64-linux-musl) ffi (~> 1.9) sassc-rails (2.1.2) @@ -526,56 +526,53 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.1.0) - childprocess (>= 0.5, < 5.0) + selenium-webdriver (4.8.6) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) semantic_range (3.0.0) - sexp_processor (4.16.0) + sexp_processor (4.17.0) simpleidn (0.2.1) unf (~> 0.1.4) sourcemap (0.1.1) - spree-api-client (0.2.4) - fast_blank (~> 1) - httparty (~> 0.18.0) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.0.2) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.1) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2-x86_64-linux-musl) - stackprof (0.2.17-x86_64-linux-musl) - sutty-archives (2.5.4) - jekyll (>= 3.6, < 5.0) - sutty-liquid (0.7.4) + sqlite3 (1.6.3-x86_64-linux) + stackprof (0.2.25-x86_64-linux-musl) + stream (0.5.5) + sutty-liquid (0.11.10) fast_blank (~> 1.0) jekyll (~> 4) symbol-fstring (1.0.2-x86_64-linux-musl) sysexits (1.2.0) - temple (0.8.2) + temple (0.10.1) terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) - thor (1.1.0) - tilt (2.0.10) - timecop (0.9.4) + thor (1.2.2) + tilt (2.1.0) + timecop (0.9.6) + timeout (0.3.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (2.0.4) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.8-x86_64-linux-musl) + unf_ext (0.0.8.2-x86_64-linux-musl) unicode-display_width (1.8.0) - validates_hostname (1.0.11) + validates_hostname (1.0.13) activerecord (>= 3.0) activesupport (>= 3.0) warden (1.2.9) @@ -585,18 +582,19 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (5.4.3) + webpacker (5.4.4) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) - webrick (1.7.0) + webrick (1.8.1) + websocket (1.2.9) websocket-driver (0.7.5-x86_64-linux-musl) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.5.1) + zeitwerk (2.6.8) PLATFORMS ruby @@ -625,7 +623,7 @@ DEPENDENCIES exception_notification factory_bot_rails fast_blank - fast_jsonparser + fast_jsonparser (~> 0.5.0) flamegraph friendly_id hairtrigger @@ -637,7 +635,7 @@ DEPENDENCIES image_processing inline_svg jbuilder (~> 2.5) - jekyll (~> 4.2) + jekyll (~> 4.2.0) jekyll-commonmark jekyll-data jekyll-images @@ -652,7 +650,7 @@ DEPENDENCIES mini_magick mobility net-ssh - njalla-api-client + njalla-api-client (~> 0.2.0) nokogiri pg pg_search @@ -663,10 +661,10 @@ DEPENDENCIES que rack-cors rack-mini-profiler - rails (~> 6) + rails (~> 6.1.0) rails-i18n rails_warden - redis + redis (~> 4.0) redis-rails rgl rollups! @@ -674,8 +672,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 (~> 2.0.0) @@ -696,4 +695,4 @@ RUBY VERSION ruby 2.7.1p83 BUNDLED WITH - 2.2.2 + 2.2.20 From 679a3fde85305c0c9fcf511e05b7d2bb18e63d88 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 9 Jun 2023 13:26:41 -0300 Subject: [PATCH 19/27] chore: force ci --- app/assets/stylesheets/application.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index eb953c30..65a207fa 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -525,3 +525,5 @@ $bezier: cubic-bezier(0.75, 0, 0.25, 1); } } } + +// force ci From 504f30997e5c94d2e9ab70a85fa72f264cd1cedd Mon Sep 17 00:00:00 2001 From: f Date: Sat, 10 Jun 2023 12:18:25 -0300 Subject: [PATCH 20/27] fix: no fallar si no hay sitio del panel --- app/controllers/env_controller.rb | 3 ++- app/views/env/index.js.haml | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/env_controller.rb b/app/controllers/env_controller.rb index 0f34e15f..de61c704 100644 --- a/app/controllers/env_controller.rb +++ b/app/controllers/env_controller.rb @@ -5,6 +5,7 @@ class EnvController < ActionController::Base def index @site = Site.find_by_name('panel') - stale? @site + + stale? @site if @site end end diff --git a/app/views/env/index.js.haml b/app/views/env/index.js.haml index f4bd69cf..597ba53f 100644 --- a/app/views/env/index.js.haml +++ b/app/views/env/index.js.haml @@ -1,7 +1,8 @@ -= cache @site do - :plain - window.env = { - AIRBRAKE_SITE_ID: #{@site.id}, - AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}", - PANEL_URL: "#{ENV['PANEL_URL']}" - } +- if @site + = cache @site do + :plain + window.env = { + AIRBRAKE_SITE_ID: #{@site.id}, + AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}", + PANEL_URL: "#{ENV['PANEL_URL']}" + } From 764fd70e065a56a2bf11ede657c83d4c803e1c87 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 12 Jun 2023 11:20:26 -0300 Subject: [PATCH 21/27] fix: add try catch to application.js so can notify js errors with the console #13578 --- app/javascript/packs/application.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 492ca736..9cbc30bf 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -2,11 +2,21 @@ import { Notifier } from '@airbrake/browser' -window.airbrake = new Notifier({ - projectId: window.env.AIRBRAKE_SITE_ID, - projectKey: window.env.AIRBRAKE_API_KEY, - host: window.env.PANEL_URL -}) +try { + window.airbrake = new Notifier({ + projectId: window.env.AIRBRAKE_PROJECT_ID, + projectKey: window.env.AIRBRAKE_PROJECT_KEY, + host: window.env.PANEL_URL + }); + + console.originalError = console.error; + console.error = (...e) => { + window.airbrake.notify(e.join(" ")); + return console.originalError(...e); + }; +} catch(e) { + console.error(e); +} import 'core-js/stable' import 'regenerator-runtime/runtime' From 83ebdea24bfa045e0072d1d9a7e62796c5d4f961 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 14 Jun 2023 13:33:47 -0300 Subject: [PATCH 22/27] fix: soporte para ruby 3.1 #9357 closes #13603 --- app/lib/exception_notifier/gitlab_notifier.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/exception_notifier/gitlab_notifier.rb b/app/lib/exception_notifier/gitlab_notifier.rb index 8152bb62..947e4e44 100644 --- a/app/lib/exception_notifier/gitlab_notifier.rb +++ b/app/lib/exception_notifier/gitlab_notifier.rb @@ -8,9 +8,9 @@ module ExceptionNotifier # Recibe la excepción y empieza la tarea de notificación en segundo # plano. # - # @param [Exception] - # @param [Hash] - def call(exception, **options) + # @param :exception [Exception] + # @param :options [Hash] + def call(exception, options, &block) case exception when BacktraceJob::BacktraceException GitlabNotifierJob.perform_later(exception, **options) From 4064d41855590ca76c7c4f86eb4150275cda68b5 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 14 Jun 2023 13:39:26 -0300 Subject: [PATCH 23/27] fix: duplicar el hash --- config/initializers/que.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/que.rb b/config/initializers/que.rb index d7abfeb5..eb898ae7 100644 --- a/config/initializers/que.rb +++ b/config/initializers/que.rb @@ -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 From 224bdeeccae05f3b988537e7a6a1ae89ad0b20a2 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:10:39 -0300 Subject: [PATCH 24/27] fix: no usar Dir.chdir --- app/models/site/repository.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 62e4c45e..d149b732 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -158,10 +158,8 @@ class Site cmd = 'git gc' r = nil - Dir.chdir(path) do - Open3.popen2e(env, cmd, unsetenv_others: true) do |_, _, t| - r = t.value - end + Open3.popen2e(env, cmd, unsetenv_others: true, chdir: path) do |_, _, t| + r = t.value end r&.success? From 6ff0a36b44342f18d724b04685fc96e87637ac06 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:23:54 -0300 Subject: [PATCH 25/27] BREAKING CHANGE: Site::Repository#commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit poder añadir y eliminar archivos en el mismo commit --- app/models/site/find_and_replace.rb | 2 +- app/models/site/repository.rb | 25 ++++++++++++------------- app/services/lfs_object_service.rb | 2 +- app/services/post_service.rb | 16 ++++++++-------- app/services/site_service.rb | 2 +- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/models/site/find_and_replace.rb b/app/models/site/find_and_replace.rb index 2670159d..5da673c2 100644 --- a/app/models/site/find_and_replace.rb +++ b/app/models/site/find_and_replace.rb @@ -37,7 +37,7 @@ class Site author = GitAuthor.new email: "sutty@#{Site.domain}", name: 'Sutty' - repository.commit(file: modified, + repository.commit(add: modified, message: I18n.t('sites.find_and_replace'), usuarie: author) end diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index d149b732..9c435fb5 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -114,14 +114,21 @@ class Site end # Guarda los cambios en git - def commit(file:, usuarie:, message:, remove: false) - file = [file] unless file.respond_to? :each - + # + # @param :add [Array] Archivos a agregar + # @param :rm [Array] Archivos a eliminar + # @param :usuarie [Usuarie] Quién hace el commit + # @param :message [String] Mensaje + def commit(add: [], rm: [], usuarie:, message:) # Cargar el árbol actual rugged.index.read_tree rugged.head.target.tree - file.each do |f| - remove ? rm(f) : add(f) + add.each do |file| + rugged.index.add(relativize(file)) + end + + rm.each do |file| + rugged.index.remove(relativize(file)) end # Escribir los cambios para que el repositorio se vea tal cual @@ -142,14 +149,6 @@ class Site { name: 'Sutty', email: "sutty@#{Site.domain}", time: Time.now } end - def add(file) - rugged.index.add(relativize(file)) - end - - def rm(file) - rugged.index.remove(relativize(file)) - end - # Garbage collection # # @return [Boolean] diff --git a/app/services/lfs_object_service.rb b/app/services/lfs_object_service.rb index bb62301d..c885936a 100644 --- a/app/services/lfs_object_service.rb +++ b/app/services/lfs_object_service.rb @@ -22,7 +22,7 @@ class LfsObjectService Site::Writer.new(site: site, file: path, content: pointer).save # Commitear el pointer - site.repository.commit(file: path, usuarie: author, message: File.basename(path)) + site.repository.commit(add: [path], usuarie: author, message: File.basename(path)) # Eliminar el pointer FileUtils.rm(path) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 7b31867d..aef7db80 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -16,7 +16,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do post.slug.value = p[:slug] if p[:slug].present? end - commit(action: :created, file: update_related_posts) if post.update(post_params) + commit(action: :created, add: update_related_posts) if post.update(post_params) update_site_license! @@ -34,7 +34,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Los artículos anónimos siempre son borradores params[:draft] = true - commit(action: :created) if post.update(anon_post_params) + commit(action: :created, add: [post.path.absolute]) if post.update(anon_post_params) post end @@ -44,7 +44,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # Es importante que el artículo se guarde primero y luego los # relacionados. - commit(action: :updated, file: update_related_posts) if post.update(post_params) + commit(action: :updated, add: update_related_posts) if post.update(post_params) update_site_license! @@ -56,7 +56,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do def destroy post.destroy! - commit(action: :destroyed) if post.destroyed? + commit(action: :destroyed, rm: [post.path.absolute]) if post.destroyed? post end @@ -85,15 +85,15 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # TODO: Implementar transacciones! posts.save_all(validate: false) && - commit(action: :reorder, file: files) + commit(action: :reorder, add: files) end private - def commit(action:, file: nil) - site.repository.commit(file: file || post.path.absolute, + def commit(action:, add: [], rm: []) + site.repository.commit(add: add, + rm: rm, usuarie: usuarie, - remove: action == :destroyed, message: I18n.t("post_service.#{action}", title: post&.title&.value)) end diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 2c29538c..b1df3d10 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -94,7 +94,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def commit_config(action:) site.repository .commit(usuarie: usuarie, - file: site.config.path, + add: [site.config.path], message: I18n.t("site_service.#{action}", name: site.name)) end From 63620b2d091a195cfec85015b10df5ee56090e1a Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:27:51 -0300 Subject: [PATCH 26/27] fix: commitear el cambio de nombre de archivo #2183 --- app/services/post_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index aef7db80..4b7ce4fa 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -42,9 +42,13 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do post.usuaries << usuarie params[:post][:draft] = true if site.invitade? usuarie + # Eliminar ("mover") el archivo si cambió de ubicación. + rm = [] + rm << post.path.value_was if post.path.changed? + # Es importante que el artículo se guarde primero y luego los # relacionados. - commit(action: :updated, add: update_related_posts) if post.update(post_params) + commit(action: :updated, add: update_related_posts, rm: rm) if post.update(post_params) update_site_license! From f05830c646faed40d16923923bd3867176a1c98b Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Jul 2023 13:38:29 -0300 Subject: [PATCH 27/27] fix: primero hay que modificar los datos --- app/services/post_service.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 4b7ce4fa..dda7992d 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -43,14 +43,16 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do params[:post][:draft] = true if site.invitade? usuarie # Eliminar ("mover") el archivo si cambió de ubicación. - rm = [] - rm << post.path.value_was if post.path.changed? + if post.update(post_params) + rm = [] + rm << post.path.value_was if post.path.changed? - # Es importante que el artículo se guarde primero y luego los - # relacionados. - commit(action: :updated, add: update_related_posts, rm: rm) if post.update(post_params) + # Es importante que el artículo se guarde primero y luego los + # relacionados. + commit(action: :updated, add: update_related_posts, rm: rm) - update_site_license! + update_site_license! + end # Devolver el post aunque no se haya salvado para poder rescatar los # errores