diff options
Diffstat (limited to 'lib/rubygems/indexer/master_index_builder.rb')
-rw-r--r-- | lib/rubygems/indexer/master_index_builder.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/rubygems/indexer/master_index_builder.rb b/lib/rubygems/indexer/master_index_builder.rb index dbe02370a9..669ea5a1df 100644 --- a/lib/rubygems/indexer/master_index_builder.rb +++ b/lib/rubygems/indexer/master_index_builder.rb @@ -1,6 +1,8 @@ require 'rubygems/indexer' +## # Construct the master Gem index file. + class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder def start_index @@ -10,6 +12,7 @@ class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder def end_index super + @file.puts "--- !ruby/object:#{@index.class}" @file.puts "gems:" @@ -28,11 +31,9 @@ class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder index_file_name = File.join @directory, @filename compress index_file_name, "Z" - compressed_file_name = "#{index_file_name}.Z" - - paranoid index_file_name, compressed_file_name + paranoid index_file_name, "#{index_file_name}.Z" - @files << compressed_file_name + @files << "#{@filename}.Z" end def add(spec) @@ -41,12 +42,12 @@ class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder private - def paranoid(fn, compressed_fn) - data = File.open(fn, 'rb') do |fp| fp.read end - compressed_data = File.open(compressed_fn, 'rb') do |fp| fp.read end + def paranoid(path, compressed_path) + data = Gem.read_binary path + compressed_data = Gem.read_binary compressed_path if data != unzip(compressed_data) then - fail "Compressed file #{compressed_fn} does not match uncompressed file #{fn}" + raise "Compressed file #{compressed_path} does not match uncompressed file #{path}" end end |