Skip to content

Commit 31ca6d4

Browse files
committed
Fix multiple version checks of scrapers.
- Docker - Meteor - Nix - PHPUnit - Redis - Sass - Trio
1 parent bcf7dc2 commit 31ca6d4

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

lib/docs/scrapers/docker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Docker < UrlScraper
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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ class Meteor < UrlScraper
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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class Nix < UrlScraper
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class Phpunit < UrlScraper
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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class Redis < UrlScraper
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class Sass < UrlScraper
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Trio < UrlScraper
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

0 commit comments

Comments
 (0)