gem-whois 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # gem-whois
2
+
3
+ Show information about the owner of a gem.
4
+
5
+ ## Installation
6
+
7
+ $ gem install gem-whois
8
+
9
+ Usage
10
+
11
+ $ gem whois gem-whois
12
+
13
+ ** INSERT EXAMPLE HERE **
14
+
15
+ == License
16
+
17
+ MIT
18
+
19
+ == Copyright
20
+
21
+ Copyright (c) 2009 David Dollar. See LICENSE for details.
@@ -0,0 +1,37 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/command_manager'
3
+ require 'rubygems/uninstaller'
4
+ require 'crack'
5
+ require 'rest-client'
6
+
7
+ class Gem::Commands::WhoisCommand < Gem::Command
8
+
9
+ VERSION = "0.2"
10
+
11
+ def initialize
12
+ super 'whois', 'Show information about the owner of a gem'
13
+ end
14
+
15
+ def execute
16
+ name = get_one_gem_name
17
+ Gem.sources.each { |source| whois_from_source(name, source) }
18
+ rescue Exception => ex
19
+ puts "Unhandled Exception: #{ex.class} #{ex.message}"
20
+ end
21
+
22
+ private ######################################################################
23
+
24
+ def whois_from_source(name, source)
25
+ info = Crack::JSON.parse(RestClient.get([source, "api/v1/gems/#{name}.json"].join))
26
+ say "%s (%s)" % [ info["name"], info["version"] ]
27
+ say
28
+ say info["info"]
29
+ say
30
+ say "author(s) : %s" % info["authors"]
31
+ say "downloads : %s" % info["downloads"]
32
+ say "homepage : %s" % info["homepage_uri"]
33
+ rescue RestClient::ResourceNotFound
34
+ say "%s not found in source %s" % [name, source]
35
+ end
36
+
37
+ end
@@ -0,0 +1,2 @@
1
+ require 'gem/commands/whois_command'
2
+ Gem::CommandManager.instance.register_command :whois
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-whois
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ version: "0.2"
10
+ platform: ruby
11
+ authors:
12
+ - David Dollar
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-16 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email: <ddollar@gmail.com>
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.md
29
+ files:
30
+ - lib/gem/commands/whois_command.rb
31
+ - lib/rubygems_plugin.rb
32
+ - README.md
33
+ has_rdoc: true
34
+ homepage: http://github.com/ddollar/gem-whois
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --charset=UTF-8
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Show information about the owner of a gem
67
+ test_files: []
68
+