gem-check 0.2.2 → 0.2.3

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: bb16d66453bc30609dd733b6111d5b906735882b
4
- data.tar.gz: 7f0f3825f8ab2ccd4b9906fcc0411e05d74d16d5
3
+ metadata.gz: 74e9d0001aaea88249a55483b082bf387f678e24
4
+ data.tar.gz: 35ad1ecac4b96e997bb279eb21403e228a08a1ac
5
5
  SHA512:
6
- metadata.gz: 5175372b87e3f0769b6c81865b74b70656be1c559e659203b4ecde2fbe76ddf7c9125e1d3046eda40ff7026019c4a0491532ebabbbf8fede0737cc63ca0b8ec2
7
- data.tar.gz: af58613b1bb209b3f28418beaa579c7b8ddeed8057706ea3a8c67b54b8651d7bac5916899d19d26427290e3b08780ce146af31b686204e9b0f7792955ae97a6f
6
+ metadata.gz: 61dd0a1f98a72ca2685d03da0682f42dcf12ac3d13fd94bb457ae1ae7cca09cd98bd8118beebfedc04cde5be93a0736c808ecad031c2039e65d5bcc716de063d
7
+ data.tar.gz: 3ce99d29cb4eb23cc6527e1d54f709a90aae7cb10a9e695d5a53c419ca5e6a6af22d8ba0246c54d3cf5e9c1df1ffcd133ed5d17c909da1c87f6b8b8651147bff
@@ -28,16 +28,19 @@ module GemCheck
28
28
  latest_info.each do |row|
29
29
  prev_info = search_by_column(@previous_stats, COL_NAME, row[COL_NAME])
30
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
31
+ prev_info = prev_info.first || new_version_info(row)
32
+ calc_new_downloads(COL_TDL, row, prev_info)
33
+ calc_new_downloads(COL_VDL, row, prev_info)
36
34
  end
37
35
  end
38
36
 
37
+ def new_version_info(row)
38
+ tdl = to_int(row[COL_TDL]) - to_int(row[COL_VDL])
39
+ [row[COL_NAME], row[COL_VER], 0 , tdl]
40
+ end
41
+
39
42
  def calc_new_downloads(idx, row, info)
40
- new_dls = decommafy(row[idx]).to_i - decommafy(info[idx]).to_i
43
+ new_dls = to_int(row[idx]) - to_int(info[idx])
41
44
  @new_downloads += new_dls if idx.eql?(COL_TDL)
42
45
  row[idx] = new_dls > 0 ? "#{row[idx]} ( +#{commafy(new_dls)} )" : row[idx]
43
46
  end
@@ -48,6 +51,10 @@ module GemCheck
48
51
  table.select{ |r| r[column].eql?(search_s) }
49
52
  end
50
53
 
54
+ def to_int(string)
55
+ decommafy(string).to_i
56
+ end
57
+
51
58
  # Maintanence
52
59
  def update_available?
53
60
  versions = open(URL_GEMCHECK_INFO_JSON).read
@@ -1,3 +1,3 @@
1
1
  module GemCheck
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meissa Dia