You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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)
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
This is tricky to debug since a bundle update will blow away any modifications you make in .bundle/plugin/gem directory.
Also, using path for your plugin (and not version) will link the index directly to your source code outside of the .bundle directoy and will not properly show the issue.
Once you follow through @Fryguy comments and agree there probably is an issue here, I think checking that the .bundle/plugin/index is updated is your best quick detect for whether this works or not.
The .bundle/plugin/index not pointing to the correct gem feels like the smoking gun, but I didn't want to make the assumption that just because the index says one thing that something else wasn't going on. So, the "hack" code is there to prove that it's actually executing the wrong plugin as well.
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:
Then
bundle install
. This works as expected.Next update the version in the Gemfile:
Then
bundle install
. You will notice that 0.3.0 gets installed correctly, however the index does not reflect that update: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)
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 redobundle 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 belowEnvironment
Bundler Build Metadata
Gemfile
Gemfile
Gemfile.lock
The text was updated successfully, but these errors were encountered: