1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/rubygems/indexer/latest_index_builder.rb

36 lines
545 B
Ruby
Raw Normal View History

require 'rubygems/indexer'
##
# Construct the latest Gem index file.
class Gem::Indexer::LatestIndexBuilder < Gem::Indexer::AbstractIndexBuilder
def start_index
super
@index = Gem::SourceIndex.new
end
def end_index
super
latest = @index.latest_specs.sort.map { |spec| spec.original_name }
@file.write latest.join("\n")
end
def cleanup
super
compress @file.path
@files.delete 'latest_index' # HACK installed via QuickIndexBuilder :/
end
def add(spec)
@index.add_spec(spec)
end
end