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

Fix installation method as a gem executable #162

Closed

Commits on Jun 15, 2021

  1. Fix installation method as a gem executable

    To support `solidus_auth_devise`, it needs to rely on a new version of
    `solidus_support` that changes how it detects if a Solidus frontend is
    available and the moment it adds the extensions' controller & view
    directories to the Rails known paths.
    
    The previous `solidus_support` version added the extensions' paths on
    the engine's (in this case, `solidus_auth_devise`'s engine) load time
    and only when `SolidusSupport#frontend_available?` returned `true`.
    Engines are loaded before the application code, so at that time, the
    monkey patching of `#frontend_available?` that we were generating was
    not at hand. The solution is two-fold: we add the paths on an
    `initializer` on one side. However, at that moment, the application code
    is neither available, so on the other side, we change
    `#frontend_available?` to look for a
    `Rails.configuration.x.solidius.frontend_available` setting that we add
    to `application.rb` using the generator code. To understand the whole
    picture, keep in mind that `Rails.configuration` is available on an
    initializer, but it's not on an engine's load time.
    On top of that, we need to update a couple of things on the generated code:
    
    - We need to reference `Rails.root` instead of `Engine.root`, as
      `SolidusStarterFrontend::Engine` is unavailable on this installation
      method.
    - We need to copy to `application.rb` the custom code on
      `SolidusStarterFrontend::Engine` for the same reason as above.
    waiting-for-dev committed Jun 15, 2021
    Configuration menu
    Copy the full SHA
    d3c1689 View commit details
    Browse the repository at this point in the history