Skip to content
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 support for Zeitwerk #180

Merged
merged 4 commits into from
Jan 24, 2020

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented Jan 17, 2020

Decorator files are now correctly added to the autoloader and are also loaded on engine boot. This extension is quite unique since it conditionally loads frontend and backend so we can't use the Engine helpers recently added in solidus_support.

This PR is also removing useless assets compilation and refactoring the Engine a little bit.

@kennyadsl kennyadsl self-assigned this Jan 17, 2020
@aldesantis
Copy link
Member

aldesantis commented Jan 17, 2020

@kennyadsl how about moving decorators into their own directory (like we do in app) and having a structure like the following instead?

  • lib/controllers/backend
  • lib/decorators/backend
  • ...

So, basically, the pattern is: lib/[file type]/[solidus engine].

This creates a very clean visual separation for developers and also makes sure we don't add decorator files to paths['app/controllers'].

If you think this structure works, I would suggest adding this to solidus_support instead. A lot of extensions could benefit from this pattern.

@kennyadsl
Copy link
Member Author

We'd still need to differentiate the type of decorator in an inner folder, so it would be:

  • lib/controllers/backend
  • lib/decorators/backend/controllers/...

So it's a bit more complex, but maybe the best path.

@aldesantis
Copy link
Member

I think that works, even if it's not exactly beautiful, and it's basically the same structure we have in app/decorators so it's also consistent.

Decorator files are now correctly added to the autoloader and
are also loaded on engine boot.
There's no need to keep empty assets in this extension.
We were also forcing their compilation into the host application,
which is not needed at all.
@kennyadsl kennyadsl force-pushed the kennyadsl/zeitwerk-support branch from ea1da4d to 0aa00ab Compare January 17, 2020 18:12
@kennyadsl kennyadsl requested a review from a team January 24, 2020 13:26
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kennyadsl!

Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple of nits

@kennyadsl kennyadsl force-pushed the kennyadsl/zeitwerk-support branch from 0aa00ab to 8b087a7 Compare January 24, 2020 14:00
@kennyadsl kennyadsl merged commit bed1824 into solidusio:master Jan 24, 2020
@kennyadsl kennyadsl deleted the kennyadsl/zeitwerk-support branch January 24, 2020 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants