diff --git a/lib/bootboot/bundler_patch.rb b/lib/bootboot/bundler_patch.rb index f3628c9..5377f20 100644 --- a/lib/bootboot/bundler_patch.rb +++ b/lib/bootboot/bundler_patch.rb @@ -21,7 +21,14 @@ def system # the Gemfile is different from the Ruby version currently running, we # want to write the version specified in `Gemfile` for the current # dependency set to the lock file - Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version || super + requested_ruby_version = Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version + if requested_ruby_version + requirement = Gem::Requirement.new(requested_ruby_version.versions) + # unless it's a requirement for an exact ruby version, we can't substitute it + # as there's a range of potential versions, so don't override in that case + requested_ruby_version = nil unless requirement.exact? + end + requested_ruby_version || super else super end