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

[3.2 hotfix] Fix nil bundle_path while installing solidus_frontend #4697

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

elia
Copy link
Member

@elia elia commented Nov 2, 2022

Summary

Tested by doing bin/sandbox --frontend=solidus_frontend, it fails with:

  installing  solidus_frontend
         run  bundle add solidus_frontend
/Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator/install_frontend.rb:30:in `system': no implicit conversion of nil into String (TypeError)
	from /Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator/install_frontend.rb:30:in `block in bundle_command'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/site_ruby/3.0.0/bundler.rb:410:in `block in with_unbundled_env'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/site_ruby/3.0.0/bundler.rb:709:in `with_env'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/site_ruby/3.0.0/bundler.rb:410:in `with_unbundled_env'
	from /Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator/bundler_context.rb:48:in `bundle_cleanly'
	from /Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator/install_frontend.rb:28:in `bundle_command'
	from /Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator/install_frontend.rb:40:in `install_solidus_frontend'
	from /Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator/install_frontend.rb:17:in `call'
	from /Users/elia/Code/Nebulab/solidus/core/lib/generators/solidus/install/install_generator.rb:199:in `install_frontend'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `block in invoke_all'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `each'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `map'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `invoke_all'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/group.rb:232:in `dispatch'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.4/lib/rails/generators.rb:263:in `invoke'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.4/lib/rails/commands/generate/generate_command.rb:26:in `perform'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/elia/.asdf/installs/ruby/3.0.3/lib/ruby/gems/3.0.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:4:in `<main>'

without the fix and goes smoothly when the fix is applied.

cc @waiting-for-dev @abhishekgupta5

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.

When `Gem.bin_path("bundler", "bundle")` is used inside `with_unbundled_env`
it can return `nil`, thus breaking the command. By storing the path
outside of the block we ensure to grab a working path instead.

Also removed the unused `env` argument.
@github-actions github-actions bot added changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_api Changes to the solidus_api gem changelog:solidus_core Changes to the solidus_core gem labels Nov 2, 2022
@elia elia changed the base branch from master to v3.2 November 2, 2022 15:29
@elia elia marked this pull request as ready for review November 2, 2022 15:29
@abhishekgupta5
Copy link

Tested this and the fix is working perfectly. Thanks @elia !

The issue was -
Gem.bin_path("bundler", "bundle") } returns nil (instead of bundle path)
inside Bundler.with_bundled_env


On an unrelated note, I got the error in the below screenshot after I tried bin/sandbox on applied fix

image

This is not related to the hotfix or the issue, but in case you encounter it, the solution is to upgrade Rubygems -

gem update --system

Feel free to merge this 🚀

Copy link

@abhishekgupta5 abhishekgupta5 left a comment

Choose a reason for hiding this comment

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

LGTM

@waiting-for-dev waiting-for-dev merged commit 6f761a1 into solidusio:v3.2 Nov 3, 2022
@waiting-for-dev waiting-for-dev deleted the elia/3-2-inline-env-fix branch November 3, 2022 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_api Changes to the solidus_api gem changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants