gem-stats 1.0.5 → 1.0.6
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 +12 -10
- data/lib/rubygems/commands/stats_command.rb +49 -38
- metadata +14 -19
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# gem-stats
|
2
2
|
|
3
|
-
View
|
3
|
+
View authors, dependencies, etc for rubygems.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,21 +10,23 @@ View stastics for any gem.
|
|
10
10
|
|
11
11
|
> gem stats sinatra
|
12
12
|
|
13
|
-
sinatra by Blake Mizerany
|
14
|
-
http://
|
13
|
+
sinatra by Blake Mizerany, Ryan Tomayko, Simon Rozet
|
14
|
+
http://rubygems.org/gems/sinatra
|
15
15
|
|
16
|
-
Total Downloads
|
17
|
-
Version Downloads
|
18
|
-
Current Version 0
|
16
|
+
Total Downloads 120277
|
17
|
+
Version Downloads 50868
|
18
|
+
Current Version 1.0
|
19
19
|
|
20
20
|
Runtime Dependencies
|
21
|
-
rack >= 0
|
22
|
-
shotgun >= 0.2, < 1.0
|
23
|
-
rack-test >= 0.3.0
|
21
|
+
rack >= 1.0
|
24
22
|
|
25
23
|
Development Dependencies
|
26
|
-
|
24
|
+
less >= 0
|
25
|
+
erubis >= 0
|
26
|
+
builder >= 0
|
27
|
+
haml >= 0
|
27
28
|
rack-test >= 0.3.0
|
29
|
+
shotgun >= 0.6, < 1.0
|
28
30
|
|
29
31
|
## Copyright
|
30
32
|
|
@@ -3,7 +3,7 @@ require 'json'
|
|
3
3
|
|
4
4
|
class Gem::Commands::StatsCommand < Gem::Command
|
5
5
|
def initialize
|
6
|
-
super 'stats', 'View
|
6
|
+
super 'stats', 'View authors, dependencies, etc for rubygems'
|
7
7
|
end
|
8
8
|
|
9
9
|
def arguments
|
@@ -14,50 +14,61 @@ class Gem::Commands::StatsCommand < Gem::Command
|
|
14
14
|
"#{program_name} [gem-name]"
|
15
15
|
end
|
16
16
|
|
17
|
+
def get_stats gem
|
18
|
+
begin
|
19
|
+
open "http://rubygems.org/api/v1/gems/#{gem}.json" do |results|
|
20
|
+
JSON.parse(results.read)
|
21
|
+
end
|
22
|
+
rescue OpenURI::HTTPError
|
23
|
+
puts "Whoops, seems as if that gem doesn't exist!"
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def sexify dependencies
|
29
|
+
lengths = []
|
30
|
+
dependencies.each do |dependency|
|
31
|
+
lengths.push(dependency['name'].length)
|
32
|
+
end
|
33
|
+
|
34
|
+
dependencies.each do |dependency|
|
35
|
+
name = dependency['name']
|
36
|
+
req = dependency['requirements']
|
37
|
+
space = ' '
|
38
|
+
|
39
|
+
(lengths.max - name.length).times do |x|
|
40
|
+
space += ' '
|
41
|
+
end
|
42
|
+
|
43
|
+
puts "#{name + space}\e[33m#{req}\e[0m"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
17
47
|
def execute
|
18
48
|
begin
|
19
49
|
gem = get_one_gem_name
|
20
50
|
rescue Gem::CommandLineError
|
21
|
-
puts 'Please specify a gem name (e.g. gem stats sinatra).'
|
51
|
+
puts 'Please specify a gem name (e.g. `gem stats sinatra`).'
|
22
52
|
exit
|
23
53
|
end
|
24
54
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts 'Runtime Dependencies'
|
43
|
-
stats['dependencies']['runtime'].each do |dependency|
|
44
|
-
puts dependency['name'] + ' ' + dependency['requirements']
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
unless stats['dependencies']['development'].empty?
|
49
|
-
puts ''
|
50
|
-
|
51
|
-
puts 'Development Dependencies'
|
52
|
-
stats['dependencies']['development'].each do |dependency|
|
53
|
-
puts dependency['name'] + ' ' + dependency['requirements']
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
rescue OpenURI::HTTPError
|
59
|
-
puts "Whoops, seems as if that gem doesn't exist!"
|
60
|
-
exit
|
55
|
+
stats = get_stats(gem)
|
56
|
+
|
57
|
+
puts "#{stats['name']} by #{stats['authors']}"
|
58
|
+
puts "\e[34m#{stats['project_uri']}\e[0m\n\n"
|
59
|
+
|
60
|
+
puts "Total Downloads \e[32m#{stats['downloads'].to_s}\e[0m"
|
61
|
+
puts "Version Downloads \e[32m#{stats['version_downloads'].to_s}\e[0m"
|
62
|
+
puts "Current Version \e[32m#{stats['version']}\e[0m"
|
63
|
+
|
64
|
+
unless stats['dependencies']['runtime'].empty?
|
65
|
+
puts "\nRuntime Dependencies"
|
66
|
+
sexify(stats['dependencies']['runtime'])
|
67
|
+
end
|
68
|
+
|
69
|
+
unless stats['dependencies']['development'].empty?
|
70
|
+
puts "\nDevelopment Dependencies"
|
71
|
+
sexify(stats['dependencies']['development'])
|
61
72
|
end
|
62
73
|
end
|
63
74
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Danny Tatom
|
@@ -14,34 +15,24 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-06-23 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
+
name: contest
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
30
33
|
type: :development
|
31
34
|
version_requirements: *id001
|
32
|
-
|
33
|
-
name: contest
|
34
|
-
prerelease: false
|
35
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
segments:
|
40
|
-
- 0
|
41
|
-
version: "0"
|
42
|
-
type: :development
|
43
|
-
version_requirements: *id002
|
44
|
-
description: View statistics for given gems.
|
35
|
+
description: View authors, dependencies, etc for rubygems.
|
45
36
|
email: dannytatom@gmail.com
|
46
37
|
executables: []
|
47
38
|
|
@@ -64,25 +55,29 @@ rdoc_options: []
|
|
64
55
|
require_paths:
|
65
56
|
- lib
|
66
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
67
59
|
requirements:
|
68
60
|
- - ">="
|
69
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
70
63
|
segments:
|
71
64
|
- 0
|
72
65
|
version: "0"
|
73
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
74
68
|
requirements:
|
75
69
|
- - ">="
|
76
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
77
72
|
segments:
|
78
73
|
- 0
|
79
74
|
version: "0"
|
80
75
|
requirements: []
|
81
76
|
|
82
77
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.3.
|
78
|
+
rubygems_version: 1.3.7
|
84
79
|
signing_key:
|
85
80
|
specification_version: 3
|
86
|
-
summary: View
|
81
|
+
summary: View authors, dependencies, etc for rubygems.
|
87
82
|
test_files: []
|
88
83
|
|