mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix gem install
vs gem fetch
inconsistency
https://github.com/rubygems/rubygems/commit/b3e985799e
This commit is contained in:
parent
9fc7ea64a1
commit
c5224c71ae
3 changed files with 49 additions and 9 deletions
|
@ -60,7 +60,7 @@ then repackaging it.
|
|||
specs_and_sources = filtered unless filtered.empty?
|
||||
end
|
||||
|
||||
spec, source = specs_and_sources.max_by {|s,| s.version }
|
||||
spec, source = specs_and_sources.max_by {|s,| s }
|
||||
|
||||
if spec.nil?
|
||||
show_lookup_failure gem_name, version, errors, options[:domain]
|
||||
|
|
|
@ -1072,19 +1072,23 @@ Also, a list:
|
|||
@fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip
|
||||
@fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
|
||||
|
||||
v = Gem.marshal_version
|
||||
|
||||
all_specs.each do |spec|
|
||||
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
|
||||
data = Marshal.dump spec
|
||||
data_deflate = Zlib::Deflate.deflate data
|
||||
@fetcher.data[path] = data_deflate
|
||||
end
|
||||
write_marshalled_gemspecs(*all_specs)
|
||||
end
|
||||
|
||||
nil # force errors
|
||||
end
|
||||
|
||||
def write_marshalled_gemspecs(*all_specs)
|
||||
v = Gem.marshal_version
|
||||
|
||||
all_specs.each do |spec|
|
||||
path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
|
||||
data = Marshal.dump spec
|
||||
data_deflate = Zlib::Deflate.deflate data
|
||||
@fetcher.data[path] = data_deflate
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Deflates +data+
|
||||
|
||||
|
|
|
@ -79,6 +79,42 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|||
"#{a2.full_name} not fetched")
|
||||
end
|
||||
|
||||
def test_execute_platform
|
||||
a2_spec, a2 = util_gem("a", "2")
|
||||
|
||||
a2_universal_darwin_spec, a2_universal_darwin = util_gem("a", "2") do |s|
|
||||
s.platform = 'universal-darwin'
|
||||
end
|
||||
|
||||
Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
|
||||
|
||||
write_marshalled_gemspecs(a2_spec, a2_universal_darwin_spec)
|
||||
|
||||
@cmd.options[:args] = %w[a]
|
||||
|
||||
@fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = util_gzip(Marshal.dump([
|
||||
Gem::NameTuple.new(a2_spec.name, a2_spec.version, a2_spec.platform),
|
||||
Gem::NameTuple.new(a2_universal_darwin_spec.name, a2_universal_darwin_spec.version, a2_universal_darwin_spec.platform),
|
||||
]))
|
||||
|
||||
@fetcher.data["#{@gem_repo}gems/#{a2_spec.file_name}"] = Gem.read_binary(a2)
|
||||
FileUtils.cp a2, a2_spec.cache_file
|
||||
|
||||
@fetcher.data["#{@gem_repo}gems/#{a2_universal_darwin_spec.file_name}"] = Gem.read_binary(a2_universal_darwin)
|
||||
FileUtils.cp a2_universal_darwin, a2_universal_darwin_spec.cache_file
|
||||
|
||||
util_set_arch 'arm64-darwin20' do
|
||||
use_ui @ui do
|
||||
Dir.chdir @tempdir do
|
||||
@cmd.execute
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert_path_exist(File.join(@tempdir, a2_universal_darwin_spec.file_name),
|
||||
"#{a2_universal_darwin_spec.full_name} not fetched")
|
||||
end
|
||||
|
||||
def test_execute_specific_prerelease
|
||||
specs = spec_fetcher do |fetcher|
|
||||
fetcher.gem 'a', 2
|
||||
|
|
Loading…
Add table
Reference in a new issue