Skip to content

Commit

Permalink
configure zeitwerk to be okay with our generators in local generated …
Browse files Browse the repository at this point in the history
…app ./lib/generators

Not sure why we are generating a generator INTO the local test app. But rather than figure this out and change it, we want to make zeitwerk okay with it.

We are telling zeitwerk to ignore the WHOLE RAILS_ROOT/lib/generators directory, just to deal with the one test_app_generator.rb file we are putting there. But hopefully that is okay.
  • Loading branch information
jrochkind committed Nov 7, 2023
1 parent a97dcc5 commit 3dd752b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/blacklight/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ module Blacklight
class Engine < Rails::Engine
engine_name "blacklight"

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

config.after_initialize do
Blacklight::Configuration.initialize_default_configuration
end
Expand Down

0 comments on commit 3dd752b

Please sign in to comment.