Shopify / bootboot

Dualboot your Ruby app made easy
MIT License
416 stars 35 forks source link

Bundler plugin index does not update when updating bootboot #53

Open jscharf opened 1 year ago

jscharf commented 1 year ago

Hello,

We recently were trying to update from Bundler v2.2.32 to v2.3.22 and ran into the following error:

NoMethodError: undefined method `to_gem_version_with_patchlevel' for #<Bundler::RubyVersion:0x00007fddb7072988>
  <path-to-project>/.bundle/plugin/gems/bootboot-0.2.0/lib/bootboot/ruby_source.rb:29:in `block in specs'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/index.rb:9:in `build'
  <path-to-project>/.bundle/plugin/gems/bootboot-0.2.0/lib/bootboot/ruby_source.rb:20:in `specs'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:167:in `index_for'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:175:in `results_for'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:127:in `search_for'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:268:in `block in verify_gemfile_dependencies_are_found!'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:265:in `map!'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:265:in `verify_gemfile_dependencies_are_found!'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/resolver.rb:48:in `start'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/definition.rb:290:in `resolve'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/definition.rb:187:in `resolve_remotely!'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/plugin/installer.rb:36:in `install_definition'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/plugin.rb:116:in `block in gemfile_install'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/settings.rb:131:in `temporary'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/plugin.rb:103:in `gemfile_install'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/cli/update.rb:18:in `run'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:305:in `block in update'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/settings.rb:131:in `temporary'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:304:in `update'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
  <path-to-rbenv>/.rbenv/versions/2.7.3/bin/bundle:23:in `<main>'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
  <path-to-rbenv>/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
  <path-to-rbenv>/.rbenv/versions/2.7.3/bin/bundle:23:in `load'

I understand that was related to a change in Bundler version 2.3.12 https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md#2312-april-20-2022

And I understand this issue was addressed in #40 and fixed in version 0.2.1 of bootboot.

However we found after running cat .bundle/plugin/index and seeing the following

---
commands:
  bootboot: "bootboot"
hooks:
  before-install-all:
  - "bootboot"
  after-install-all:
  - "bootboot"
load_paths:
  bootboot:
  - "<path-to-project>/.bundle/plugin/gems/bootboot-0.2.0/lib"
plugin_paths:
  bootboot: "<path-to-project>/.bundle/plugin/gems/bootboot-0.2.0"
sources:

that it was still pointing to the older version of bootboot.

When we ran bundle plugin uninstall bootboot it was removed from the index, and then when we ran bundle plugin install bootboot it was pointing to the correct 0.2.1 version after that.

Is there anything that we can do in this repository to make sure that index gets updated when a new version is listed in the Gemfile?

plugin 'bootboot', '~> 0.2.1'

I would be happy to attempt the contribution if someone was willing to point me in the right direction.

Thanks for bootboot I think it's a great plugin!