From cf708e1794679ced308d59c62d0f3453edb55973 Mon Sep 17 00:00:00 2001
From: Alexander Olofsson <alexander.olofsson@liu.se>
Date: Mon, 7 Oct 2024 15:27:11 +0200
Subject: [PATCH] Prepare for zeitwerk

---
 lib/foreman_notification_send/engine.rb | 60 +++++++++++++------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/lib/foreman_notification_send/engine.rb b/lib/foreman_notification_send/engine.rb
index 5c03ef1..a8ec09f 100644
--- a/lib/foreman_notification_send/engine.rb
+++ b/lib/foreman_notification_send/engine.rb
@@ -14,35 +14,37 @@ module ForemanNotificationSend
     end
 
     # rubocop:disable Metrics/BlockLength
-    initializer 'foreman_notification_send.register_plugin', before: :finisher_hook do |_app|
-      Foreman::Plugin.register :foreman_notification_send do
-        requires_foreman '>= 3.0'
-
-        settings do
-          category :notification_send, N_('Notification Send') do
-            setting 'notification_send_enable',
-                    type: :boolean,
-                    description: N_('Enable'),
-                    default: false,
-                    full_name: N_('Enable')
-
-            setting 'notification_send_target_url',
-                    type: :string,
-                    description: N_('Target URI'),
-                    default: 'https://matrix.org',
-                    full_name: N_('Target URI')
-
-            setting 'notification_send_target_room',
-                    type: :string,
-                    description: N_('Target Room'),
-                    default: '#test:matrix.org',
-                    full_name: N_('Target Room')
-
-            setting 'notification_send_token',
-                    type: :string,
-                    description: N_('Token'),
-                    default: 'syt_abcdefg',
-                    full_name: N_('Token')
+    initializer 'foreman_notification_send.register_plugin', before: :finisher_hook do |app|
+      app.reloader.to_prepare do
+        Foreman::Plugin.register :foreman_notification_send do
+          requires_foreman '>= 3.12'
+
+          settings do
+            category :notification_send, N_('Notification Send') do
+              setting 'notification_send_enable',
+                      type: :boolean,
+                      description: N_('Enable'),
+                      default: false,
+                      full_name: N_('Enable')
+
+              setting 'notification_send_target_url',
+                      type: :string,
+                      description: N_('Target URI'),
+                      default: 'https://matrix.org',
+                      full_name: N_('Target URI')
+
+              setting 'notification_send_target_room',
+                      type: :string,
+                      description: N_('Target Room'),
+                      default: '#test:matrix.org',
+                      full_name: N_('Target Room')
+
+              setting 'notification_send_token',
+                      type: :string,
+                      description: N_('Token'),
+                      default: 'syt_abcdefg',
+                      full_name: N_('Token')
+            end
           end
         end
       end
-- 
GitLab