The engine ships an ActiveJob based job (PipelineSyncJob), but a host's application.rb does not necessarily require active_job/railtie - apps/api does not. With eager loading off (development, test) nothing noticed; in production WarpEngine::ApplicationJob blew up with "uninitialized constant WarpEngine::ActiveJob", which is exactly what `rails zeitwerk:check` in RAILS_ENV=production reported. An engine that ships jobs has to pull in the framework it needs, so lib/warp_engine.rb requires the railtie. Pre-existing on 0.1.0 as well; found while verifying that the 0.2.0 changes do not break the portal. All three api-test steps are green now. apps/api Gemfile.lock follows the 0.1.0 -> 0.2.0 path gem bump.
48 lines
1.3 KiB
Ruby
48 lines
1.3 KiB
Ruby
# Az engine ActiveJob-ra épülő jobot szállít (PipelineSyncJob), ezért a
|
|
# framework betöltése a mi dolgunk: a host application.rb-je nem feltétlenül
|
|
# require-öli az active_job/railtie-t, és eager loadnál (production) a
|
|
# WarpEngine::ApplicationJob különben uninitialized constant-tal elszáll.
|
|
require "active_job/railtie"
|
|
|
|
require "blueprinter"
|
|
require "apipie-rails"
|
|
|
|
require "warp_engine/version"
|
|
require "warp_engine/configuration"
|
|
require "warp_engine/storage"
|
|
|
|
module WarpEngine
|
|
# A tábláink prefix nélküliek (softwares, releases, ...) — az isolate_namespace
|
|
# által generált "warp_engine_" prefixet üresre cseréljük. Az engine.rb require-je
|
|
# előtt kell definiálva lennie.
|
|
def self.table_name_prefix
|
|
""
|
|
end
|
|
|
|
def self.config
|
|
@config ||= Configuration.new
|
|
end
|
|
|
|
def self.configure
|
|
yield(config)
|
|
end
|
|
|
|
def self.woodpecker_configured?
|
|
config.woodpecker_url.present? && config.woodpecker_api_token.present?
|
|
end
|
|
|
|
# A host innen tudja, hogy a publikálás ActiveSupport::Notifications-t szór
|
|
# ("warp_engine.publish"), és nem kell modell-callbackre kapaszkodnia.
|
|
# Régebbi engine-verziókon a metódus nem létezik, ezért a hívó oldalon
|
|
# respond_to?-val kérdezendő.
|
|
def self.instruments_publish?
|
|
true
|
|
end
|
|
|
|
def self.storage
|
|
Storage.adapter
|
|
end
|
|
end
|
|
|
|
require "warp_engine/engine"
|