gem-homepage 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ require 'launchy'
2
+ class Gem::Commands::HomepageCommand < Gem::Command
3
+ def description
4
+ "Open the homepage for this gem"
5
+ end
6
+
7
+ def arguments
8
+ "GEM gem's name"
9
+ end
10
+
11
+ def usage
12
+ "#{program_name} GEM"
13
+ end
14
+
15
+ def initialize
16
+ super "homepage", description
17
+ end
18
+
19
+ def execute
20
+ gemname = options[:args].first
21
+ unless gemname
22
+ say "Usage: #{usage}"
23
+ return terminate_interaction
24
+ end
25
+ dep = Gem::Dependency.new(gemname)
26
+ $stderr.puts "Made dep"
27
+ spec = Gem.source_index.search(dep).first
28
+ $stderr.puts "spec: #{spec.inspect}"
29
+ if spec
30
+ $stderr.puts "found a spec"
31
+ Launchy.open(spec.homepage)
32
+ else
33
+ say "The #{gemname.inspect} gem couldn't be found"
34
+ return terminate_interaction
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "rubygems/command_manager"
3
+ require "rubygems/commands/homepage_command"
4
+
5
+ Gem::CommandManager.instance.register_command :homepage
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-homepage
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.2
6
+ platform: ruby
7
+ authors:
8
+ - Tony Doan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-01 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: launchy
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: Open the homepage of a gem
27
+ email:
28
+ - tdoan@tdoan.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - lib/rubygems_plugin.rb
37
+ - lib/rubygems/commands/homepage_command.rb
38
+ homepage: http://github.com/tdoan/gem-homepage
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.7.2
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: Open the homepage of a gem
65
+ test_files: []
66
+