Closed marten closed 5 years ago
After digging appraisal source code as well as other resources, allow me to describe what is happening.
bundle install
with bundler < 2., for example bundle v1.17.3gem update --system # this update Ruby gems
gem install bundle # to install the latest version of bundle
after this bundle install
should be successful.
bundle exec appraisal make me a god
will go through a bunch of processing. Essentially, if the command has no bundle exec, it will be appended bundle exec -> the above example would turn into bundle exec make me a god
and executed in the code by Kernel.system(bundle exec make me a god)
. Now let's say make me a god
have a compatibility problem with bundler that we already fixed above, it should be working right? The answer is no. Because here:
https://github.com/thoughtbot/appraisal/blob/c4af85912d26bd4a730d739c44a5070b6de4bd4b/lib/appraisal/command.rb#L69-L74In these lines, an important ENV is reset. It is RUBYOPT. I wont go into details what this ENV do and why the chose to reset it, but:
$ bundle exec irb
irb(main):003:0> `gem list bundle`
=> "bundler (2.0.1)\n"
irb(main):007:0> ENV['RUBYOPT'] = nil
=> nil
irb(main):008:0> `gem list bundle`
=> "bundler (default: 1.17.3)\n"
and then our commands will stop working.
The solution right now in my opinion is to rollback to using the old version of bundler or ignore appraisals' gemfiles' gemfile.lock in your code. After all, this problem is from the bundler team, not Appraisal so fixing this here does not make sense to me.
I'm so sorry I didn't get around to saying how awesome this reply is sooner. Thanks so much for this above and beyond investigation, especially when the fix, as you explain, belongs in Bundler rather than Appraisal. 🥇
I'm running into a strange issue on our CI system. Bundler 2.0.1 is installed, it's also what's used if you check
bundle version
but the command to install Appraisal's gemfiles fails saying that it can't find bundler v2.0.1 (full error below).I'm at a loss as to what this could be. It might not be Appraisal's fault, but I figured I'd try posting this here first, maybe someone has seen this before?