-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Setup custom Gemfile path before loading bundler for binstubs #6201
Setup custom Gemfile path before loading bundler for binstubs #6201
Conversation
Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #bundler channel on Slack. For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide |
Can you look into adding a test for this fix? Thanks! |
yep, I'm in progress on this |
f38ee7a
to
2b1190a
Compare
4f1bf2f
to
0f62f28
Compare
@segiddins added! you could check! |
Thanks for this change! I believe this is the intended behavior :) |
@indirect r? In that case? |
@bundlerbot r+ |
📌 Commit 0f62f28 has been approved by |
…irect Setup custom Gemfile path before loading bundler for binstubs ### What was the end-user problem that led to this PR? While you have several gemfiles: `Gemfile` and `Gemfile.tools`. and generates binstubs for gems from second gemfile: `BUNDLE_GEMFILE=Gemfile.tools bundle binstubs rubocop` when you invoke those bin `bin/rubocop` then you see error like: ```bash /usr/local/opt/rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/rubygems_integration.rb:458:in `block in replace_bin_path': can't find executable rubocop for gem rubocop. rubocop is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception) from /usr/local/opt/rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/rubygems_integration.rb:489:in `block in replace_bin_path' from bin/rubocop:21:in `<main>' ``` ### What was your diagnosis of the problem? When you have generated `bin/bundler` by rails or by `bundler` it has setup of `BUNDLE_GEMFILE` by default as `Gemfile` or by gemfile which has been setup on `bundle binstub bundler`. So your binstub for rubocop could not change it. ### What is your fix for the problem, implemented in this PR? I propose to use`BUNDLE_GEMFILE` from gem's binstub over bundler's binstub version ### Why did you choose this fix out of the possible options? This was default behavior before #5878 introduced. Just added some fix to related PR.
☀️ Test successful - status-travis |
…v, r=indirect Setup custom Gemfile path before loading bundler for binstubs ### What was the end-user problem that led to this PR? While you have several gemfiles: `Gemfile` and `Gemfile.tools`. and generates binstubs for gems from second gemfile: `BUNDLE_GEMFILE=Gemfile.tools bundle binstubs rubocop` when you invoke those bin `bin/rubocop` then you see error like: ```bash /usr/local/opt/rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/rubygems_integration.rb:458:in `block in replace_bin_path': can't find executable rubocop for gem rubocop. rubocop is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception) from /usr/local/opt/rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/rubygems_integration.rb:489:in `block in replace_bin_path' from bin/rubocop:21:in `<main>' ``` ### What was your diagnosis of the problem? When you have generated `bin/bundler` by rails or by `bundler` it has setup of `BUNDLE_GEMFILE` by default as `Gemfile` or by gemfile which has been setup on `bundle binstub bundler`. So your binstub for rubocop could not change it. ### What is your fix for the problem, implemented in this PR? I propose to use`BUNDLE_GEMFILE` from gem's binstub over bundler's binstub version ### Why did you choose this fix out of the possible options? This was default behavior before rubygems#5878 introduced. Just added some fix to related PR.
What was the end-user problem that led to this PR?
While you have several gemfiles:
Gemfile
andGemfile.tools
.and generates binstubs for gems from second gemfile:
BUNDLE_GEMFILE=Gemfile.tools bundle binstubs rubocop
when you invoke those bin
bin/rubocop
then you see error like:
What was your diagnosis of the problem?
When you have generated
bin/bundler
by rails or bybundler
it has setup ofBUNDLE_GEMFILE
by default asGemfile
or by gemfile which has been setup onbundle binstub bundler
.So your binstub for rubocop could not change it.
What is your fix for the problem, implemented in this PR?
I propose to use
BUNDLE_GEMFILE
from gem's binstub over bundler's binstub versionWhy did you choose this fix out of the possible options?
This was default behavior before #5878 introduced. Just added some fix to related PR.