mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
8cc45aae94
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
35 lines
545 B
Ruby
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
|
|
|