~ubuntu-branches/ubuntu/trusty/jruby/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/ruby/1.9/rubygems/commands/server_command.rb

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Delafond
  • Date: 2009-12-10 12:34:42 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091210123442-df7t1v36qtfkj5df
Tags: 1.4.0-1
* New upstream release.
* Updated watch file.
* Updated copyright file to reflect addition of new third-party jars.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'rubygems/command'
2
 
require 'rubygems/server'
3
 
 
4
 
class Gem::Commands::ServerCommand < Gem::Command
5
 
 
6
 
  def initialize
7
 
    super 'server', 'Documentation and gem repository HTTP server',
8
 
          :port => 8808, :gemdir => Gem.dir, :daemon => false
9
 
 
10
 
    add_option '-p', '--port=PORT', Integer,
11
 
               'port to listen on' do |port, options|
12
 
      options[:port] = port
13
 
    end
14
 
 
15
 
    add_option '-d', '--dir=GEMDIR',
16
 
               'directory from which to serve gems' do |gemdir, options|
17
 
      options[:gemdir] = File.expand_path gemdir
18
 
    end
19
 
 
20
 
    add_option '--[no-]daemon', 'run as a daemon' do |daemon, options|
21
 
      options[:daemon] = daemon
22
 
    end
23
 
  end
24
 
 
25
 
  def defaults_str # :nodoc:
26
 
    "--port 8808 --dir #{Gem.dir} --no-daemon"
27
 
  end
28
 
 
29
 
  def description # :nodoc:
30
 
    <<-EOF
31
 
The server command starts up a web server that hosts the RDoc for your
32
 
installed gems and can operate as a server for installation of gems on other
33
 
machines.
34
 
 
35
 
The cache files for installed gems must exist to use the server as a source
36
 
for gem installation.
37
 
 
38
 
To install gems from a running server, use `gem install GEMNAME --source
39
 
http://gem_server_host:8808`
40
 
    EOF
41
 
  end
42
 
 
43
 
  def execute
44
 
    Gem::Server.run options
45
 
  end
46
 
 
47
 
end
48