3rd party bootable component


I was going through the bootable component examples in dry-system gem and was wondering, when you register a component which deals with a 3rd party gem, who’s responsibility is it to reference the gem in the gemspec?

From the dry-system examples:

# my_gem
#  |- lib/my_gem/boot/exception_notifier.rb
Dry::System.register_component(:exception_notifier, provider: :common) do
  init do
    require "some_exception_notifier"

  start do
    register(:exception_notifier, SomeExceptionNotifier.new)

and used in an application

# system/app/container.rb
require "dry/system/container"
require "my_gem/components"

module App
  class Container < Dry::System::Container
    boot(:exception_notifier, from: :common)


Would you add the some_exception_notifier reference in my_gem gemspec or in the application gemspec, assuming those are distinct libraries?

Having the lib in the application gemspec is nice since it means your component “gem” can reference multiple versions of a gem type, for example, Sentry and Honeybadger for exception catchers. The application only uses one of those 2 at any given time so it only decide in the boot which one to use.

However you cannot correctly spec the bootable component within the gem as you don’t have either libraries referenced in the gem gemspec.


I add them to app’s Gemfile, but it’s really up to you where you prefer to have these deps specified.