hiddengems 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 1d32c87fa374dc7a6cd4428bb8aec3edee96cb3aba55b105083dbc448b73cb46
4
- data.tar.gz: 7fe47951cbd11ec15ff5ce5e5f732c6248bf4816164d4054efdb7170b11403f5
3
+ metadata.gz: 00f25eebd3d13ccf280ea8b5868905c3dec6dfc7033b890f8ad6ece71b88e5b8
4
+ data.tar.gz: 606dc74c1f9b1372d85bb9690d163ce5bdb8552c750d8ad82918385aeaa910ca
5
5
  SHA512:
6
- metadata.gz: 1a17294f5dfdc32e028abeb2308567931ead99a5808bbbfd6758c8a7117d0ae308964f4eda9b3224910cf4b516a278b22451ce8063861ad06cf66aadb1c08b58
7
- data.tar.gz: '0696b97afbcbb2ad5c210ffb588fbcf61b90e8f42287f961d85f38cf2dcbf92bb387bde31114ee52ae3feca72ab74851be268778977dc6013fd7edbf49eeffc3'
6
+ metadata.gz: adeed64f5fe52b2358127b6f84740fb99deff4a3b6578243fd9bdf4d7f1e266cfc796de44d3faf0be7fd4492b7cc1a48d2ee5ff0ec1a92f6c7aca97c3600e361
7
+ data.tar.gz: c19a760280479a2624e84420a93cf0193677a1f0b943cb1c4765e782a0119a560880d5e6e96f2e2049d663035f4b306ec6aa2bec9250c816e55881813bcbd0c2
data/exe/hiddengems.rb CHANGED
@@ -87,23 +87,7 @@ until curpage == 0
87
87
  end
88
88
 
89
89
 
90
- puts "Search term #{searchTerm} returned #{gems.size} hits"
91
-
92
- # Things we wanna see sorted:
93
- # + number of versions
94
- # + date of last version
95
- # + avg date of all versions
96
- # + number of downloads
97
- # - downloads per day per version
98
- # - average downloads per day
99
- # - last downloads per day
100
- # - trajectory of downloads per day per version
101
- # - peak downloads
102
- # - min downloads
103
- # - where is it now
104
- # - slope of a line from peak to current
105
- # - slope of line from nadir to current
106
-
90
+ puts "Search term '#{searchTerm}' returned #{gems.size} hits"
107
91
 
108
92
  data = Hash.new
109
93
  data[:by_downloads] = gems.sort {|a,b| b.downloads <=> a.downloads}.collect {|each| "#{each.name} (#{each.downloads})"}
@@ -112,19 +96,22 @@ data[:by_latest_version_date] = gems.sort {|a,b| b.latestVersionDate <=> a.lates
112
96
  data[:by_avg_version_date] = gems.sort {|a,b| b.avgDateOfAllVersions<=> a.avgDateOfAllVersions}.collect {|each| "#{each.name} (#{each.avgDateOfAllVersions.year})"}
113
97
  data[:by_download_slope] = gems.sort {|a,b| b.downloadSlope <=> a.downloadSlope}.collect {|each| "#{each.name} (#{each.downloadSlope.round})"}
114
98
  report = Array.new
99
+ rank = 0
115
100
  gems.each_index {|index|
116
101
  record = Hash.new
102
+ record[:rank] = rank
117
103
  [:by_downloads,:by_versions,:by_latest_version_date,:by_avg_version_date,:by_download_slope].each {|column|
118
104
  record[column] = data[column][index]
119
105
  gemdict[data[column][index].split(' (').first][:rank] += index
120
106
  }
121
107
  report.push(record)
108
+ rank += 1
122
109
  }
123
110
 
124
111
  puts "Simple Rankings"
125
- puts TTY::Table.new(header: data.keys, rows: report).render(:ascii)
112
+ puts TTY::Table.new(header: [:rank]+data.keys, rows: report).render(:ascii)
126
113
 
127
114
  puts "\nVitality Ranking:"
128
- puts TTY::Table.new(header: [:name,:info], rows: gems.sort {|a,b| a.ranking<=>b.ranking}.collect {|each| [each.name,each.info]}).render(:ascii, column_widths: [15,20],resize: true)
115
+ puts TTY::Table.new(header: [:score, :name,:info], rows: gems.sort {|a,b| a.rank<=>b.rank}.collect {|each| [each.rank,each.name,each.info]}).render(:ascii, column_widths: [5,35,100],resize: false)
129
116
 
130
117
  puts
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hiddengems
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiddengems
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
  - Dave Parker