method

run

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: Server
run() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/server.rb, line 787
  def run
    listen

    WEBrick::Daemon.start if @daemon

    @server.mount_proc "/specs.#{Gem.marshal_version}", method(:specs)
    @server.mount_proc "/specs.#{Gem.marshal_version}.gz", method(:specs)

    @server.mount_proc "/latest_specs.#{Gem.marshal_version}",
                       method(:latest_specs)
    @server.mount_proc "/latest_specs.#{Gem.marshal_version}.gz",
                       method(:latest_specs)

    @server.mount_proc "/prerelease_specs.#{Gem.marshal_version}",
                       method(:prerelease_specs)
    @server.mount_proc "/prerelease_specs.#{Gem.marshal_version}.gz",
                       method(:prerelease_specs)

    @server.mount_proc "/quick/", method(:quick)

    @server.mount_proc("/gem-server-rdoc-style.css") do |req, res|
      res['content-type'] = 'text/css'
      add_date res
      res.body << RDOC_CSS
    end

    @server.mount_proc "/", method(:root)

    @server.mount_proc "/rdoc", method(:rdoc)

    file_handlers = {
      '/gems' => '/cache/',
    }

    if have_rdoc_4_plus? then
      @server.mount '/doc_root', RDoc::Servlet, '/doc_root'
    else
      file_handlers['/doc_root'] = '/doc/'
    end

    @gem_dirs.each do |gem_dir|
      file_handlers.each do |mount_point, mount_dir|
        @server.mount(mount_point, WEBrick::HTTPServlet::FileHandler,
                      File.join(gem_dir, mount_dir), true)
      end
    end

    trap("INT") { @server.shutdown; exit! }
    trap("TERM") { @server.shutdown; exit! }

    launch if @launch

    @server.start
  end
Register or log in to add new notes.