module Gem::BundlerVersionFinder
Public Class Methods
# File lib/rubygems/bundler_version_finder.rb, line 6 def self.bundler_version bcv = bundle_config_version return if bcv == "system" v = ENV["BUNDLER_VERSION"] v = nil if v&.empty? v ||= bundle_update_bundler_version return if v == true v ||= bcv unless bcv == "lockfile" v ||= lockfile_version return unless v # A config file is arbitrary YAML, so BUNDLE_VERSION can be a date, a # mapping, or anything else the parser makes of an unquoted scalar. None # of those name a version, and refusing to prioritize is better than # raising out of every command that resolves bundler by name. return unless Gem::Version.correct?(v) Gem::Version.new(v) end
# File lib/rubygems/bundler_version_finder.rb, line 30 def self.prioritize!(specs) exact_match_index = specs.find_index {|spec| spec.version == bundler_version } return unless exact_match_index specs.unshift(specs.delete_at(exact_match_index)) end