discourse-ai/lib/engine.rb
David Taylor e6bfec5bdb
DEV: Update engine config to match skeleton
- adds `lib/` autoloading (and removes the plugin.rb workaround)
- adds eager loading of scheduled jobs in development (otherwise they don't work at all)
2024-05-02 18:53:22 +01:00

14 lines
405 B
Ruby

# frozen_string_literal: true
module ::DiscourseAi
class Engine < ::Rails::Engine
engine_name PLUGIN_NAME
isolate_namespace DiscourseAi
config.autoload_paths << File.join(config.root, "lib")
scheduled_job_dir = "#{config.root}/app/jobs/scheduled"
config.to_prepare do
Rails.autoloaders.main.eager_load_dir(scheduled_job_dir) if Dir.exist?(scheduled_job_dir)
end
end
end