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

Tweaks for the Solidus installer #4504

Merged

Conversation

waiting-for-dev
Copy link
Contributor

Summary

We're tweaking the installer with some fixes and optimizations. Please, see the individual commits for better comprehension and review:

  • Fix for when a private gem server is used.
  • Fix for when a git source is used.
  • Remove unhandled groups and autorequire options.
  • Do not break down the solidus meta-gem when solidus_frontend is used.
  • Do not add source: when installing solidus_frontend

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.

ebfd2ed changed the installer to allow
users select solidus_starter_frontend or solidus_frontend as their
storefront.

If the installer added solidus_frontend to the Gemfile, the `source:`
argument was given to avoid conflicts with the `frontend` directory in
the mono-repo. However, the directory was removed in
c89fbf0.

See solidusio#4490 (comment) for more context
In ebfd2ed, we updated the installer to
allow the selection of both solidus_frontend and
solidus_starter_frontend.

When solidus_starter_frontend is chosen, we need to break down the
solidus meta-gem so that solidus_frontend is not pulled.

We also broke down the meta-gem when solidus_frontend was chosen to
avoid source conflicts with the gem in the mono-repo. However, we
removed the `frontend` directory in
c89fbf0. That means that's no longer
needed, as the gem is explicitly added to the Gemfile.
Bundler expects two different types in `Bundler::Dependency#source`.
When it's created from `Bundler.locked_gems.dependencies`, it's a
`Bundler::Source` instance. However, the canonical injector expects it
to be a `String`. We're now tweaking our injector to extract the source
URI from the `Bundler::Source` instance.
As `Bundler::Source::Git` is a subclass of `Bundler::Source::Path`, our
installer replaced `git` sources with its download path when breaking
down the solidus meta-gem. We're now adding the `git` & `ref` options
when the source is a `Bundler::Source::Git`. It also works for shortcuts
like `github:` or `branch:`, as they're translated into `git:` & `ref:`
options.
Both groups and autorequire options are always `nil` when fetching a
`Bundler::Dependency` from `Bundler.locked_gems.dependencies`. We're
acknowledging that by not doing anything with them.

That means that those options will be lost after the installation in the
unlikely scenario they're given. However, they can be seen more as
optimizations, and users can add them again manually. There's no easy
workaround for that.
@waiting-for-dev waiting-for-dev requested a review from a team August 15, 2022 10:48
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.

Thanks Marc, this one seems tricky. Can you please confirm that we can remove these "hacks" on the next major, when no frontend will be in the metagem?

@waiting-for-dev
Copy link
Contributor Author

Thanks Marc, this one seems tricky. Can you please confirm that we can remove these "hacks" on the next major, when no frontend will be in the metagem?

Yeah, @kennyadsl. I agree it's very hacky. However, using built-in bundler tools, even when they're half-cooked, is the most robust way to support our deprecation path. As you said, we can remove all of it before v4.

@waiting-for-dev waiting-for-dev merged commit ab45686 into solidusio:master Aug 16, 2022
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/tweaks_installer branch August 16, 2022 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants