History

Fix and improve openjdk's get_latest_version

Enoc committed 5 years ago

Commit 3efd73a1 parent 59132361 file · +5 −17Browse files

Unified · Split

lib/docs/scrapers/openjdk.rb+5−17
@@ -132,23 +132,11 @@ module Docs · 131 unmodified lines
132 end132 end
133 133
134 def get_latest_version(opts)134 def get_latest_version(opts)
135 latest_version = 8135 doc = fetch_doc("https://jdk.java.net/archive/", opts)
136 current_attempt = latest_version136 puts doc
137 attempts = 0137 version = doc.at_css('#downloads > table > tr > th').content
138 138 version.gsub!(/\(.*\)/, '')
139 while attempts < 3139 version.gsub!(/[a-zA-z]/, '')
140 current_attempt += 1
141
142 doc = fetch_doc("https://packages.debian.org/sid/openjdk-#{current_attempt}-doc", opts)
143 if doc.at_css('.perror').nil?
144 latest_version = current_attempt
145 attempts = 0
146 else
147 attempts += 1
148 end
149 end
150
151 latest_version
152 end140 end
153 end141 end
154end142end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t