Skip to content

Commit ecc4939

Browse files
committed
Update Electron/redis/Nix get_latest_version algorithms.
1 parent 0e42184 commit ecc4939

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/docs/scrapers/electron.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ class Electron < UrlScraper
2626
HTML
2727

2828
def get_latest_version(opts)
29-
doc = fetch_doc('https://www.electronjs.org/releases/stable', opts)
30-
doc.at_css('.release-card__metadata>a')['href'].gsub!(/[a-zA-Z\/:]/, '')[1..-1]
29+
doc = fetch_doc('https://releases.electronjs.org/release?channel=stable', opts)
30+
31+
# Builds are sorted by build time, not latest version. Manually sort rows by version.
32+
# This list is paginated; it is assumed the latest version is somewhere on the first page.
33+
doc.css('table.w-full > tbody > tr td:first-child').map(&:content).sort!.last
3134
end
3235
end
3336
end

lib/docs/scrapers/nix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Nix < UrlScraper
2323

2424
def get_latest_version(opts)
2525
doc = fetch_doc('https://nixos.org/manual/nix/stable/', opts)
26-
doc.at_css('a.active')['href'].scan(/([0-9.]+)/)[0][0]
26+
doc.at_css('h1.menu-title').content.scan(/([0-9.]+)/).first.first
2727
end
2828
end
2929
end

lib/docs/scrapers/redis.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +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.scan(/Redis Community Edition ([0-9.]+)/)[0][0]
25+
body.scan(/^Redis ([0-9.]+)\s+Released/).first.first
2626
end
2727

2828
private

0 commit comments

Comments
 (0)