Class: Bundler::GemHelpers::PlatformMatch
- Inherits:
-
Object
- Object
- Bundler::GemHelpers::PlatformMatch
- Defined in:
- lib/bundler/gem_helpers.rb
Class Method Summary collapse
- .cpu_match(spec_platform, user_platform) ⇒ Object
- .os_match(spec_platform, user_platform) ⇒ Object
- .platform_version_match(spec_platform, user_platform) ⇒ Object
- .specificity_score(spec_platform, user_platform) ⇒ Object
Class Method Details
permalink .cpu_match(spec_platform, user_platform) ⇒ Object
[View source]
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/bundler/gem_helpers.rb', line 109 def self.cpu_match(spec_platform, user_platform) if spec_platform.cpu == user_platform.cpu 0 elsif spec_platform.cpu == "arm" && user_platform.cpu.to_s.start_with?("arm") 0 elsif spec_platform.cpu.nil? || spec_platform.cpu == "universal" 1 else 2 end end |
permalink .os_match(spec_platform, user_platform) ⇒ Object
[View source]
101 102 103 104 105 106 107 |
# File 'lib/bundler/gem_helpers.rb', line 101 def self.os_match(spec_platform, user_platform) if spec_platform.os == user_platform.os 0 else 1 end end |
permalink .platform_version_match(spec_platform, user_platform) ⇒ Object
[View source]
121 122 123 124 125 126 127 128 129 |
# File 'lib/bundler/gem_helpers.rb', line 121 def self.platform_version_match(spec_platform, user_platform) if spec_platform.version == user_platform.version 0 elsif spec_platform.version.nil? 1 else 2 end end |
permalink .specificity_score(spec_platform, user_platform) ⇒ Object
[View source]
92 93 94 95 96 97 98 99 |
# File 'lib/bundler/gem_helpers.rb', line 92 def self.specificity_score(spec_platform, user_platform) return -1 if spec_platform == user_platform return 1_000_000 if spec_platform.nil? || spec_platform == Gem::Platform::RUBY || user_platform == Gem::Platform::RUBY os_match(spec_platform, user_platform) + cpu_match(spec_platform, user_platform) * 10 + platform_version_match(spec_platform, user_platform) * 100 end |