Fix broken get_latest_version implementations

pull/1294/head
Jasper van Merle 4 years ago
parent c334c5fd57
commit f1b464b1ed

@ -71,7 +71,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts) doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)
doc.at_css('.DocSiteProduct-CurrentVersion').content.strip doc.at_css('.version').content.strip
end end
end end
end end

@ -24,8 +24,7 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://babeljs.io/docs/en/', opts) get_latest_github_release('babel', 'babel', opts)
doc.at_css('a[href="/versions"] > h3').content
end end
end end
end end

@ -49,8 +49,8 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://downloads.chef.io/chef', opts) doc = fetch_doc('https://downloads.chef.io/products/infra', opts)
doc.at_css('h1.product-heading > span').content.strip doc.at_css('#versions > option').content.strip
end end
end end
end end

@ -40,9 +40,8 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://codeigniter.com/user_guide/changelog.html', opts) tags = get_github_tags('codeigniter4', 'codeigniter4', opts)
header = doc.at_css('#change-log h2') tags[0]['name'][1..-1]
header.content.scan(/([0-9.]+)/)[0][0]
end end
end end
end end

@ -32,8 +32,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://api.dartlang.org/', opts) doc = fetch_doc('https://api.dartlang.org/', opts)
label = doc.at_css('footer > span').content.strip doc.at_css('footer > span').content.sub(/Dart/, '').strip
label.sub(/Dart /, '')
end end
end end
end end

@ -260,9 +260,9 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://docs.docker.com/', opts) doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts)
label = doc.at_css('.nav-container button.dropdown-toggle').content.strip latest_version = doc.at_css('.content > section > h1[id^="version-"]').content.strip
label.scan(/([0-9.]+)/)[0][0] latest_version.rpartition(' ')[-1]
end end
end end
end end

@ -126,7 +126,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://hexdocs.pm/elixir/api-reference.html', opts) doc = fetch_doc('https://hexdocs.pm/elixir/api-reference.html', opts)
doc.at_css('h2.sidebar-projectVersion').content.strip[1..-1] doc.at_css('.sidebar-projectVersion').content.strip[1..-1]
end end
end end
end end

@ -57,8 +57,7 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://www.erlang.org/downloads', opts) get_latest_github_release('erlang', 'otp', opts)[4..-1]
doc.at_css('.col-lg-3 > ul > li').content.strip.sub(/OTP /, '')
end end
end end
end end

@ -54,8 +54,7 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('http://fishshell.com/docs/current/index.html', opts) get_latest_github_release('fish-shell', 'fish-shell', opts)
doc.at_css('#toc-index').content.scan(/([0-9.]+)/)[0][0]
end end
end end
end end

@ -18,9 +18,11 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://open-cobol.sourceforge.io/HTML/gnucobpg.html', opts) fetch_doc('https://sourceforge.net/projects/gnucobol/files/gnucobol/', opts)
title = doc.at_css('h1').content .css('#files_list > tbody > tr')
title.scan(/([0-9.]+)/)[0][0] .map { |file| file['title'] }
.sort_by { |version| version.to_f }
.last
end end
end end
end end

@ -37,5 +37,9 @@ module Docs
Distributed under the <a href="https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright">gnuplot license</a> (rights to distribute modified versions are withheld). Distributed under the <a href="https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright">gnuplot license</a> (rights to distribute modified versions are withheld).
HTML HTML
def get_latest_version(opts)
doc = fetch_doc('https://sourceforge.net/projects/gnuplot/files/gnuplot/', opts)
doc.at_css('#files_list > tbody > tr:nth-child(2)')['title']
end
end end
end end

@ -44,8 +44,7 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://docs.godotengine.org/', opts) get_latest_github_release('godotengine', 'godot', opts).split('-')[0]
doc.at_css('.version').content.strip
end end
end end
end end

@ -48,9 +48,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://docs.influxdata.com/influxdb/', opts) get_latest_github_release('influxdata', 'influxdb', opts)
label = doc.at_css('.navbar--current-product').content.strip
label.scan(/([0-9.]+)/)[0][0]
end end
end end
end end

@ -24,8 +24,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('http://momentjs.com/', opts) get_github_tags('moment', 'moment', opts)[0]['name']
doc.at_css('.hero-title > h1 > span').content
end end
end end
end end

@ -63,8 +63,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', opts) doc = fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', opts)
label = doc.at_css('.body > .section > p').content doc.at_css('#pandas-documentation').content.scan(/Version: ([0-9.]+)/)[0][0]
label.scan(/Version: ([0-9.]+)/)[0][0]
end end
end end
end end

@ -46,8 +46,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://perldoc.perl.org/', opts) doc = fetch_doc('https://perldoc.perl.org/', opts)
header = doc.at_css('h2.h1').content doc.at_css('#dropdownlink-stable').content
header.scan(/Perl ([0-9.]+)/)[0][0]
end end
end end
end end

@ -68,9 +68,8 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://secure.php.net/manual/en/doc.changelog.php', opts) doc = fetch_doc('https://www.php.net/supported-versions.php', opts)
label = doc.at_css('tbody.gen-changelog > tr > td').content doc.at_css('table > tbody > .stable:last-of-type > td > a').content.strip
label.split(',').last.strip
end end
end end
end end

@ -60,7 +60,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://docs.python.org/', opts) doc = fetch_doc('https://docs.python.org/', opts)
doc.at_css('.version_switcher_placeholder').content doc.at_css('title').content.split(' ')[0]
end end
end end
end end

@ -32,8 +32,8 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://facebook.github.io/react-native/docs/getting-started.html', opts) doc = fetch_doc('https://reactnative.dev/docs/getting-started', opts)
doc.at_css('header > a > h3').content doc.at_css('meta[name="docsearch:version"]')['content']
end end
end end
end end

@ -26,8 +26,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://scikit-learn.org/stable/documentation.html', opts) get_latest_github_release('scikit-learn', 'scikit-learn', opts)
doc.at_css('.body h1').content.scan(/([0-9.]+)/)[0][0]
end end
end end
end end

@ -22,8 +22,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('http://www.statsmodels.org/stable/', opts) get_latest_github_release('statsmodels', 'statsmodels', opts)
doc.at_css('.sphinxsidebarwrapper h3 + p > b').content[1..-1]
end end
end end
end end

@ -20,8 +20,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
contents = get_github_file_contents('hashicorp', 'vagrant', 'website/config.rb', opts) get_github_tags('hashicorp', 'vagrant', opts)[0]['name'][1..-1]
contents.scan(/version\s+=\s+"([0-9.]+)"/)[0][0]
end end
end end
end end

Loading…
Cancel
Save