Ignore gems
mmarvb8h opened this issue · 1 comments
Writing a rack web application. Using 3rd pary framework gem in the following manner.
class App < Roda
end
I use zeitwerk the below in configuration of app.
loader = Zeitwerk::Loader.new
loader.push_dir("#{app_root_path}/app/routing")
loader.enable_reloading # you need to opt-in before setup
loader.setup
in rackup.ru i just have statement: run App
All seems ok.
At one time received an exception in rack and notice zeitwerk requrire was involved in call stack.
I have since fixed the exception in rack.
But my concern is in the fact that "zeitwerk require" was in the call stack.
Is there a way to exclude 3rd party gems? I use .rbenv and gems are stored in file paths used by rbenv. Is there way to easily exclude files (rack.rb)? Giving a full pathname (inclusive of version# as used by rbenv is not feasible).
thx.
~Marvin Foster
email: marvinfoster@finsync.com or mmarvb7@gmail.com
thx
Hi Marvin.
Zeitwerk decorates Kernel#require
(here). This decoration cannot be undone because there is only one Kernel
module. Also, if Zeitwerk is loaded, it means someone is using it and that decoration has to be in place. There are other gems that decorate Kernel#require
like RubyGems (here), or Bootsnap (here).
However, as you'll see in the source code, this decoration has no effect if the path is not managed by a loader. The presence of a library file in the stack trace just means that Zeitwerk got loaded by someone. In this case your application, but it could also had been a gem dependency that loads itself with Zeitwerk too.
You can just ignore those traces, for 3rd party code they are transparent. Nothing to be worried about.