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

Promotion configuration #5635

Merged
merged 5 commits into from
Feb 22, 2024
Merged

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jan 29, 2024

Summary

This extracts the remaining promotion-related things from Spree::AppConfiguration and Rails.application.config.spree and puts them into Spree::Core::PromotionConfiguration.

Spree::Core::PromotionConfiguration will become the blueprint for a configuration class for a promotion system.

#5634 depends on this or comparable work, because we can't reference classes from Spree::AppConfiguration that aren't defined inside solidus_core or its direct dependencies.

I'm extracting a few commits that used to be in here into their own PR because they don't move existing endpoints.

In a nutshell: All promotion configuration is now found under Spree::Config.promotions, instead of under either Spree::Config or Rails.application.config.spree.promotions or Rails.application.config.spree.calculators. Yay!

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.

@mamhoff mamhoff requested a review from a team as a code owner January 29, 2024 16:42
@github-actions github-actions bot added changelog:solidus_api Changes to the solidus_api gem changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem labels Jan 29, 2024
@mamhoff mamhoff force-pushed the promotion-configuration branch from 6ffe4c0 to 0dc0086 Compare January 29, 2024 18:05
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5502e5e) 88.58% compared to head (4b4f8ea) 88.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5635      +/-   ##
==========================================
+ Coverage   88.58%   88.62%   +0.03%     
==========================================
  Files         687      688       +1     
  Lines       16453    16490      +37     
==========================================
+ Hits        14575    14614      +39     
+ Misses       1878     1876       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mamhoff
Copy link
Contributor Author

mamhoff commented Jan 29, 2024

Also, I'm very open to comments here. Some of the choices I'm not so sure about are:

@jarednorman
Copy link
Member

Should I've named the configuration option on AppConfiguration just simply promotions?

I prefer that.

@mamhoff mamhoff marked this pull request as draft February 3, 2024 12:09
…ration

We want to be able to move all promotion-related things out of
`solidus_core` in PR solidusio#5634. However, Spree::AppConfiguration also does
all the promotion-specific things, and we can't move the app
configuration out of core.

In solidusio#5658, we've added a promotion configuration object as a nucleus for
core's promotion system's configuration,
`Spree::Core::PromotionConfiguration`. This implements all the
promotion-specific configuration preferences from
`Spree::AppConfiguration` there.
This implements deprecated setters and getters for the
promotion-specific preferences on `Spree::AppConfiguration`.

Now, if a developer wants to set their
The contents of this class are promotion-related and should move to
`Spree::PromotionConfiguration`. We can also use the default option of
the `add_class_set` method here.

There were originally no direct specs for
`Spree::Core::Environment::Promotions`. I'm not adding any, because the
class is indirectly tested through `Spree::AppConfiguration` and now
only has deprecated methods.
@mamhoff mamhoff force-pushed the promotion-configuration branch 2 times, most recently from 982ce6f to e494180 Compare February 17, 2024 13:43
It seems we want to be able to test files without loading all of Solidus.
Unfortunately, we do load Solidus' configuration, and this PR needs the
configuration object to be able to deprecate extension points. What this
commit does is it allows loading a module that defined
`Spree.deprecator` and loads that module in both `spree/core.rb` and the
`spec_helper.rb`.
@mamhoff mamhoff force-pushed the promotion-configuration branch from cd7fdef to 4b4f8ea Compare February 17, 2024 14:45
@mamhoff mamhoff marked this pull request as ready for review February 17, 2024 15:06
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Nice 🚢

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

0dc0086. Should this really live in the promotions conf object, or in the main Solidus one, and the promo extensions just use it? Seems generic enough.

Let's go as is for now, I don't know either buy maybe with the rest of the implementations we will have a better picture, and it's "easy" to move.

@kennyadsl kennyadsl merged commit 91544f4 into solidusio:main Feb 22, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_api Changes to the solidus_api gem changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants