Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added "homepage" command.
* The homepage command opens a given gem's homepage in the browser.

Conflicts:

	lib/rubygems_plugin.rb
  • Loading branch information
jakeonrails authored and brockgr committed Mar 23, 2012
1 parent 1be9808 commit a639b53
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/rubygems/commands/homepage_command.rb
@@ -0,0 +1,30 @@
require 'launchy'
# HomepageCommand will open the homepage of a gem in your browser.
class Gem::Commands::HomepageCommand < Gem::Command
include OpenGem::CommonOptions
include Gem::VersionOption

def initialize
super 'homepage', "Opens the gem's homepage.",
:command => nil,
:version=> Gem::Requirement.default,
:latest=> false

add_command_option "Application to view homepage with"
add_latest_version_option
add_version_option
add_exact_match_option
end

def arguments # :nodoc:
"GEMNAME gem whose homepage you want to open"
end

def execute
name = get_one_gem_name
spec = get_spec(name)
Launchy::Browser.run(spec.homepage)
end

end

1 change: 1 addition & 0 deletions lib/rubygems_plugin.rb
Expand Up @@ -10,3 +10,4 @@
Gem::CommandManager.instance.register_command :open
Gem::CommandManager.instance.register_command :read
Gem::CommandManager.instance.register_command :shell
Gem::CommandManager.instance.register_command :homepage

0 comments on commit a639b53

Please sign in to comment.