-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
engine_cart generated app has something in ./lib/generators
which disturbs Rails 7.1 zeitwerk
#117
Comments
The immediate cause of this is that Rails 7.1 by default adds This then causes problems for zeitwerk, to have things in The zeitwerk README actually talks about the We have a somewhat different issue, because it's not inside gem source, but a generator at local app The simple solution I've found is to have the engine gem configuration tell the local app zeitwerk to ignore # eg in blacklight/lib/blacklight/engine.rb
config.before_configuration do
# see https://github.com/fxn/zeitwerk#for_gem
# Blacklight puts a generator into LOCAL APP lib/generators, so tell
# zeitwerk to ignore the whole directory? If we're using zeitwerk
if Rails.autoloaders&.main.respond_to?(:ignore)
Rails.autoloaders.main.ignore(Rails.root.join('lib/generators'))
end
end What I don't love about this solution
But I am unable to find a better solution at present, that does not require engine_cart changes, and want to get several gems on Rails 7.1 without waiting for engine_cart changes. Better solutions?Ideally engine_cart would somehow take care of this itself, without requiring additional custom code to be added to a gem using engine_cart.
Other ideas, or other understanding of what's going on? |
…ails 7.1 zeitwerk default config. cbeer/engine_cart#117
…ails 7.1 zeitwerk default config. cbeer/engine_cart#117
…ails 7.1 zeitwerk default config. cbeer/engine_cart#117
…ails 7.1 zeitwerk default config. cbeer/engine_cart#117
Engine cart seems to put something in
./lib/generators/test_app_generator.rb
in the generated app?I am not sure why the generated app needs to have a generator file placed in it, is this necessary and intentional?
When trying to use with Rails 7.1 -- which also by default autoloads ./lib for the first time, I think -- this winds up disturbing Rails 7.1 zeitwerk.
There are ways to tell zeitwerk to ignore this directory... but they are difficult to use in the engine_cart "remote control create an app on the fly as part of CI" use case.
What is the reason engine_cart is generating a generator into the generated app (phew!) in the first place, is it really necessary? If so... we need to figure out the best way to get zeitwerk to be okay with it.
The text was updated successfully, but these errors were encountered: