History

Merge pull request #2441 from ClasherKasten/fix/version-checks

Fix multiple version checks of scrapers.

Simon Legner committed 1 year ago

Commit 94a161a2 parents bcf7dc2 31ca6d47 files · +9 −13Browse files

Unified · Split

7 files
  1. lib/docs/scrapers/docker.rb +1 −1
  2. lib/docs/scrapers/meteor.rb +1 −2
  3. lib/docs/scrapers/nix.rb +1 −3
  4. lib/docs/scrapers/phpunit.rb +2 −2
  5. lib/docs/scrapers/redis.rb +1 −2
  6. lib/docs/scrapers/sass.rb +2 −2
  7. lib/docs/scrapers/trio.rb +1 −1
lib/docs/scrapers/docker.rb+1−1
@@ -96,7 +96,7 @@ module Docs · 95 unmodified lines
9696
9797 def get_latest_version(opts)
9898 doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts)
99− latest_version = doc.at_css('.DocSearch-content > h2 > a').content.strip
99+ latest_version = doc.at_css('h2.scroll-mt-20 > a').content.strip
100100 latest_version.rpartition(' ')[-1]
101101 end
102102 end
lib/docs/scrapers/meteor.rb+1−2
@@ -47,8 +47,7 @@ module Docs · 46 unmodified lines
4747 end
4848
4949 def get_latest_version(opts)
50− doc = fetch_doc('https://docs.meteor.com/#/full/', opts)
51− doc.at_css('select.version-select > option').content
50+ get_npm_version('meteor', opts)
5251 end
5352 end
5453 end
lib/docs/scrapers/nix.rb+1−3
@@ -23,9 +23,7 @@ module Docs · 22 unmodified lines
2323
2424 def get_latest_version(opts)
2525 doc = fetch_doc('https://nixos.org/manual/nix/stable/', opts)
26− json = JSON.parse(doc.at_css('body')['data-nix-channels'])
27− channel = json.find { |c| c['channel'] == 'stable' }
28− channel['version']
26+ doc.at_css('a.active')['href'].scan(/([0-9.]+)/)[0][0]
2927 end
3028 end
3129 end
lib/docs/scrapers/phpunit.rb+2−2
@@ -77,8 +77,8 @@ module Docs · 76 unmodified lines
7777
7878 def get_latest_version(opts)
7979 doc = fetch_doc('https://phpunit.readthedocs.io/', opts)
80− label = doc.at_css('.rst-current-version').content.strip
81− label.scan(/v: ([0-9.]+)/)[0][0]
80+ label = doc.at_css('meta[name="readthedocs-version-slug"]')["content"]
81+ label
8282 end
8383
8484 end
lib/docs/scrapers/redis.rb+1−2
@@ -22,8 +22,7 @@ module Docs · 21 unmodified lines
2222
2323 def get_latest_version(opts)
2424 body = fetch('http://download.redis.io/redis-stable/00-RELEASENOTES', opts)
25− body = body.lines[1..-1].join
26− body.scan(/Redis ([0-9.]+)/)[0][0]
25+ body.scan(/Redis Community Edition ([0-9.]+)/)[0][0]
2726 end
2827
2928 private
lib/docs/scrapers/sass.rb+2−2
@@ -20,13 +20,13 @@ module Docs · 19 unmodified lines
2020 &copy; 2006&ndash;2024 the Sass team, and numerous contributors<br>
2121 Licensed under the MIT License.
2222 HTML
23−
24− private
2523
2624 def get_latest_version(opts)
2725 get_npm_version('sass', opts)
2826 end
2927
28+ private
29+
3030 def parse(response)
3131 response.body.gsub! '<span class="widont">&nbsp;</span>', '&nbsp;'
3232 end
lib/docs/scrapers/trio.rb+1−1
@@ -25,7 +25,7 @@ module Docs · 24 unmodified lines
2525
2626 def get_latest_version(opts)
2727 doc = fetch_doc('https://trio.readthedocs.io/en/stable/', opts)
28− doc.at_css('.rst-other-versions a[href^="/en/v"]').content[1..-1]
28+ doc.at_css('div.trio-version').content[0..-1]
2929 end
3030 end
3131 end