Skip to content

Commit

Permalink
Depwatcher: Fix rubygems resource as input page is updated
Browse files Browse the repository at this point in the history
Before:
‣ docker run --rm -i coredeps/depwatcher /opt/resource/check < /tmp/rgcheck
{"source":{"name":"rubygems","type":"rubygems_cli"}}[]

After:
‣ docker run --rm -i coredeps/depwatcher /opt/resource/check < /tmp/rgcheck
 {"source":{"name":"rubygems","type":"rubygems_cli"}} [{"ref":"3.6.5"}]

{"source":{"name":"rubygems","type":"rubygems_cli"}}

Compare previous vs current:
https://web.archive.org/web/20241011093425/https://rubygems.org/pages/download

I also had to update the tests for Node LTS to get the testsuite
passing since the LTS version has changed since previous depwatcher code
change.

The 'resources' CI pipeline do not exist anymore. So I manually built
the depwatcher dockerimage and pushed it to coredeps/depwatcher
  • Loading branch information
arjun024 committed Feb 26, 2025
1 parent e37c4d3 commit 06385f9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dockerfiles/depwatcher/spec/depwatcher/node_lts_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Spec2.describe Depwatcher::NodeLTS do
end

it "returns real releases sorted" do
expect(subject.check.map(&.ref)).to eq ["20.0.0", "20.8.0", "20.9.0"]
expect(subject.check.map(&.ref)).to eq ["22.0.0", "22.1.0", "22.2.0"]
end
end

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/depwatcher/spec/depwatcher/node_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Spec2.describe Depwatcher::Node do
end

it "returns real releases sorted" do
expect(subject.check.map(&.ref)).to eq ["12.0.0", "12.5.0", "12.9.0", "14.0.0", "14.5.0", "16.0.0", "16.5.0", "16.9.0", "18.0.0", "18.5.0", "18.9.0", "20.0.0", "20.8.0", "20.9.0"]
expect(subject.check.map(&.ref)).to eq ["14.0.0", "14.5.0", "16.0.0", "16.5.0", "16.9.0", "18.0.0", "18.5.0", "18.9.0", "20.0.0", "20.8.0", "20.9.0", "22.0.0", "22.1.0", "22.2.0"]
end

it "returns only non-LTS versions" do
Expand Down
6 changes: 3 additions & 3 deletions dockerfiles/depwatcher/spec/fixtures/node_dist.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<body bgcolor="white">
<h1>Index of /dist/</h1><hr><pre><a href="../">../</a>
<a href="npm/">npm/</a> 23-May-2014 16:55 -
<a href="v12.0.0/">v12.0.0/</a> 23-Apr-2019 15:49 -
<a href="v12.5.0/">v12.5.0/</a> 27-Jun-2019 13:59 -
<a href="v12.9.0/">v12.9.0/</a> 20-Aug-2019 19:38 -
<a href="v13.0.0/">v13.0.0/</a> 22-Oct-2019 16:15 -
<a href="v13.5.0/">v13.5.0/</a> 18-Dec-2019 18:51 -
<a href="v13.9.0/">v13.9.0/</a> 18-Feb-2020 20:55 -
Expand All @@ -31,5 +28,8 @@ <h1>Index of /dist/</h1><hr><pre><a href="../">../</a>
<a href="v20.9.0/">v20.9.0/</a> 24-Oct-2023 14:34 -
<a href="v21.0.0/">v21.0.0/</a> 17-Oct-2023 15:56 -
<a href="v21.1.0/">v21.1.0/</a> 24-Oct-2023 13:44 -
<a href="v22.0.0/">v22.0.0/</a> 24-Apr-2024 18:22 -
<a href="v22.1.0/">v22.1.0/</a> 02-May-2024 14:33 -
<a href="v22.2.0/">v22.2.0/</a> 15-May-2024 19:23 -
</pre><hr></body>
</html>
2 changes: 1 addition & 1 deletion dockerfiles/depwatcher/src/depwatcher/rubygems_cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Depwatcher
def check() : Array(Internal)
response = client.get("https://rubygems.org/pages/download").body
doc = XML.parse_html(response)
links = doc.xpath("//a[contains(@class,'download__format')][text()='tgz']")
links = doc.xpath("//div[@id='formats']//a[text()='tgz']")
raise "Could not parse rubygems download website" unless links.is_a?(XML::NodeSet)
links.map do |a|
v = a["href"].gsub(/.*\/rubygems\-(.*)\.tgz$/, "\\1")
Expand Down

0 comments on commit 06385f9

Please sign in to comment.