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 +4 -4
- data/exe/hiddengems.rb +8 -2
- data/lib/hiddengems/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55b3634a3b5823bdd3d634dad3e013d377a7e16f3f33496bcc3859dbee798199
|
4
|
+
data.tar.gz: b495911b4b3b4b6f16c43dd539a726bff9422e0c0de4812d17f44fcbab3cf31b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/hiddengems/version.rb
CHANGED