I want to make a gem that encapsulates a web app, similar to ‘sidekiq-web’ for example, than I can later mount inside a rack based app ilke rails.
Unfortunately I hit a roadblock when the container tries to resolve dependencies. Here is a an example container:
module Api
class Container < Dry::Web::Container
require root.join('system/notification/container')
import Notification::Container
configure do |config|
config.name = :api
config.default_namespace = 'api'
config.root = Pathname(__FILE__).join('../..').realpath.dirname.freeze
config.auto_register = %w(
lib
)
end
load_paths! 'lib', 'component'
end
end
The root
will actually point inside the projects that has the gem as dependency making it impossible for the autoload to work.
Any way I can get this working?