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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fcdbaeec2e2bba65b79b1ae45953e2fea1bf2ab
4
- data.tar.gz: e151c987b4ba43d66983eaa8ad6821147e8f8b69
3
+ metadata.gz: b0cd75e58071bfb04722ffc292166cb654ea869f
4
+ data.tar.gz: d9145f2303bf8e2e7752d86d04d6f49b4a239f77
5
5
  SHA512:
6
- metadata.gz: dfff712b2fc329e898f5d8def5b191c00e64510b7d6434807838bf566a46b627904c6ac77eca647fa88ace4405c772aa046eca03d3207b0d545268da159877a9
7
- data.tar.gz: e03d4b5639d696ad37d81aadc1411ecd26c3e192b6d0d33ce3f4a1ca63960010d4d68930d93916a31fbd379c79e8a8a3db8e230e230d0386eb5c6d0658c78d3b
6
+ metadata.gz: 6090011f1a3972b0cd847e55269cd50f40b603f98a3c47e6633c19754f9e6c3fac45c7bbf9cbd141ef3ff60a754badf9cb501e05a0c09fe24092ca8684398528
7
+ data.tar.gz: 2e237ebb9ff07d67eb0f25c44402fe7fc554b292c1aecfb1b6c12f6dbba41bd15407869f9e1041ad89dc8110946f8b4b0622c9c69cd2e725325402f7a100c648
data/README.md CHANGED
@@ -16,8 +16,8 @@ $ gem-check
16
16
  ![gem-check](./screenshot-gem-check.png)
17
17
 
18
18
  ## Dependencies
19
- gems ~> 0.8.3
20
- terminal-table ~> 1.6.0
19
+ gems ~> 0.8.3
20
+ terminal-table ~> 1.6
21
21
 
22
22
  ## Contributing
23
23
 
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
- def print_table
9
- rows = Gems.gems.map do |x|
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
- rows.sort!{|a, b| b[2] <=> a[2]}
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 = ['Gem Name', 'Version', 'Downloads', 'Total']
17
- [1,2,3].each{ |col| table.align_column(col, :center) }
18
- puts table
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
@@ -1,3 +1,3 @@
1
1
  module GemCheck
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-07-25 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gems