diff options
-rw-r--r-- | lib/rubygems/server.rb | 192 |
1 files changed, 188 insertions, 4 deletions
@@ -17,6 +17,7 @@ require 'rubygems/doc_manager' # name/version/platform index # * "/quick/" - Individual gemspecs # * "/gems" - Direct access to download the installable gems # * legacy indexes: # * "/Marshal.#{Gem.marshal_version}" - Full SourceIndex dump of metadata # for installed gems @@ -32,9 +33,20 @@ require 'rubygems/doc_manager' class Gem::Server include Gem::UserInteraction - DOC_TEMPLATE = <<-'WEBPAGE' <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" @@ -47,6 +59,7 @@ class Gem::Server </head> <body> <div id="fileHeader"> <h1>RubyGems Documentation Index</h1> </div> <!-- banner header --> @@ -114,10 +127,10 @@ class Gem::Server </div> </body> </html> - WEBPAGE # CSS is copy & paste from rdoc-style.css, RDoc V1.0.1 - 20041108 - RDOC_CSS = <<-RDOCCSS body { font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 90%; @@ -325,7 +338,92 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } .ruby-comment { color: #b22222; font-weight: bold; background: transparent; } .ruby-regexp { color: #ffa07a; background: transparent; } .ruby-value { color: #7fffd4; background: transparent; } - RDOCCSS def self.run(options) new(options[:gemdir], options[:port], options[:daemon]).run @@ -533,6 +631,90 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } res.body = result end def run @server.listen nil, @port @@ -564,6 +746,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } @server.mount_proc "/", method(:root) paths = { "/gems" => "/cache/", "/doc_root" => "/doc/" } paths.each do |mount_point, mount_dir| @server.mount(mount_point, WEBrick::HTTPServlet::FileHandler, |