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

Don't install solidus_auth_devise if it's already in the Gemfile #4748

Conversation

gsmendoza
Copy link
Contributor

@gsmendoza gsmendoza commented Nov 29, 2022

Goal

Given I have a Rails app
When I add Solidus 3.2.4 to the Gemfile
And I install Solidus with Solidus Starter Frontend and Solidus Auth Devise
Then I should see only one solidus_auth_devise line in the Gemfile.

Current behavior

The Gemfile has two lines for solidus_auth_devise :

# FIXME: Please remove this line if `solidus_auth_devise` appears anywhere else in the gemfile
#        or replace it with a simple `gem 'solidus_auth_devise'` otherwise.
gem 'solidus_auth_devise' unless File.read(__FILE__).lines[__LINE__..-1].grep(/solidus_auth_devise/).any?

gem "solidus_auth_devise"

Cause

This is a workaround to an issue where Solidus#InstallGenerator and SolidusStarterFrontend both add solidus_auth_devise to the Gemfile. From solidusio/solidus_starter_frontend@b9e8a7f:

Adding solidus_auth_devise to the Gemfile was conflicting with it
being added by the solidus installer again unless
`--with-authentication=false` was provided. But the auth extension
is also required by SSF. This forced a workaround in which we skip
the `gem` entry in the Gemfile if another entry for the same gem is
present in any of the following lines. It's ugly but puts a bandaid
that will at least allow the installation to succeed.

Testing

I have confirmed manually that, in conjunction with the SolidusStarterFrontend update, installing Solidus in v3.2 now installs solidus_auth_devise only once. See

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

  • I have written a thorough PR description.
  • I have kept my commits small and atomic.
  • I have used clear, explanatory commit messages.

The following are not always needed (cross them out if they are not):

  • [ ] I have added automated tests to cover my changes.
  • [ ] I have attached screenshots to demo visual changes.
  • [ ] I have opened a PR to update the guides.
  • [ ] I have updated the README to account for my changes.

@gsmendoza gsmendoza marked this pull request as ready for review November 29, 2022 10:16
@gsmendoza gsmendoza self-assigned this Nov 29, 2022
@gsmendoza gsmendoza force-pushed the gsmendoza/sol-547-fix-ensure-that-ssf-32-doesnt-add branch from 28c3ee3 to 9247053 Compare November 29, 2022 10:19
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

Left an optional nit, fine by me if we merge without changing anything 🙌

core/lib/generators/solidus/install/install_generator.rb Outdated Show resolved Hide resolved
@chrean chrean mentioned this pull request Nov 30, 2022
Copy link
Contributor

@waiting-for-dev waiting-for-dev left a comment

Choose a reason for hiding this comment

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

Leaving some comments to understand everything, but it looks great ❤️

@gsmendoza gsmendoza force-pushed the gsmendoza/sol-547-fix-ensure-that-ssf-32-doesnt-add branch from aca672c to d800b86 Compare December 1, 2022 07:22
@waiting-for-dev waiting-for-dev added the type:enhancement Proposed or newly added feature label Dec 2, 2022
@gsmendoza gsmendoza force-pushed the gsmendoza/sol-547-fix-ensure-that-ssf-32-doesnt-add branch 2 times, most recently from 2d67d60 to 26a6e15 Compare December 2, 2022 06:44
@gsmendoza gsmendoza requested a review from a team December 3, 2022 01:00
@gsmendoza
Copy link
Contributor Author

@waiting-for-dev @solidusio/core-team I don't have any more updates to this PR. Can you take a look again? Thank you!

* Extracted `install_plugin` method.
* Installing the plugin sequentially would call `bundle install` twice,
  but this is okay since InstallGenerator in master also adds gems to the
  bundle one at a time.

Also:

* Improved names of affected methods.
@gsmendoza gsmendoza force-pushed the gsmendoza/sol-547-fix-ensure-that-ssf-32-doesnt-add branch from 26a6e15 to 763c649 Compare December 13, 2022 09:50
@gsmendoza
Copy link
Contributor Author

@waiting-for-dev I extracted the method to uncached_dependencies. Can you take one more look? Thank you!

@waiting-for-dev waiting-for-dev merged commit 20d784d into solidusio:v3.2 Dec 13, 2022
@waiting-for-dev waiting-for-dev deleted the gsmendoza/sol-547-fix-ensure-that-ssf-32-doesnt-add branch December 13, 2022 15:04
@waiting-for-dev waiting-for-dev added the changelog:solidus_core Changes to the solidus_core gem label Dec 23, 2022
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 type:enhancement Proposed or newly added feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants