Unified · Split
| @@ -132,23 +132,11 @@ module Docs · 131 unmodified lines | |||
| 132 | end | 132 | end |
| 133 | 133 | ||
| 134 | def get_latest_version(opts) | 134 | def get_latest_version(opts) |
| 135 | latest_version = 8 | 135 | doc = fetch_doc("https://jdk.java.net/archive/", opts) |
| 136 | current_attempt = latest_version | 136 | puts doc |
| 137 | attempts = 0 | 137 | version = doc.at_css('#downloads > table > tr > th').content |
| 138 | 138 | version.gsub!(/\(.*\)/, '') | |
| 139 | while attempts < 3 | 139 | 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 | end | 140 | end |
| 153 | end | 141 | end |
| 154 | end | 142 | end |