Module: Bundler::GemHelpers

Included in:
Definition, MatchPlatform, Resolver::SpecGroup
Defined in:
lib/bundler/gem_helpers.rb

Constant Summary

GENERIC_CACHE =

rubocop:disable MutableConstant

{}
GENERICS =
[
  [Gem::Platform.new("java"), Gem::Platform.new("java")],
  [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
  [Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
  [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
  [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
  [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
  [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")]
].freeze

Class Method Summary collapse

Class Method Details

.generic(p) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/bundler/gem_helpers.rb', line 15

def generic(p)
  return p if p == Gem::Platform::RUBY

  GENERIC_CACHE[p] ||= begin
    _, found = GENERICS.find do |match, _generic|
      p.os == match.os && (!match.cpu || p.cpu == match.cpu)
    end
    found || Gem::Platform::RUBY
  end
end

.generic_local_platformObject



27
28
29
# File 'lib/bundler/gem_helpers.rb', line 27

def generic_local_platform
  generic(Gem::Platform.local)
end