Skip to content

Commit

Permalink
only override version when dual-booting Ruby if exact version specified
Browse files Browse the repository at this point in the history
  • Loading branch information
ashkulz committed Jan 16, 2023
1 parent 6b3e305 commit b48d300
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/bootboot/bundler_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b48d300

Please sign in to comment.