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
132132 end
133133
134134 def get_latest_version(opts)
135− latest_version = 8
136− current_attempt = latest_version
137− attempts = 0
138−
139− while attempts < 3
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
135+ doc = fetch_doc("https://jdk.java.net/archive/", opts)
136+ puts doc
137+ version = doc.at_css('#downloads > table > tr > th').content
138+ version.gsub!(/\(.*\)/, '')
139+ version.gsub!(/[a-zA-z]/, '')
152140 end
153141 end
154142 end

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