show_gem 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +48 -0
- data/Rakefile +30 -0
- data/lib/rubygems/commands/show.rb +51 -0
- data/lib/rubygems_plugin.rb +6 -0
- data/test/test_helper.rb +3 -0
- data/test/test_show_gem.rb +11 -0
- metadata +79 -0
data/README.rdoc
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= show_gem
|
2
|
+
|
3
|
+
* http://github.com/#{github_username}/#{project_name}
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
FIX (describe your package)
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* FIX (list of features or problems)
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
FIX (code sample of usage)
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* FIX (list of requirements)
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2009 FIXME full name
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |s|
|
7
|
+
s.name = "show_gem"
|
8
|
+
s.summary = "Gem Command to easily display information about a ruby gem."
|
9
|
+
s.description = <<-DESC
|
10
|
+
Shows information about a gem, fetched from the Gemcutter site.
|
11
|
+
DESC
|
12
|
+
s.version = '0.0.1'
|
13
|
+
s.email = "bjorn.maeland@gmail.com"
|
14
|
+
s.homepage = "http://github.com/bmaland/show_gem"
|
15
|
+
s.rubyforge_project = "showgem"
|
16
|
+
s.authors = ["Bjørn Arild Mæland"]
|
17
|
+
s.has_rdoc = false
|
18
|
+
s.files = FileList["[A-Z]*", "{bin,lib,test}/**/*"]
|
19
|
+
|
20
|
+
s.add_dependency 'json_pure', '>= 1.2.0'
|
21
|
+
s.add_dependency 'gemcutter', '>= 0.2.1'
|
22
|
+
|
23
|
+
# Testing
|
24
|
+
s.test_files = FileList["test/**/*_test.rb"]
|
25
|
+
#s.add_development_dependency 'mocha', '~> 0.9.5'
|
26
|
+
end
|
27
|
+
|
28
|
+
rescue LoadError
|
29
|
+
puts "Jeweler not available. Install it for jeweler-related tasks with: sudo gem install jeweler"
|
30
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class Gem::Commands::ShowCommand < Gem::AbstractCommand
|
2
|
+
|
3
|
+
attr_reader :rubygem
|
4
|
+
|
5
|
+
def description
|
6
|
+
'Display detailed information about a gem'
|
7
|
+
end
|
8
|
+
|
9
|
+
def arguments
|
10
|
+
"GEM gem to show"
|
11
|
+
end
|
12
|
+
|
13
|
+
def usage
|
14
|
+
"#{program_name} GEM"
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
super 'show', description
|
19
|
+
add_proxy_option
|
20
|
+
end
|
21
|
+
|
22
|
+
def execute
|
23
|
+
setup
|
24
|
+
show_gem
|
25
|
+
end
|
26
|
+
|
27
|
+
def show_gem
|
28
|
+
find(get_one_gem_name)
|
29
|
+
rubygem.keys.sort.each { |k| puts "#{k.upcase}: #{rubygem[k]}" }
|
30
|
+
end
|
31
|
+
|
32
|
+
def find(name)
|
33
|
+
require 'json/pure'
|
34
|
+
|
35
|
+
response = make_request(:get, "gems/#{name}.json")
|
36
|
+
|
37
|
+
case response
|
38
|
+
when Net::HTTPSuccess
|
39
|
+
begin
|
40
|
+
@rubygem = JSON.parse(response.body)
|
41
|
+
rescue JSON::ParserError => json_error
|
42
|
+
say "There was a problem parsing the data: #{json_error}"
|
43
|
+
terminate_interaction
|
44
|
+
end
|
45
|
+
else
|
46
|
+
say "This gem is currently not hosted on Gemcutter."
|
47
|
+
terminate_interaction
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: show_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "Bj\xC3\xB8rn Arild M\xC3\xA6land"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-23 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: json_pure
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: gemcutter
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.1
|
34
|
+
version:
|
35
|
+
description: " Shows information about a gem, fetched from the Gemcutter site.\n"
|
36
|
+
email: bjorn.maeland@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- README.rdoc
|
45
|
+
- Rakefile
|
46
|
+
- lib/rubygems/commands/show.rb
|
47
|
+
- lib/rubygems_plugin.rb
|
48
|
+
- test/test_helper.rb
|
49
|
+
- test/test_show_gem.rb
|
50
|
+
has_rdoc: false
|
51
|
+
homepage: http://github.com/bmaland/show_gem
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- --charset=UTF-8
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
requirements: []
|
72
|
+
|
73
|
+
rubyforge_project: showgem
|
74
|
+
rubygems_version: 1.3.5
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: Gem Command to easily display information about a ruby gem.
|
78
|
+
test_files: []
|
79
|
+
|