gem-check 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/gem-check.rb +23 -7
- data/lib/version.rb +1 -1
- data/screenshot-gem-check.png +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0cd75e58071bfb04722ffc292166cb654ea869f
|
4
|
+
data.tar.gz: d9145f2303bf8e2e7752d86d04d6f49b4a239f77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6090011f1a3972b0cd847e55269cd50f40b603f98a3c47e6633c19754f9e6c3fac45c7bbf9cbd141ef3ff60a754badf9cb501e05a0c09fe24092ca8684398528
|
7
|
+
data.tar.gz: 2e237ebb9ff07d67eb0f25c44402fe7fc554b292c1aecfb1b6c12f6dbba41bd15407869f9e1041ad89dc8110946f8b4b0622c9c69cd2e725325402f7a100c648
|
data/README.md
CHANGED
data/lib/gem-check.rb
CHANGED
@@ -5,16 +5,32 @@ require 'terminal-table'
|
|
5
5
|
require_relative 'version'
|
6
6
|
|
7
7
|
module GemCheck
|
8
|
-
|
9
|
-
|
8
|
+
HEADINGS = ['Gem Name', 'Version', 'Downloads', 'Total']
|
9
|
+
|
10
|
+
def commafy(x)
|
11
|
+
i,d = x.to_s.split('.')
|
12
|
+
i.gsub(/(\d)(?=\d{3}+$)/,'\\1,') + (d ? ('.'+d) : '')
|
13
|
+
end
|
14
|
+
|
15
|
+
def gem_info
|
16
|
+
Gems.gems.map do |x|
|
10
17
|
x = OpenStruct.new(x)
|
11
|
-
[x.name, x.version, x.version_downloads, x.downloads]
|
18
|
+
[x.name, x.version, commafy(x.version_downloads), commafy(x.downloads)]
|
12
19
|
end
|
13
|
-
|
20
|
+
end
|
14
21
|
|
22
|
+
def build_table
|
23
|
+
rows = gem_info.sort!{|a, b| b[2].to_i <=> a[2].to_i}
|
15
24
|
table = Terminal::Table.new(rows: rows)
|
16
|
-
table.headings =
|
17
|
-
[1
|
18
|
-
|
25
|
+
table.headings = GemCheck::HEADINGS
|
26
|
+
[1].each{ |col| table.align_column(col, :center) }
|
27
|
+
[2,3].each{ |col| table.align_column(col, :right) }
|
28
|
+
table
|
29
|
+
end
|
30
|
+
|
31
|
+
def print_table
|
32
|
+
puts
|
33
|
+
puts build_table
|
34
|
+
puts
|
19
35
|
end
|
20
36
|
end
|
data/lib/version.rb
CHANGED
data/screenshot-gem-check.png
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meissa Dia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gems
|