hiddengems 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
  SHA256:
3
- metadata.gz: cbd3bf240c66763263cb3a431d2e7e021a125494a6d8bcd8506ce79999d44785
4
- data.tar.gz: b0bd717c020c74e3822863e01b27f3f17e1f7f9607457e460ad41aa613a87be1
3
+ metadata.gz: 55b3634a3b5823bdd3d634dad3e013d377a7e16f3f33496bcc3859dbee798199
4
+ data.tar.gz: b495911b4b3b4b6f16c43dd539a726bff9422e0c0de4812d17f44fcbab3cf31b
5
5
  SHA512:
6
- metadata.gz: '0509ce583caea5f997bb957ebdaadd0981c82108fd281f5fc03d4cfd18cb63f8dcd8e59a848800a51572e6a4741c92f19184d6f516f8b16e04ac485395c506a4'
7
- data.tar.gz: 9d1760403e3e039ef9609af1c4631370d2384f7430f955f57235e2bc0f96d441eb07b2e51fbc7f160ab3b289cea621e4ca20ab32b494882298ccf89d05a81603
6
+ metadata.gz: b9e48d6fa7a5d51c3a8cbe3d15fb51abd22ed9741b2de2f76b5aaf519ec4e693755a35417e20b23378c5ddd7122cd6b7deaaeaf55b52f91eb0a6eab6c9d695f1
7
+ data.tar.gz: 9e5811bc5737f1d13d524091867f3d797f76f832150cfcb36f6fe240c99e07963c00f1bbebb723acb8429b475871c01cd39c68e71cd21c202fa66eabe55911e8
data/exe/hiddengems.rb CHANGED
@@ -67,8 +67,14 @@ curpage = 1
67
67
  gems = Array.new
68
68
  gemdict = Hash.new
69
69
  until curpage == 0
70
+ dupepad = 0
70
71
  gemPage = JSON.parse(Faraday.get("https://rubygems.org/api/v1/search.json?page=#{curpage}&query=#{searchTerm}").body).collect { |each| OpenStruct.new(each)}.collect {|gem|
71
72
  gem.extend(GemEntry)
73
+ if gemdict.has_key?(gem.name)
74
+ puts "(rejected a dupe)"
75
+ dupepad += 1
76
+ next
77
+ end
72
78
  gem[:versions] = JSON.parse(
73
79
  Faraday.get(
74
80
  "https://rubygems.org/api/v1/versions/#{gem.name}.json"
@@ -79,10 +85,10 @@ until curpage == 0
79
85
  gem[:rank] = 0
80
86
  gemdict[gem.name] = gem
81
87
  gem
82
- }
88
+ }.reject(&:nil?)
83
89
  gems += gemPage
84
90
  puts "Found +#{gemPage.size} gems (total #{gems.size})"
85
- curpage = ((gemPage.size < 30) ? 0 : curpage.next)
91
+ curpage = (((gemPage.size + dupepad) < 30) ? 0 : curpage.next)
86
92
  puts "looking for more..." if curpage != 0
87
93
  end
88
94
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hiddengems
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Parker