gem-check 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cd38462be68a3f95d24c40ac3750a1384d4452e
4
- data.tar.gz: f8f1c6e79201f42d897004513d6b046d7265ef2d
3
+ metadata.gz: 31e7a891177cd5e3314d2ea3aaad892992746862
4
+ data.tar.gz: b63f82df5f5124a4362a32bcd8d8ae1fc8095e71
5
5
  SHA512:
6
- metadata.gz: 67cfb2c72b1dd273d1058423a84f520764710b60bff70b84d1446b629f17b8cfef8bf0eae2c1f11ab9b167c064314c682f9a03c0f77cf95825e7a78227bc87ef
7
- data.tar.gz: 02627224be8dcb473e01c0f711a28bb5b1583bd292264dc1255e277045f66c403b14dbf994addc0bb365fc30438edbb383d5d2428ace239aff68cad521685ffc
6
+ metadata.gz: c439a7dfc00e4c8df7f7681da59b13138e578c957db65fac691883257ef001c060e664a5e386d31189d4dc8530b0a3d4f7f400de7df6151214421cb427f611d0
7
+ data.tar.gz: eea068e867cadd81296b105733fee22972e0cc410afa5ae9cc15579b2edd3c41aeff55890ba6f123c0aa1daa97ebdbb8b8483b298576999d7b2176983e0d3c14
@@ -16,26 +16,23 @@ module GemCheck
16
16
 
17
17
  # Gems API
18
18
  def current_gem_info
19
- @current_stats = []
20
19
  Gems.gems.map do |x|
21
20
  x = OpenStruct.new(x)
22
- val = [x.name, x.version, commafy(x.version_downloads), commafy(x.downloads)]
23
- @current_stats << val
24
- val
21
+ [x.name, x.version, commafy(x.version_downloads), commafy(x.downloads)]
25
22
  end
26
23
  end
27
24
 
28
25
  # Features
29
26
  def add_new_download_info(latest_info)
30
27
  return latest_info if @previous_stats.empty?
31
- latest_info.map do |row|
28
+ latest_info.each do |row|
32
29
  prev_info = search_by_column(@previous_stats, COL_NAME, row[COL_NAME])
33
- prev_info = search_by_column(prev_info, COL_VER, row[COL_VER])
34
- return row if prev_info.empty?
35
- prev_info = prev_info.first
36
- calc_new_downloads(COL_TDL, row, prev_info)
37
- calc_new_downloads(COL_VDL, row, prev_info)
38
- row
30
+ prev_info = search_by_column(prev_info, COL_VER, row[COL_VER]) unless prev_info.empty?
31
+ unless prev_info.empty?
32
+ prev_info = prev_info.first
33
+ calc_new_downloads(COL_TDL, row, prev_info)
34
+ calc_new_downloads(COL_VDL, row, prev_info)
35
+ end
39
36
  end
40
37
  end
41
38
 
@@ -1,3 +1,3 @@
1
1
  module GemCheck
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
data/lib/gem-check.rb CHANGED
@@ -48,9 +48,9 @@ module GemCheck
48
48
  end
49
49
 
50
50
  def build_table
51
- rows = current_gem_info.sort!{|a, b| b[2].to_i <=> a[2].to_i}
52
- rows = add_new_download_info(rows)
53
- table = Terminal::Table.new(rows: rows)
51
+ @current_stats = current_gem_info.sort!{|a, b| b[2].to_i <=> a[2].to_i}
52
+ add_new_download_info(@current_stats)
53
+ table = Terminal::Table.new(rows: @current_stats)
54
54
  table.title = header_string
55
55
  table.headings = REPORT_HEADINGS
56
56
  [1 ].each{ |col| table.align_column(col, :left) }
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meissa Dia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-24 00:00:00.000000000 Z
11
+ date: 2017-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gems