- host apipie matcher now globs the engine controllers, so /api/docs and /api/swagger keep documenting the catalog endpoints - rails g warp_engine:install: initializer template + a clean create_warp_engine_tables migration (signed bigint PKs) for new hosts; TTG never runs it - engine append_migrations initializer: future catalog migrations in the engine's db/migrate run via the host's rails db:migrate - README documents the updater contract, config surface, host expectations (admin JS picker, apipie matcher) and the soft-delete/resurrection behavior - make api-test runs both suites plus a production zeitwerk:check Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.3 KiB
Ruby
33 lines
1.3 KiB
Ruby
module WarpEngine
|
|
class Engine < ::Rails::Engine
|
|
isolate_namespace WarpEngine
|
|
|
|
# Az app/admin fájlok ActiveAdmin DSL-t tartalmaznak, nem definiálnak a
|
|
# fájlnévnek megfelelő konstansokat — a Zeitwerk (eager load) nem nyúlhat hozzájuk.
|
|
initializer "warp_engine.ignore_admin_dir", before: :setup_main_autoloader do
|
|
Rails.autoloaders.main.ignore(Engine.root.join("app/admin"))
|
|
end
|
|
|
|
# A jövőbeli katalógus-migrációk az engine db/migrate-jéből futnak a host
|
|
# rails db:migrate-jével, másolás nélkül.
|
|
initializer "warp_engine.append_migrations" do |app|
|
|
unless app.root.to_s.start_with?(root.to_s)
|
|
config.paths["db/migrate"].expanded.each do |path|
|
|
app.config.paths["db/migrate"] << path
|
|
end
|
|
end
|
|
end
|
|
|
|
# Az admin erőforrásokat a HOST ActiveAdmin példánya tölti be; az engine csak
|
|
# regisztrálja a saját app/admin könyvtárát. Auth/téma/route-ok a host dolga.
|
|
initializer "warp_engine.active_admin" do |app|
|
|
if defined?(ActiveAdmin)
|
|
admin_dir = Engine.root.join("app/admin").to_s
|
|
ActiveAdmin.application.load_paths << admin_dir
|
|
# dev módban az engine admin-fájljainak szerkesztése is triggerel reloadot
|
|
app.config.watchable_dirs[admin_dir] = [ :rb ]
|
|
end
|
|
end
|
|
end
|
|
end
|