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
drbrain 8cc45aae94 Import RubyGems 1.1.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-31 22:40:06 +00:00

35 lines
545 B
Ruby

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