Use correct Bundler version when updating gems #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before,
update-interactive
would update gems using whateverbundle
binary was in the PATH. On Rails projects, there is often a binstub for Bundler located atbin/bundle
. If thisbin
directory is in the PATH, then the binstub is executed instead of Bundler being executed directly.Using the binstub is problematic, because the binstub locks the version of Bundler to the
BUNDLED WITH
value of the lock file. The binstub makes an exception for this behavior when runningbin/bundle update
, so that the latest version of Bundler is used when updating gems. However, this auto-detection only works when the binstub is invoked directly in the shell. Sinceupdate-interactive
wraps the invocation of the update command, the binstub falls back to locking the version of Bundler at whatever is in the lock file.As a result,
update-interactive
would not update the lockfile with the version of Bundler that the user intended.Fix by using
Gem.bin_path
to get the correct Bundler executable, rather than using a binstub that might be in the user's PATH.