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

Use Flickwerk for loading patches in solidus_promotions and solidus_legacy_promotions #6049

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Dec 21, 2024

Summary

Uses the Flickwerk gem to load patches in the solidus_promotions and solidus_legacy_promotions gems.

This allows us to defer loading of patches to when the classes being patched are autoloaded, rather than loading them in a config.to_prepare block.

The commit history should explain the few things I had to add here. Namely, I had to add a getter to Spree::Preferences::Configuration for the class names of configurable classes in order to configure Flickwerk to be able to understand patches like Spree::Config.order_recalculator_class.prepend self.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

When configuring Flickwerk, we need a way to get at class names without
constantizing (i.e. loading) those classes. This adds some specs for the
`class_name_attribute` class method on
Spree::Preferences::Configuration, and generates a new getter that has
`_name` attached to the method to get just the string name.
This stops us from loading line item, order, adjustment, shipment,
shipping rate, and the order recalculator on app startup.
This should stop us from loading order, line items, adjustment,
calculators, the order updater, product, and shipment on app startup.
@mamhoff mamhoff requested a review from a team as a code owner December 21, 2024 15:01
@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant