From 7bb5dfc144b332ff2863659f6b297409e3a82683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Thu, 29 Feb 2024 18:20:09 +0100 Subject: [PATCH] DEV: Fix new Rubocop offenses (#124) --- Gemfile.lock | 40 ++++++++++++++++--- .../discourse_cakeday/cakeday_controller.rb | 2 + plugin.rb | 14 +++---- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 23ad67d..1e1370c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,35 +1,60 @@ GEM remote: https://rubygems.org/ specs: + activesupport (7.1.3.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.6) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) + drb (2.2.0) + ruby2_keywords + i18n (1.14.1) + concurrent-ruby (~> 1.0) json (2.7.1) language_server-protocol (3.17.0.3) + minitest (5.22.2) + mutex_m (0.2.0) parallel (1.24.0) - parser (3.3.0.3) + parser (3.3.0.5) ast (~> 2.4.1) racc prettier_print (1.2.1) + prism (0.24.0) racc (1.7.3) rainbow (3.1.1) regexp_parser (2.9.0) rexml (3.2.6) - rubocop (1.59.0) + rubocop (1.61.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + rubocop-ast (1.31.0) + parser (>= 3.3.0.4) + prism (>= 0.24.0) rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-discourse (3.6.0) + rubocop-discourse (3.7.1) + activesupport (>= 6.1) rubocop (>= 1.59.0) + rubocop-capybara (>= 2.0.0) + rubocop-factory_bot (>= 2.0.0) rubocop-rspec (>= 2.25.0) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) @@ -38,8 +63,11 @@ GEM rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) syntax_tree (6.2.0) prettier_print (>= 1.2.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) PLATFORMS diff --git a/app/controllers/discourse_cakeday/cakeday_controller.rb b/app/controllers/discourse_cakeday/cakeday_controller.rb index 05a7c52..496d764 100644 --- a/app/controllers/discourse_cakeday/cakeday_controller.rb +++ b/app/controllers/discourse_cakeday/cakeday_controller.rb @@ -2,6 +2,8 @@ module DiscourseCakeday class CakedayController < ::ApplicationController + requires_plugin PLUGIN_NAME + before_action :ensure_logged_in before_action :setup_params diff --git a/plugin.rb b/plugin.rb index b82eb19..708e523 100644 --- a/plugin.rb +++ b/plugin.rb @@ -32,14 +32,12 @@ class Engine < ::Rails::Engine Discourse::Application.routes.append { mount ::DiscourseCakeday::Engine, at: "/cakeday" } - %w[ - ../app/jobs/onceoff/fix_invalid_date_of_birth.rb - ../app/jobs/onceoff/migrate_date_of_birth_to_users_table.rb - ../app/serializers/discourse_cakeday/cakeday_user_serializer.rb - ../app/controllers/discourse_cakeday/cakeday_controller.rb - ../app/controllers/discourse_cakeday/anniversaries_controller.rb - ../app/controllers/discourse_cakeday/birthdays_controller.rb - ].each { |path| load File.expand_path(path, __FILE__) } + require_relative "app/jobs/onceoff/fix_invalid_date_of_birth" + require_relative "app/jobs/onceoff/migrate_date_of_birth_to_users_table" + require_relative "app/serializers/discourse_cakeday/cakeday_user_serializer" + require_relative "app/controllers/discourse_cakeday/cakeday_controller" + require_relative "app/controllers/discourse_cakeday/anniversaries_controller" + require_relative "app/controllers/discourse_cakeday/birthdays_controller" # overwrite the user and user_card serializers to show # the cakes on the user card and on the user profile pages