-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add zeitwerk loader and teach it about this gem #551
Conversation
lib/manageiq-gems-pending.rb
Outdated
loader.setup | ||
|
||
# TODO: consider turning on eager_load and only disable really slow/fat requires | ||
# loader.eager_load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I enabled locally to get everything to fail so I could then fix or ignore.
manageiq-gems-pending.gemspec
Outdated
s.add_runtime_dependency "winrm", "~> 2.1" | ||
s.add_runtime_dependency "winrm-elevated", "~> 1.0.1" | ||
s.add_runtime_dependency "zeitwerk" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want to lock this down to a minor version
ce8f964
to
dd9cbc0
Compare
See: ManageIQ/manageiq#22279 I noticed this while looking to add zeitwerk in gems pending, see: ManageIQ/manageiq-gems-pending#551 I used the following to find these: git grep -iE "win_rm|winrm|scvmm|hyperv"
See: ManageIQ/manageiq#22279 Related: ManageIQ/manageiq#22413 ManageIQ/manageiq-smartstate#172 Found while looking at: ManageIQ#551
c06c761
to
0aebbc0
Compare
@@ -41,7 +41,7 @@ def self.xml_document(xmlClass) | |||
when :xmlhash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tangent: do we have enough coverage to know if we can drop :xmlhash
or :rexml
?
aah, default is :rexml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had assumed we only used this in a few rare places, but besides smart state (and specs), looks like we use it in kubernetes, vmware, ui classic (only in 1-2 files each) along with a dozen core models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question... I haven't looked recently but in the past we had no coverage of this area so it's hard to know if you can just drop it.
We used to require |
lib = File.expand_path("#{__dir__}../../../../") | ||
loader.push_dir("#{lib}/gems/pending/util") | ||
|
||
# This tells the loader to not expect Mount or ObjectStorage namspaces... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦅 👁️
# This tells the loader to not expect Mount or ObjectStorage namspaces... | |
# This tells the loader to not expect Mount or ObjectStorage namespaces... |
# These files skip zeitwerk and must be required manually | ||
##### TODO: check for requires outside of this gem to these files and util/ in requires | ||
loader.ignore("#{lib}/gems/pending/util/miq-extensions.rb") # loader file, no class | ||
loader.ignore("#{lib}/gems/pending/util/require_with_logging.rb") # file has no class ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this out into a diagnostics thing or maybe move it into core.
* specify load path directories * organizational directories that aren't namespaces * specific files that must be required and not autoloaded * custom inflectors where we deviate from convention
Unfortunately, miq_rexml is different because we need to monkey patch it early.
…them Once we eager load, we can remove these.
Use for_gem_extension provided in zeitwerk 2.6.8
Checked commits jrafanie/manageiq-gems-pending@d23ca2f~...d560e92 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint lib/gems/pending/util/miq_file_storage.rb
|
I think this is ready to go. Once in and backported to quinteros, we can decide about about the core PR. They can be independent upgrades. |
Fixes an issue hit with bin/update but not bundle update. The hypenated manageiq-gems-pending gem name file was removed as bundler/rubygems wants you to use manageiq/gems/pending file layout. Due to ManageIQ/manageiq-gems-pending#551
Fixes an issue hit with bin/update but not bundle update. The hyphenated manageiq-gems-pending gem name file was removed as bundler/rubygems wants you to use manageiq/gems/pending file layout. Due to ManageIQ/manageiq-gems-pending#551
Skipping backport to |
Depends on:
TODO: