Class: Gem::Commands::HomeCommand

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

Instance Method Summary collapse

Constructor Details

#initializeHomeCommand

Returns a new instance of HomeCommand.



3
4
5
# File 'lib/rubygems/commands/home_command.rb', line 3

def initialize
  super 'home', "Open a gem's homepage"
end

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rubygems/commands/home_command.rb', line 7

def execute
  require "rubygems/home/spec_loader"
  require "rubygems/home/browser"

  name = get_one_gem_name
  link = ::Gem::Home::SpecLoader.get_home_url(name)
  if link
    ::Gem::Home::Browser.open_link(link)
  else
    puts "We did our best, but there are no links for this gem"
    exit 1
  end
end