зеркало из https://github.com/github/ruby.git
Fix flaky when making materialized specs uniq
Sometimes we'll have an heterogenous array of specs which include `Gem::Specification` objects, which don't define `#identifier`. Let's use `#full_name` consistently.
This commit is contained in:
Родитель
6ad6ae680a
Коммит
a9fd1860dd
|
@ -26,10 +26,6 @@ module Bundler
|
|||
@platform
|
||||
end
|
||||
|
||||
def identifier
|
||||
@__identifier ||= [name, version, platform.to_s]
|
||||
end
|
||||
|
||||
# needed for standalone, load required_paths from local gemspec
|
||||
# after the gem is installed
|
||||
def require_paths
|
||||
|
|
|
@ -20,7 +20,7 @@ module Bundler
|
|||
end
|
||||
|
||||
def full_name
|
||||
if platform == Gem::Platform::RUBY
|
||||
@full_name ||= if platform == Gem::Platform::RUBY
|
||||
"#{@name}-#{@version}"
|
||||
else
|
||||
"#{@name}-#{@version}-#{platform}"
|
||||
|
@ -28,15 +28,15 @@ module Bundler
|
|||
end
|
||||
|
||||
def ==(other)
|
||||
identifier == other.identifier
|
||||
full_name == other.full_name
|
||||
end
|
||||
|
||||
def eql?(other)
|
||||
identifier.eql?(other.identifier)
|
||||
full_name.eql?(other.full_name)
|
||||
end
|
||||
|
||||
def hash
|
||||
identifier.hash
|
||||
full_name.hash
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -129,10 +129,6 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def identifier
|
||||
@__identifier ||= [name, version, platform.to_s]
|
||||
end
|
||||
|
||||
def git_version
|
||||
return unless source.is_a?(Bundler::Source::Git)
|
||||
" #{source.revision[0..6]}"
|
||||
|
|
|
@ -86,7 +86,7 @@ module Bundler
|
|||
send("parse_#{@state}", line)
|
||||
end
|
||||
end
|
||||
@specs = @specs.values.sort_by(&:identifier)
|
||||
@specs = @specs.values.sort_by(&:full_name)
|
||||
rescue ArgumentError => e
|
||||
Bundler.ui.debug(e)
|
||||
raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
|
||||
|
@ -199,7 +199,7 @@ module Bundler
|
|||
@current_spec.source = @current_source
|
||||
@current_source.add_dependency_names(name)
|
||||
|
||||
@specs[@current_spec.identifier] = @current_spec
|
||||
@specs[@current_spec.full_name] = @current_spec
|
||||
elsif spaces.size == 6
|
||||
version = version.split(",").map(&:strip) if version
|
||||
dep = Gem::Dependency.new(name, version)
|
||||
|
|
|
@ -29,12 +29,8 @@ module Bundler
|
|||
@platform = _remote_specification.platform
|
||||
end
|
||||
|
||||
def identifier
|
||||
@__identifier ||= [name, version, @platform.to_s]
|
||||
end
|
||||
|
||||
def full_name
|
||||
if @platform == Gem::Platform::RUBY
|
||||
@full_name ||= if @platform == Gem::Platform::RUBY
|
||||
"#{@name}-#{@version}"
|
||||
else
|
||||
"#{@name}-#{@version}-#{@platform}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче