Update and Refactor Solidus Static Content Extension for Modern Solidus Compatibility#1
Open
Update and Refactor Solidus Static Content Extension for Modern Solidus Compatibility#1
Conversation
Ensure that the correct SQLite version is used depending on the Rails version, avoiding compatibility issues. The simplified logic for loading Solidus gems makes the Gemfile easier to maintain. Add compatibility with newer versions of Solidus and its development tools, reducing the risk of dependency conflicts.
Move Deface overrides (pages_in_footer, pages_in_header, pages_in_sidebar) into the `SolidusStaticContent` module. Wrapped each override in a properly named constant. Resolve the `Zeitwerk::NameError` issue by ensuring that the filenames match the constants they define. Zeitwerk, the code loader used in Rails 6+, requires filenames to correspond to the constants they define. By wrapping the overrides in modules and constants, we ensure compatibility with Zeitwerk's autoloading mechanism.
Prevent conflicts with the starter_frontend layout, ensuring that the static content routes work correctly in both classic and starter frontend setups.
Update the `install_generator.rb` to support both starter and classic frontends. Add templates for the `static_content_controller` and `show.html.erb` views for the starter frontend. Improve flexibility by allowing the extension to work seamlessly with both starter and classic frontends, catering to different user preferences.
Replace deprecated or redundant initializations and imports. In `solidus_static_content/engine.rb`, replace the previous method of adding a custom backend menu item with a cleaner approach using an initializer that configures the menu items directly in `Spree::Backend::Config`. This change enhances maintainability, making it easier to modify the menu configuration in the future and ensures compatibility with the current version of Solidus by utilizing more modern initialization patterns.
Update spec/spec_helper.rb to load factories from the testing_support directory and handle older versions of Solidus. Add additional test cases for the engine's backend menu item configuration.
c9fa639 to
f869bd1
Compare
f869bd1 to
901b6d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces a series of updates and refactors to the
solidus_static_contentextension to ensure compatibility with the latest versions of Solidus, Rails, and Zeitwerk. The changes also improve code organization, testing, and flexibility for bothstarterandclassicfrontends.Key Changes:
Fix Zeitwerk Autoloading Issues:
pages_in_footer,pages_in_header,pages_in_sidebar) into theSolidusStaticContentmodule and wrapped them in properly named constants.Zeitwerk::NameErrorby ensuring filenames match the constants they define, making the extension compatible with Rails 6+ and Zeitwerk's autoloading mechanism.Update CI Configuration:
.circleci/config.ymlto use a matrix for testing across multiple Solidus versions, Ruby versions, and databases.browser-toolsorb to support feature specs.Refactor Gemfile and Gemspec:
Gemfileto dynamically determine the SQLite version based on the Rails version.solidusandsolidus_frontendgems.solidus_static_content.gemspecto support Solidus core versions up to 5 and usesolidus_dev_supportversion 2.7.Enhance Install Generator:
install_generator.rbto support bothstarterandclassicfrontends.static_content_controllerandshow.html.erbviews for thestarterfrontend.Refactor Routes:
config/routes.rbto conditionally apply the static content route constraint based on the layout configuration.starter_frontendlayout, ensuring that static content routes work correctly in both frontend setups.Improve Test Coverage:
spec/spec_helper.rbto load factories from thetesting_supportdirectory and handle older versions of Solidus.Refactor Engine Initialization:
lib/solidus_static_content/engine.rb.Update Sandbox Script:
bin/sandboxscript to use themainbranch instead ofmasterand added a fix for the Sprockets manifest file.Update Documentation:
starterfrontend and other changes.