Module: RubyVersionPatch

Defined in:
lib/bootboot/bundler_patch.rb

Instance Method Summary collapse

Instance Method Details

#systemObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bootboot/bundler_patch.rb', line 18

def system
  # Only monkey-patch if we're updating the alternate file
  return super unless ENV["BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE"]

  # Bail out if the Gemfile doesn't specify a Ruby requirement
  requested_ruby = Bundler::Definition.build(Bootboot::GEMFILE, nil, false).ruby_version
  return super unless requested_ruby

  # If the requirement is for an exact Ruby version, we should substitute the
  # system version with the requirement so that it gets written to the lock file
  requirement = Gem::Requirement.new(requested_ruby.versions)
  requirement.exact? ? requested_ruby : super
end