Sha256: 85d3f9c2394661074846ee1c55197422fa59372c9e2c3802a775efac75905811
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
# frozen_string_literal: true require "bootboot/ruby_source" module DefinitionPatch def initialize(wrong_lock, *args) lockfile = if ENV["BOOTBOOT_UPDATING_ALTERNATE_LOCKFILE"] wrong_lock else Bootboot::GEMFILE_NEXT_LOCK end super(lockfile, *args) end end module RubyVersionPatch 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 end module DefinitionSourceRequirementsPatch def source_requirements super.tap do |source_requirements| # Bundler has a hard requirement that Ruby should be in the Metadata # source, so this replaces Ruby's Metadata source with our custom source source = Bootboot::RubySource.new({}) source_requirements[source.ruby_spec_name] = source end end end module SharedHelpersPatch def default_lockfile Bootboot::GEMFILE_NEXT_LOCK end end Bundler::Definition.prepend(DefinitionSourceRequirementsPatch) Bundler::RubyVersion.singleton_class.prepend(RubyVersionPatch) Bundler::Dsl.class_eval do def enable_dual_booting Bundler::Definition.prepend(DefinitionPatch) Bundler::SharedHelpers.singleton_class.prepend(SharedHelpersPatch) Bundler::Settings.prepend(Module.new do def app_cache_path "vendor/cache-next" end end) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootboot-0.2.2 | lib/bootboot/bundler_patch.rb |