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

Allow detecting Solidus components through a Rails setting #66

Closed
wants to merge 2 commits into from
Closed

Allow detecting Solidus components through a Rails setting #66

wants to merge 2 commits into from

Commits on Jun 16, 2021

  1. Fix dependency on the engines load order when adding paths

    We were adding the view and controller paths at engine loading time. So,
    E.g., if a frontend engine was present, but we loaded it after the
    extension depending on `solidus_support` (i.e., the extension went first
    on the `Gemfile`), paths weren't being loaded.
    
    We're adding the paths on an initializer that runs before Rails's
    [`:initialize_dependency_mechanism`](https://github.com/rails/rails/blob/127dd06df66552dd272eea7832f8bb205cf6fd01/railties/lib/rails/application/bootstrap.rb#L68)
    one. Thenceforth Rails begins messing with the load paths, and it doesn't
    take them into account anymore.
    
    Keep in mind that the `SolidusSupport.#{engine}_available?` call needs
    to be placed within the `initializer` context and not wrapping it. The
    reason is the same as above: don't doing the logic at load time.
    waiting-for-dev committed Jun 16, 2021
    Configuration menu
    Copy the full SHA
    202e77c View commit details
    Browse the repository at this point in the history
  2. Allow detecting Solidus components through a Rails setting

    This allows us to define solidus components at the application level, in
    contrast to the typical engine definition.
    
    Components paths are loaded on an initializer, which runs before the
    application code that could define an `Engine` class. Adding a setting
    on the `application.rb`, which runs before the initializers, helps us
    working around it.
    
    For now, we keep the old detection mechanism, as the other extensions
    will need to adapt to it first.
    waiting-for-dev committed Jun 16, 2021
    Configuration menu
    Copy the full SHA
    47c7ca7 View commit details
    Browse the repository at this point in the history