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 +4 -4
- data/lib/gem-check/helpers.rb +13 -6
- data/lib/gem-check/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e9d0001aaea88249a55483b082bf387f678e24
|
4
|
+
data.tar.gz: 35ad1ecac4b96e997bb279eb21403e228a08a1ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61dd0a1f98a72ca2685d03da0682f42dcf12ac3d13fd94bb457ae1ae7cca09cd98bd8118beebfedc04cde5be93a0736c808ecad031c2039e65d5bcc716de063d
|
7
|
+
data.tar.gz: 3ce99d29cb4eb23cc6527e1d54f709a90aae7cb10a9e695d5a53c419ca5e6a6af22d8ba0246c54d3cf5e9c1df1ffcd133ed5d17c909da1c87f6b8b8651147bff
|
data/lib/gem-check/helpers.rb
CHANGED
@@ -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
|
-
|
32
|
-
|
33
|
-
|
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 =
|
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
|
data/lib/gem-check/version.rb
CHANGED