Class Gem::Commands::ServerCommand
In: lib/rubygems/commands/server_command.rb
Parent: Gem::Command

Methods

execute   new  

Public Class methods

[Source]

    # File lib/rubygems/commands/server_command.rb, line 6
 6:   def initialize
 7:     super 'server', 'Documentation and gem repository HTTP server',
 8:           :port => 8808, :gemdir => Gem.dir, :daemon => false
 9: 
10:     OptionParser.accept :Port do |port|
11:       if port =~ /\A\d+\z/ then
12:         port = Integer port
13:         raise OptionParser::InvalidArgument, "#{port}: not a port number" if
14:           port > 65535
15: 
16:         port
17:       else
18:         begin
19:           Socket.getservbyname port
20:         rescue SocketError => e
21:           raise OptionParser::InvalidArgument, "#{port}: no such named service"
22:         end
23:       end
24:     end
25: 
26:     add_option '-p', '--port=PORT', :Port,
27:                'port to listen on' do |port, options|
28:       options[:port] = port
29:     end
30: 
31:     add_option '-d', '--dir=GEMDIR',
32:                'directory from which to serve gems' do |gemdir, options|
33:       options[:gemdir] = File.expand_path gemdir
34:     end
35: 
36:     add_option '--[no-]daemon', 'run as a daemon' do |daemon, options|
37:       options[:daemon] = daemon
38:     end
39:   end

Public Instance methods

[Source]

    # File lib/rubygems/commands/server_command.rb, line 66
66:   def execute
67:     Gem::Server.run options
68:   end

[Validate]