Shopify / bootboot

Dualboot your Ruby app made easy
MIT License
416 stars 35 forks source link

Ruby version issues #50

Closed maths22 closed 1 year ago

maths22 commented 2 years ago

We have the following in our Gemfile:

ruby ">= 2.7.0", "< 3.1"

When running with bootboot on ruby 2.7.6, we get the following error:

Could not find gem 'Ruby (= 2.7.6)' in Bootboot plugin Ruby source.

The source contains the following gems matching 'Ruby':
  * Ruby-2.7.0
rafaelfranca commented 2 years ago

Thank you for the issue. The problem is probably in this file and how we try to detect the ruby version. Do you want to take a look on how to fix it?

adamstegman commented 1 year ago

@maths22 did #55 solve your issue? I ask because a couple folks on our team are still running into this error, even on v0.2.2.

Updating the .../Gemfile_next.lock
Fetching gem metadata from https: //rubygems.org/.......
Could not find gem 'Ruby (= 2.7.7)' in Bootboot plugin Ruby source.

The source contains the following gems matching 'Ruby':
  * Ruby-3.0.5
Skipants commented 1 year ago

I see it as well.

Our Gemfile has the following:

plugin('bootboot', '~> 0.2')
Plugin.send(:load_plugin, 'bootboot') if Plugin.installed?('bootboot')

# Rails
if %w[1 true].include?(ENV['DEPENDENCIES_NEXT'])
  enable_dual_booting if Plugin.installed?('bootboot')
  ruby('3.2.1')
  gem 'rails', '~> 7.0.4'
else
  ruby('3.1.3')
  gem 'rails', '~> 6.1.6'
end

When I run bundle the first time around on Ruby 3.1.3 I get the error:

Could not find gem 'Ruby (= 3.1.3)' in Bootboot plugin Ruby source.

The source contains the following gems matching 'Ruby':
  * Ruby-3.2.1

On the second pass there's no error but Gemfile_next.lock is not updated. I have to manually change ruby to ruby-3.2.1 and do DEPENDENCIES_NEXT=1 bundle

Here's my bundler env:

Bundler       2.3.26
  Platforms   ruby, arm64-darwin-21
Ruby          3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498) [arm64-darwin-21]
  Full Path   /Users/andrewszczepanski/.rbenv/versions/3.1.3/bin/ruby
  Config Dir  /Users/andrewszczepanski/.rbenv/versions/3.1.3/etc
RubyGems      3.3.26
  Gem Home    /Users/andrewszczepanski/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0
  Gem Path    /Users/andrewszczepanski/.gem/ruby/3.1.0:/Users/andrewszczepanski/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0
  User Home   /Users/andrewszczepanski
  User Path   /Users/andrewszczepanski/.gem/ruby/3.1.0
  Bin Dir     /Users/andrewszczepanski/.rbenv/versions/3.1.3/bin
Tools
  Git         2.38.1
  RVM         not installed
  rbenv       rbenv 1.2.0
  chruby      not installed

I tried to clone bootboot and use the plugin locally so I could catch this and reproduce, but no luck there. Maybe something with bundler caching something? That's my best guess right now. Going to continue trying locally and see if I can isolate it when I get a chance.