From c0290b816d50bdbeb18f75f3d1ac3f1755d9ff96 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 3 Jan 2021 10:27:43 +0100 Subject: [PATCH] Fix broken get_latest_version implementations --- lib/docs/scrapers/ansible.rb | 4 ++-- lib/docs/scrapers/mdn/mdn.rb | 4 +--- lib/docs/scrapers/numpy.rb | 3 +-- lib/docs/scrapers/vue.rb | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/docs/scrapers/ansible.rb b/lib/docs/scrapers/ansible.rb index d839095a..314da78f 100644 --- a/lib/docs/scrapers/ansible.rb +++ b/lib/docs/scrapers/ansible.rb @@ -75,8 +75,8 @@ module Docs end def get_latest_version(opts) - doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts) - doc.at_css('.version').content.strip + tags = get_github_tags('ansible', 'ansible', opts) + tags[0]['name'][1..-1] end end end diff --git a/lib/docs/scrapers/mdn/mdn.rb b/lib/docs/scrapers/mdn/mdn.rb index 31568fc7..128f850b 100644 --- a/lib/docs/scrapers/mdn/mdn.rb +++ b/lib/docs/scrapers/mdn/mdn.rb @@ -22,9 +22,7 @@ module Docs HTML def get_latest_version(opts) - json = fetch_json("https://developer.mozilla.org/en-US/docs/feeds/json/tag/#{options[:mdn_tag]}", opts) - dates = json.map { |i| i['pubdate'] } - DateTime.parse(dates.max).to_time.to_i + get_latest_github_commit_date('mdn', 'content', opts) end private diff --git a/lib/docs/scrapers/numpy.rb b/lib/docs/scrapers/numpy.rb index 6b65b714..0ebe38dc 100644 --- a/lib/docs/scrapers/numpy.rb +++ b/lib/docs/scrapers/numpy.rb @@ -66,8 +66,7 @@ module Docs end def get_latest_version(opts) - html = fetch('https://docs.scipy.org/doc/', opts) - html.scan(/Numpy ([0-9.]+) Reference Guide/)[0][0] + get_latest_github_release('numpy', 'numpy', opts) end end end diff --git a/lib/docs/scrapers/vue.rb b/lib/docs/scrapers/vue.rb index 8cf48242..9f90f9bf 100644 --- a/lib/docs/scrapers/vue.rb +++ b/lib/docs/scrapers/vue.rb @@ -34,7 +34,7 @@ module Docs end def get_latest_version(opts) - get_latest_github_release('vuejs', 'vue', opts) + get_latest_github_release('vuejs', 'vue-next', opts) end end end