Skip to content

Commit

Permalink
oxygen-xml-editor: update livecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
khipp committed Oct 20, 2024
1 parent 412b24c commit 8ea8816
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Casks/o/oxygen-xml-editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@

livecheck do
url "https://www.oxygenxml.com/rssBuildID.xml"
strategy :page_match do |page|
version = page.match(/Oxygen\sXML\sEditor\sversion\s(\d+(?:\.\d+)+)/i)
build = page.match(/build\sid:\s(\d+)/i)
regex(/Oxygen\s+XML\s+Editor\s+(?:version\s+)?v?(\d+(?:\.\d+)+)/i)
strategy :xml do |xml, regex|
versions = xml.get_elements("//description").filter_map do |item|
match = item.text&.strip&.match(regex)
next if match.blank?

match[1]
end
builds = xml.get_elements("//guid").map { |item| item.text&.strip }

version = versions.max_by { |v| Version.new(v) }
build = builds.max
next if version.blank? || build.blank?

"#{version[1]},#{build[1]}"
"#{version},#{build}"
end
end

Expand Down

0 comments on commit 8ea8816

Please sign in to comment.