Skip to content

Commit

Permalink
Load custom tasks and extensions after Zeitwerk is setup
Browse files Browse the repository at this point in the history
  • Loading branch information
eagletmt committed Mar 31, 2023
1 parent 1c7f02c commit a375653
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/kuroko2/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ class Engine < ::Rails::Engine

config.active_record.table_name_prefix = Kuroko2.config.table_name_prefix

if Kuroko2.config.custom_tasks
Kuroko2.config.custom_tasks.each do |key, klass|
unless Workflow::Node::TASK_REGISTRY.has_key?(key)
Workflow::Node.register(
key: key.to_sym,
klass: Workflow::Task.const_get(klass, false)
)
end
end
end

config.action_mailer.default_url_options = {
host: Kuroko2.config.url_host,
protocol: Kuroko2.config.url_scheme,
Expand All @@ -52,6 +41,19 @@ class Engine < ::Rails::Engine
Kuroko2.config.action_mailer.smtp_settings.to_h.symbolize_keys || {}

app.config.assets.precompile += %w(kuroko2/kuroko-logo-success.png kuroko2/kuroko-logo-error.png)
end

config.after_initialize do
if Kuroko2.config.custom_tasks
Kuroko2.config.custom_tasks.each do |key, klass|
unless Workflow::Node::TASK_REGISTRY.has_key?(key)
Workflow::Node.register(
key: key.to_sym,
klass: Workflow::Task.const_get(klass, false)
)
end
end
end

if Kuroko2.config.extensions && Kuroko2.config.extensions.controller
Kuroko2.config.extensions.controller.each do |extension|
Expand Down

0 comments on commit a375653

Please sign in to comment.