Fix broken get_latest_version implementations
Unified · Split
| @@ -24,8 +24,7 @@ module Docs · 23 unmodified lines | ||
| 24 | 24 | end |
| 25 | 25 | |
| 26 | 26 | def get_latest_version(opts) |
| 27 | − doc = fetch_doc('https://babeljs.io/docs/en/', opts) | |
| 28 | − doc.at_css('a[href="/versions"] > h3').content | |
| 27 | + get_latest_github_release('babel', 'babel', opts) | |
| 29 | 28 | end |
| 30 | 29 | end |
| 31 | 30 | end |
| @@ -49,8 +49,8 @@ module Docs · 48 unmodified lines | ||
| 49 | 49 | end |
| 50 | 50 | |
| 51 | 51 | def get_latest_version(opts) |
| 52 | − doc = fetch_doc('https://downloads.chef.io/chef', opts) | |
| 53 | − doc.at_css('h1.product-heading > span').content.strip | |
| 52 | + doc = fetch_doc('https://downloads.chef.io/products/infra', opts) | |
| 53 | + doc.at_css('#versions > option').content.strip | |
| 54 | 54 | end |
| 55 | 55 | end |
| 56 | 56 | end |
| @@ -40,9 +40,8 @@ module Docs · 39 unmodified lines | ||
| 40 | 40 | end |
| 41 | 41 | |
| 42 | 42 | def get_latest_version(opts) |
| 43 | − doc = fetch_doc('https://codeigniter.com/user_guide/changelog.html', opts) | |
| 44 | − header = doc.at_css('#change-log h2') | |
| 45 | − header.content.scan(/([0-9.]+)/)[0][0] | |
| 43 | + tags = get_github_tags('codeigniter4', 'codeigniter4', opts) | |
| 44 | + tags[0]['name'][1..-1] | |
| 46 | 45 | end |
| 47 | 46 | end |
| 48 | 47 | end |
| @@ -260,9 +260,9 @@ module Docs · 259 unmodified lines | ||
| 260 | 260 | end |
| 261 | 261 | |
| 262 | 262 | def get_latest_version(opts) |
| 263 | − doc = fetch_doc('https://docs.docker.com/', opts) | |
| 264 | − label = doc.at_css('.nav-container button.dropdown-toggle').content.strip | |
| 265 | − label.scan(/([0-9.]+)/)[0][0] | |
| 263 | + doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts) | |
| 264 | + latest_version = doc.at_css('.content > section > h1[id^="version-"]').content.strip | |
| 265 | + latest_version.rpartition(' ')[-1] | |
| 266 | 266 | end |
| 267 | 267 | end |
| 268 | 268 | end |
| @@ -126,7 +126,7 @@ module Docs · 125 unmodified lines | ||
| 126 | 126 | |
| 127 | 127 | def get_latest_version(opts) |
| 128 | 128 | doc = fetch_doc('https://hexdocs.pm/elixir/api-reference.html', opts) |
| 129 | − doc.at_css('h2.sidebar-projectVersion').content.strip[1..-1] | |
| 129 | + doc.at_css('.sidebar-projectVersion').content.strip[1..-1] | |
| 130 | 130 | end |
| 131 | 131 | end |
| 132 | 132 | end |
| @@ -57,8 +57,7 @@ module Docs · 56 unmodified lines | ||
| 57 | 57 | end |
| 58 | 58 | |
| 59 | 59 | def get_latest_version(opts) |
| 60 | − doc = fetch_doc('https://www.erlang.org/downloads', opts) | |
| 61 | − doc.at_css('.col-lg-3 > ul > li').content.strip.sub(/OTP /, '') | |
| 60 | + get_latest_github_release('erlang', 'otp', opts)[4..-1] | |
| 62 | 61 | end |
| 63 | 62 | end |
| 64 | 63 | end |
| @@ -54,8 +54,7 @@ module Docs · 53 unmodified lines | ||
| 54 | 54 | end |
| 55 | 55 | |
| 56 | 56 | def get_latest_version(opts) |
| 57 | − doc = fetch_doc('http://fishshell.com/docs/current/index.html', opts) | |
| 58 | − doc.at_css('#toc-index').content.scan(/([0-9.]+)/)[0][0] | |
| 57 | + get_latest_github_release('fish-shell', 'fish-shell', opts) | |
| 59 | 58 | end |
| 60 | 59 | end |
| 61 | 60 | end |
| @@ -18,9 +18,11 @@ module Docs · 17 unmodified lines | ||
| 18 | 18 | HTML |
| 19 | 19 | |
| 20 | 20 | def get_latest_version(opts) |
| 21 | − doc = fetch_doc('https://open-cobol.sourceforge.io/HTML/gnucobpg.html', opts) | |
| 22 | − title = doc.at_css('h1').content | |
| 23 | − title.scan(/([0-9.]+)/)[0][0] | |
| 21 | + fetch_doc('https://sourceforge.net/projects/gnucobol/files/gnucobol/', opts) | |
| 22 | + .css('#files_list > tbody > tr') | |
| 23 | + .map { |file| file['title'] } | |
| 24 | + .sort_by { |version| version.to_f } | |
| 25 | + .last | |
| 24 | 26 | end |
| 25 | 27 | end |
| 26 | 28 | end |
| @@ -42,6 +42,5 @@ module Docs · 41 unmodified lines | ||
| 42 | 42 | label = doc.at_css('h2').content.strip |
| 43 | 43 | label.sub(/[^0-9.]*/, '') |
| 44 | 44 | end |
| 45 | − | |
| 46 | 45 | end |
| 47 | 46 | end |
| @@ -44,8 +44,7 @@ module Docs · 43 unmodified lines | ||
| 44 | 44 | end |
| 45 | 45 | |
| 46 | 46 | def get_latest_version(opts) |
| 47 | − doc = fetch_doc('https://docs.godotengine.org/', opts) | |
| 48 | − doc.at_css('.version').content.strip | |
| 47 | + get_latest_github_release('godotengine', 'godot', opts).split('-')[0] | |
| 49 | 48 | end |
| 50 | 49 | end |
| 51 | 50 | end |
| @@ -48,9 +48,7 @@ module Docs · 47 unmodified lines | ||
| 48 | 48 | HTML |
| 49 | 49 | |
| 50 | 50 | def get_latest_version(opts) |
| 51 | − doc = fetch_doc('https://docs.influxdata.com/influxdb/', opts) | |
| 52 | − label = doc.at_css('.navbar--current-product').content.strip | |
| 53 | − label.scan(/([0-9.]+)/)[0][0] | |
| 51 | + get_latest_github_release('influxdata', 'influxdb', opts) | |
| 54 | 52 | end |
| 55 | 53 | end |
| 56 | 54 | end |
| @@ -24,8 +24,7 @@ module Docs · 23 unmodified lines | ||
| 24 | 24 | HTML |
| 25 | 25 | |
| 26 | 26 | def get_latest_version(opts) |
| 27 | − doc = fetch_doc('http://momentjs.com/', opts) | |
| 28 | − doc.at_css('.hero-title > h1 > span').content | |
| 27 | + get_github_tags('moment', 'moment', opts)[0]['name'] | |
| 29 | 28 | end |
| 30 | 29 | end |
| 31 | 30 | end |
| @@ -46,8 +46,7 @@ module Docs · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | def get_latest_version(opts) |
| 48 | 48 | doc = fetch_doc('https://perldoc.perl.org/', opts) |
| 49 | − header = doc.at_css('h2.h1').content | |
| 50 | − header.scan(/Perl ([0-9.]+)/)[0][0] | |
| 49 | + doc.at_css('#dropdownlink-stable').content | |
| 51 | 50 | end |
| 52 | 51 | end |
| 53 | 52 | end |
| @@ -68,9 +68,8 @@ module Docs · 67 unmodified lines | ||
| 68 | 68 | HTML |
| 69 | 69 | |
| 70 | 70 | def get_latest_version(opts) |
| 71 | − doc = fetch_doc('https://secure.php.net/manual/en/doc.changelog.php', opts) | |
| 72 | − label = doc.at_css('tbody.gen-changelog > tr > td').content | |
| 73 | − label.split(',').last.strip | |
| 71 | + doc = fetch_doc('https://www.php.net/supported-versions.php', opts) | |
| 72 | + doc.at_css('table > tbody > .stable:last-of-type > td > a').content.strip | |
| 74 | 73 | end |
| 75 | 74 | end |
| 76 | 75 | end |
| @@ -68,7 +68,7 @@ module Docs · 67 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | def get_latest_version(opts) |
| 70 | 70 | doc = fetch_doc('https://docs.python.org/', opts) |
| 71 | − doc.at_css('.version_switcher_placeholder').content | |
| 71 | + doc.at_css('title').content.split(' ')[0] | |
| 72 | 72 | end |
| 73 | 73 | end |
| 74 | 74 | end |
| @@ -32,8 +32,8 @@ module Docs · 31 unmodified lines | ||
| 32 | 32 | HTML |
| 33 | 33 | |
| 34 | 34 | def get_latest_version(opts) |
| 35 | − doc = fetch_doc('https://facebook.github.io/react-native/docs/getting-started.html', opts) | |
| 36 | − doc.at_css('header > a > h3').content | |
| 35 | + doc = fetch_doc('https://reactnative.dev/docs/getting-started', opts) | |
| 36 | + doc.at_css('meta[name="docsearch:version"]')['content'] | |
| 37 | 37 | end |
| 38 | 38 | end |
| 39 | 39 | end |
| @@ -26,8 +26,7 @@ module Docs · 25 unmodified lines | ||
| 26 | 26 | HTML |
| 27 | 27 | |
| 28 | 28 | def get_latest_version(opts) |
| 29 | − doc = fetch_doc('https://scikit-learn.org/stable/documentation.html', opts) | |
| 30 | − doc.at_css('.body h1').content.scan(/([0-9.]+)/)[0][0] | |
| 29 | + get_latest_github_release('scikit-learn', 'scikit-learn', opts) | |
| 31 | 30 | end |
| 32 | 31 | end |
| 33 | 32 | end |
| @@ -22,8 +22,7 @@ module Docs · 21 unmodified lines | ||
| 22 | 22 | HTML |
| 23 | 23 | |
| 24 | 24 | def get_latest_version(opts) |
| 25 | − doc = fetch_doc('http://www.statsmodels.org/stable/', opts) | |
| 26 | − doc.at_css('.sphinxsidebarwrapper h3 + p > b').content[1..-1] | |
| 25 | + get_latest_github_release('statsmodels', 'statsmodels', opts) | |
| 27 | 26 | end |
| 28 | 27 | end |
| 29 | 28 | end |
| @@ -20,8 +20,7 @@ module Docs · 19 unmodified lines | ||
| 20 | 20 | HTML |
| 21 | 21 | |
| 22 | 22 | def get_latest_version(opts) |
| 23 | − contents = get_github_file_contents('hashicorp', 'vagrant', 'website/config.rb', opts) | |
| 24 | − contents.scan(/version\s+=\s+"([0-9.]+)"/)[0][0] | |
| 23 | + get_github_tags('hashicorp', 'vagrant', opts)[0]['name'][1..-1] | |
| 25 | 24 | end |
| 26 | 25 | end |
| 27 | 26 | end |