Module: Bundler::GemHelpers
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/bundler/gem_helpers.rb |
Constant Summary
-
GENERICS =
# File 'lib/bundler/gem_helpers.rb', line 6[ [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
-
GENERIC_CACHE =
# File 'lib/bundler/gem_helpers.rb', line 5{ Gem::Platform::RUBY => Gem::Platform::RUBY }
Class Method Summary
- .generic(p) mod_func
- .generic_local_platform mod_func
- .local_platform mod_func
- .platform_specificity_match(spec_platform, user_platform) mod_func
- .same_deps(spec, exemplary_spec) mod_func
- .same_specificity(platform, spec, exemplary_spec) mod_func
- .select_best_platform_match(specs, platform) mod_func
Class Method Details
.generic(p) (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 16
def generic(p) 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_platform (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 26
def generic_local_platform generic(local_platform) end
.local_platform (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 31
def local_platform Bundler.local_platform end
.platform_specificity_match(spec_platform, user_platform) (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 36
def platform_specificity_match(spec_platform, user_platform) spec_platform = Gem::Platform.new(spec_platform) PlatformMatch.specificity_score(spec_platform, user_platform) end
.same_deps(spec, exemplary_spec) (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 101
def same_deps(spec, exemplary_spec) same_runtime_deps = spec.dependencies.sort == exemplary_spec.dependencies.sort return same_runtime_deps unless spec.is_a?(Gem::Specification) && exemplary_spec.is_a?(Gem::Specification) = spec.required_ruby_version == exemplary_spec.required_ruby_version && spec.required_rubygems_version == exemplary_spec.required_rubygems_version same_runtime_deps && end
.same_specificity(platform, spec, exemplary_spec) (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 96
def same_specificity(platform, spec, exemplary_spec) platform_specificity_match(spec.platform, platform) == platform_specificity_match(exemplary_spec.platform, platform) end
.select_best_platform_match(specs, platform) (mod_func)
[ GitHub ]# File 'lib/bundler/gem_helpers.rb', line 43
def select_best_platform_match(specs, platform) matching = specs.select {|spec| spec.match_platform(platform) } exact = matching.select {|spec| spec.platform == platform } return exact if exact.any? sorted_matching = matching.sort_by {|spec| platform_specificity_match(spec.platform, platform) } exemplary_spec = sorted_matching.first sorted_matching.take_while{|spec| same_specificity(platform, spec, exemplary_spec) && same_deps(spec, exemplary_spec) } end