Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use correct Bundler version when updating gems (#29)
Before, `update-interactive` would update gems using whatever `bundle` binary was in the PATH. On Rails projects, there is often a binstub for Bundler located at `bin/bundle`. If this `bin` 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 running `bin/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. Since `update-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.
- Loading branch information