hiddengems 0.1.2 → 0.2.0

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: dc335eeb19fe93f0b9c02938dd5ab82fbf9380b49bfe6a8bb889b00d440d3e70
4
- data.tar.gz: 43a52edb017aff5dbbee6113044dd505d02c54c7833e77b9119218bc43fa6917
3
+ metadata.gz: 1d32c87fa374dc7a6cd4428bb8aec3edee96cb3aba55b105083dbc448b73cb46
4
+ data.tar.gz: 7fe47951cbd11ec15ff5ce5e5f732c6248bf4816164d4054efdb7170b11403f5
5
5
  SHA512:
6
- metadata.gz: 4816b656047b21aba744dd6a15b058cb7ab2b85d36157e0d8ddec18d8a5490a2da57d0513de506e5c1cb60999c7a196e5628c04d61c99c6520456709e27c41f9
7
- data.tar.gz: 19d94d9164adca25710fc9ce222100d742ecafc5e44c32ab8f0e709fec4d0980b50ad99eb501d6efa0a40e5a3df17f1cfd53002c4dd88f5d8300106510a5bbda
6
+ metadata.gz: 1a17294f5dfdc32e028abeb2308567931ead99a5808bbbfd6758c8a7117d0ae308964f4eda9b3224910cf4b516a278b22451ce8063861ad06cf66aadb1c08b58
7
+ data.tar.gz: '0696b97afbcbb2ad5c210ffb588fbcf61b90e8f42287f961d85f38cf2dcbf92bb387bde31114ee52ae3feca72ab74851be268778977dc6013fd7edbf49eeffc3'
data/exe/hiddengems.rb CHANGED
@@ -5,6 +5,7 @@ require 'faraday'
5
5
  require 'ostruct'
6
6
  require 'tty-table'
7
7
  require 'pry-rescue'
8
+ require 'linear_regression_trend'
8
9
 
9
10
  searchTerm = ARGV[0]
10
11
 
@@ -39,7 +40,12 @@ module GemEntry
39
40
  res.push(version.to_h)
40
41
  nextRelease = version.publishedDate
41
42
  }
42
- res
43
+ res.collect{|each|each[:downloadsPerDay]}
44
+ end
45
+
46
+ def downloadSlope
47
+ slope = LinearRegressionTrend::Calculator.new(versionDownloadHistory).slope
48
+ slope.nan? ? 0 : slope
43
49
  end
44
50
  end
45
51
 
@@ -91,7 +97,12 @@ puts "Search term #{searchTerm} returned #{gems.size} hits"
91
97
  # - downloads per day per version
92
98
  # - average downloads per day
93
99
  # - last downloads per day
94
- # - velocity of downloads per day per version
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
95
106
 
96
107
 
97
108
  data = Hash.new
@@ -99,10 +110,11 @@ data[:by_downloads] = gems.sort {|a,b| b.downloads <=> a.downloads}.collect {|ea
99
110
  data[:by_versions] = gems.sort {|a,b| b.totalVersions <=> a.totalVersions}.collect {|each| "#{each.name} (#{each.totalVersions})"}
100
111
  data[:by_latest_version_date] = gems.sort {|a,b| b.latestVersionDate <=> a.latestVersionDate}.collect {|each| "#{each.name} (#{each.latestVersionDate.year})"}
101
112
  data[:by_avg_version_date] = gems.sort {|a,b| b.avgDateOfAllVersions<=> a.avgDateOfAllVersions}.collect {|each| "#{each.name} (#{each.avgDateOfAllVersions.year})"}
113
+ data[:by_download_slope] = gems.sort {|a,b| b.downloadSlope <=> a.downloadSlope}.collect {|each| "#{each.name} (#{each.downloadSlope.round})"}
102
114
  report = Array.new
103
115
  gems.each_index {|index|
104
116
  record = Hash.new
105
- [:by_downloads,:by_versions,:by_latest_version_date,:by_avg_version_date].each {|column|
117
+ [:by_downloads,:by_versions,:by_latest_version_date,:by_avg_version_date,:by_download_slope].each {|column|
106
118
  record[column] = data[column][index]
107
119
  gemdict[data[column][index].split(' (').first][:rank] += index
108
120
  }
data/hiddengems.gemspec CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency 'ostruct'
37
37
  spec.add_dependency 'tty-table'
38
38
  spec.add_dependency 'pry-rescue'
39
+ spec.add_dependency 'linear_regression_trend'
39
40
 
40
41
  # For more information and examples about making a new gem, checkout our
41
42
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hiddengems
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiddengems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Parker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-29 00:00:00.000000000 Z
11
+ date: 2022-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: linear_regression_trend
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Provides a cli that lets you search rubygems for a search term. Displays
98
112
  multiple ranking criteria with emphasis on project vitality
99
113
  email: