Module: Gem::BundlerVersionFinder

Defined in:
lib/rubygems/bundler_version_finder.rb

Class Method Summary collapse

Class Method Details

.bundler_versionObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rubygems/bundler_version_finder.rb', line 4

def self.bundler_version
  v = ENV["BUNDLER_VERSION"]

  v ||= bundle_update_bundler_version
  return if v == true

  v ||= lockfile_version
  return unless v

  Gem::Version.new(v)
end

.prioritize!(specs) ⇒ Object



16
17
18
19
20
21
# File 'lib/rubygems/bundler_version_finder.rb', line 16

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