Class: Gem::Commands::VisitCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::VisitCommand
- Includes:
- VersionOption, GemToolbox::CommonOptions
- Defined in:
- lib/rubygems/commands/visit_command.rb
Overview
VisitCommand opens the gem’s homepage in a browser
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
- #execute ⇒ Object
-
#initialize ⇒ VisitCommand
constructor
A new instance of VisitCommand.
Methods included from GemToolbox::CommonOptions
#add_command_option, #add_exact_match_option, #add_latest_version_option, #get_path, #get_spec, #show
Constructor Details
#initialize ⇒ VisitCommand
Returns a new instance of VisitCommand.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubygems/commands/visit_command.rb', line 9 def initialize super "readme", "Visit gem's homepage in a browser", :command => nil, :version => Gem::Requirement.default, :latest => false add_latest_version_option add_exact_match_option add_version_option end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
20 21 22 |
# File 'lib/rubygems/commands/visit_command.rb', line 20 def arguments # :nodoc: "GEMNAME Gem to visit" end |
#execute ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rubygems/commands/visit_command.rb', line 24 def execute name = get_one_gem_name spec = get_spec(name) if spec.homepage #Launchy::Browser.run(spec.homepage) Launchy.open(spec.homepage) else say "Homepage not defined for #{name}" end end |