-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Fixes for Zeitwerk #176
Fixes for Zeitwerk #176
Conversation
They are not compatible with Zeitwerk, which is shipped with Rails 6. Since they are not used in Solidus versions that are compatible with Rails 6, there's no reason to keep them.
b962a0c
to
78c8fdb
Compare
This file has not a class defined with the same name as the filename itself. Zeitwerk does not like it.
With this PR we changed things that makes the extension no more compatible with Solidus < 2.5 and we need to reflect this in the gemspec.
78c8fdb
to
329f89d
Compare
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.
Nice fix + cleanup, thank you @kennyadsl 👍
@@ -21,7 +21,7 @@ Gem::Specification.new do |s| | |||
s.require_path = "lib" | |||
s.requirements << "none" | |||
|
|||
solidus_version = [">= 1.2.0", "< 3"] | |||
solidus_version = [">= 2.6", "< 3"] |
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.
🔥
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.
LGTM! Thanks Alberto!
@kennyadsl instead of making overrides compliant with Zeitwerk, I think we should simply prevent Zeitwerk from loading them in the first place: config.eager_load_paths -= %W(#{config.root}/app/overrides) Deface will still load them manually, so this won't create any problems. Furthermore, it's also what @fxn suggests to do (rails/rails#36100 (comment)). |
@aldesantis added the proposed solution directly into Deface with a fix: spree/deface#202 which has now been released. I'll re-run specs here and we should be good to merge. |
In production, we are experiencing issues with this extension and Zeitwerk, due to how it works and how we named filenames and classes (they should match). See #174
This PR fixes the issue by removing some deface overrides that are no longer needed (since they only apply to Solidus <= 2.5, currently EOL). Also, this PR reorganize some classes that use
class_eval
in favor ofModule#prepend
, which allows us to define a module that has the same name as the file.A version bump will probably follow this PR.