Description
Describe the problem as clearly as you can
The plugin directive when given a version installs that version, but doesn't use it if an upgrade has occurred. Instead it seems to use what's in the index, but the index is not updated to the requested version.
Did you try upgrading rubygems & bundler?
Yes, this occurs on latest bundler and I also see it happening as far back as 2.4.17 (and probably further, but I didn't continue back)
Post steps to reproduce the problem
Start with this basic Gemfile:
source "https://rubygems.org"
plugin "bundler-commentate", "~> 0.2.0"
Then bundle install
. This works as expected.
Next update the version in the Gemfile:
source "https://rubygems.org"
plugin "bundler-commentate", "~> 0.3.0"
Then bundle install
. You will notice that 0.3.0 gets installed correctly, however the index does not reflect that update:
$ ls -l .bundle/plugin/gems
total 0
drwxr-xr-x@ 13 jfrey staff 416 Jan 23 15:34 bundler-commentate-0.2.0
drwxr-xr-x@ 13 jfrey staff 416 Jan 23 15:34 bundler-commentate-0.3.0
drwxr-xr-x@ 6 jfrey staff 192 Jan 23 15:34 parser-3.3.0.5
drwxr-xr-x@ 5 jfrey staff 160 Jan 23 15:34 unparser-0.6.12
$ cat .bundle/plugin/index
---
commands:
commentate: "bundler-commentate"
hooks:
load_paths:
bundler-commentate:
- "/Users/jfrey/dev/test/bundler_plugin_issue/.bundle/plugin/gems/bundler-commentate-0.2.0/lib"
plugin_paths:
bundler-commentate: "/Users/jfrey/dev/test/bundler_plugin_issue/.bundle/plugin/gems/bundler-commentate-0.2.0"
sources:
Next, to show that the version being used is incorrect, we can modify the source to display the version on use, so run the following (apologies for this hacky way, but I was having a really hard time finding a plugin that was versioned and also showed the version - we can probably invent one for specs)
$ echo 'puts "Bundler::Commentate::VERSION: #{Bundler::Commentate::VERSION}"' >> .bundle/plugin/gems/bundler-commentate-0.2.0/lib/bundler/commentate/version.rb
$ echo 'puts "Bundler::Commentate::VERSION: #{Bundler::Commentate::VERSION}"' >> .bundle/plugin/gems/bundler-commentate-0.3.0/lib/bundler/commentate/version.rb
Now run bundler commentate --help
. You will see that it is using version 0.2.0 even though we've requested 0.3.0.
The seemingly only workaround at this point is to rm -rf .bundle
and then redo bundle install
.
Which command did you run?
What were you expecting to happen?
What actually happened?
See above.
If not included with the output of your command, run bundle env
and paste the output below
Environment
Bundler 2.5.5
Platforms ruby, arm64-darwin-22
Ruby 3.0.6p216 (2023-03-30 revision 23a532679b406cb53c0edfc00c91c32a5ccd335a) [arm64-darwin-22]
Full Path /Users/jfrey/.rubies/ruby-3.0.6/bin/ruby
Config Dir /Users/jfrey/.rubies/ruby-3.0.6/etc
RubyGems 3.2.33
Gem Home /Users/jfrey/.gem/ruby/3.0.6
Gem Path /Users/jfrey/.gem/ruby/3.0.6:/Users/jfrey/.rubies/ruby-3.0.6/lib/ruby/gems/3.0.0
User Home /Users/jfrey
User Path /Users/jfrey/.gem/ruby/3.0.0
Bin Dir /Users/jfrey/.gem/ruby/3.0.6/bin
Tools
Git 2.42.0
RVM not installed
rbenv not installed
chruby 0.3.9
Bundler Build Metadata
Built At 2024-01-18
Git SHA 2efa8cec93
Released Version true
Gemfile
Gemfile
source "https://rubygems.org"
plugin "bundler-commentate", "~> 0.3.0"
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
arm64-darwin-22
ruby
DEPENDENCIES
BUNDLED WITH
2.5.5