Hi there, I’m new here and new to dry-rb. I’m reading through the docs on dry-system and trying to follow the examples, but I’ve run into some confusion around requiring third-party code as a bootable dependency.
The example:
# system/boot/logger.rb
Application.boot(:logger) do
init do
require 'logger'
end
start do
register(:logger, Logger.new($stdout))
end
end
Copying this example, it doesn’t seem to matter whether I require "logger"
or not. The logger is registered and works either way. Maybe that’s just because logger is part of the ruby standard lib. However, when I try to do something similar with a gem from my Gemfile, like so:
App.boot(:curses) do
init do
require "curses"
end
start do
# ...
end
end
I get a require': cannot load such file -- curses (LoadError)
error. This happens with any gem from my Gemfile that I try to require, not just this one. If i require outside of the App.boot
block, there isn’t any problem. I have also tried ::Kernel.require
and get the same thing.
Am I misunderstanding what require
in the init
block is actually for?