thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Where and how does Appraisal install gems? #143

Closed alexevanczuk closed 5 years ago

alexevanczuk commented 5 years ago

I'm using Appraisal to run tests using an upgraded version of Rails. As part of our CI setup, our application installs gem using this configuration:

bundle config --local path vendor/bundle

I found that I have to set this for appraisal too, which makes sense. If I set GEM_PATH to vendor/bundle/ruby/2.3.0/ then it works. The odd part is, our application uses ruby 2.3.5. RUBY_VERSION, ruby -v, the regular and the appraisal Gemfile all say ruby 2.3.5, and in fact 2.3.0 does not exist in our codebase in the context of anything related to ruby.

I tried telling Appraisal to use the current RUBY_VERSION to install gems, but it is still installing gems to ruby/2.3.0.

GEM_PATH="vendor/bundle/ruby/#{$RUBY_VERSION}/" BUNDLE_PATH="vendor/bundle/ruby/#{$RUBY_VERSION}/" GEM_HOME="vendor/bundle/ruby/#{$RUBY_VERSION}/" bundle exec appraisal install
GEM_PATH="vendor/bundle/ruby/#{$RUBY_VERSION}/" BUNDLE_PATH="vendor/bundle/ruby/#{$RUBY_VERSION}/" GEM_HOME="vendor/bundle/ruby/#{$RUBY_VERSION}/" bundle exec appraisal rails-next rails runner "puts 1"

Any help with this?

alexevanczuk commented 5 years ago

I discovered our build system seems to also be installing to ruby/2.3.0, which might have something to do with it. I am a bit confused though why appraisal install would not seem to install to ruby/2.3.5, though. I ran find vendor/bundle -d after running appraisal install, and also ran this to determine the location of rails through appraisal:

GEM_PATH="vendor/bundle/ruby/#{$RUBY_VERSION}/" BUNDLE_PATH="vendor/bundle/ruby/#{$RUBY_VERSION}/" GEM_HOME="vendor/bundle/ruby/#{$RUBY_VERSION}/" bundle exec appraisal bundle show rails
/var/www/gemfiles/vendor/bundle/ruby/2.3.0/gems/rails-5.0.0.1
alexevanczuk commented 5 years ago

I found that our box has an env variable RUBY_MAJOR that has value 2.3, which I think might be affecting bundler's path. I'm going to close this out since it seems to be resulting from a confluence of factors which are not clearly related to this gem.