diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-08 14:19:04 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-05-13 07:54:37 +0900 |
commit | 0e60b59d5884edb8f9aea023efd9b24f1ff02049 (patch) | |
tree | e52935ce510440872ca5ce6b0e092cbc94f18bc9 /lib/bundler/lazy_specification.rb | |
parent | 68224651a4d4dc3ce0cea666f5423dd8b6ba6cfc (diff) |
Update the bundler version with master branch
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3086
Diffstat (limited to 'lib/bundler/lazy_specification.rb')
-rw-r--r-- | lib/bundler/lazy_specification.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 32c8bb9557..a6aeb16648 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -46,6 +46,14 @@ module Bundler identifier == other.identifier end + def eql?(other) + identifier.eql?(other.identifier) + end + + def hash + identifier.hash + end + def satisfies?(dependency) @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version)) end @@ -72,8 +80,13 @@ module Bundler @specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name source.gemspec.tap {|s| s.source = source } else - search = source.specs.search(search_object).last - if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty? + platform_object = Gem::Platform.new(platform) + candidates = source.specs.search(search_object) + same_platform_candidates = candidates.select do |spec| + MatchPlatform.platforms_match?(spec.platform, platform_object) + end + search = same_platform_candidates.last || candidates.last + if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty? Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \ "because it has different dependencies from the #{platform} version. " \ "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again." |