Class: Gem::Commands::WebCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
VersionOption
Defined in:
lib/rubygems/commands/web_command.rb

Instance Method Summary collapse

Constructor Details

#initializeWebCommand

Returns a new instance of WebCommand.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubygems/commands/web_command.rb', line 6

def initialize
  super 'web', "Open the gem's homepage",
    :command => nil,
    :version=>  Gem::Web::VERSION,
    :latest=>   false

  add_option("-g", "--github", "Open github page of gem, this searches all urls for a github page. This is the default.") do |v|
    options[:github] = v
  end
  add_option("-c", "--sourcecode", "Open sourcecode gem") do |v|
    options[:sourcecode] = v
  end
  add_option("-d", "--doc", "Open documentation of gem") do |v|
    options[:doc] = v
  end
  add_option("-w", "--webpage", "Open webpage of gem") do |v|
    options[:webpage] = v
  end
  add_option("-r", "--rubygems", "Open the rubygems page of a gem") do |v|
    options[:rubygems] = v
  end
  add_option("-t", "--rubytoolbox", "Open the ruby toolbox page of a gem") do |v|
    options[:rubytoolbox] = v
  end
end

Instance Method Details

#argumentsObject



32
33
34
# File 'lib/rubygems/commands/web_command.rb', line 32

def arguments
  "GEMNAME       gem to open the webpage for"
end

#executeObject



40
41
42
# File 'lib/rubygems/commands/web_command.rb', line 40

def execute
  Gem::Web::Executor.new.open_page(get_one_optional_argument, options)
end

#usageObject



36
37
38
# File 'lib/rubygems/commands/web_command.rb', line 36

def usage
  "[GEMNAME]"
end