###################################################################### # This file is imported from the rubygems project. # DO NOT make modifications in this repo. They _will_ be reverted! # File a patch instead and assign it to Ryan Davis or Eric Hodel. ###################################################################### require 'webrick' require 'zlib' require 'erb' require 'rubygems' require 'rubygems/doc_manager' ## # Gem::Server and allows users to serve gems for consumption by # `gem --remote-install`. # # gem_server starts an HTTP server on the given port and serves the following: # * "/" - Browsing of gem spec files for installed gems # * "/specs.#{Gem.marshal_version}.gz" - specs name/version/platform index # * "/latest_specs.#{Gem.marshal_version}.gz" - latest specs # name/version/platform index # * "/quick/" - Individual gemspecs # * "/gems" - Direct access to download the installable gems # * "/rdoc?q=" - Search for installed rdoc documentation # * legacy indexes: # * "/Marshal.#{Gem.marshal_version}" - Full SourceIndex dump of metadata # for installed gems # # == Usage # # gem_server = Gem::Server.new Gem.dir, 8089, false # gem_server.run # #-- # TODO Refactor into a real WEBrick servlet to remove code duplication. class Gem::Server attr_reader :spec_dirs include ERB::Util include Gem::UserInteraction SEARCH = <<-SEARCH
SEARCH DOC_TEMPLATE = <<-'DOC_TEMPLATE'There are <%=values["gem_count"]%> gems installed:
<%= values["specs"].map { |v| "#{v["name"]}" }.join ', ' %>.
No gems matched <%= h query.inspect %>
Back to complete gem index
<%=doc_items.length%> documentation topics found.
Back to complete gem index