Update docs/Brew-Livecheck.md - simplify regex

Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
This commit is contained in:
Muescha 2024-07-18 18:00:59 +02:00 committed by GitHub
parent 3b0488edb4
commit 5ce0124c4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -284,13 +284,13 @@ Similarly, you can work with the `files` array like this:
```ruby
livecheck do
url "https://example.org/my-app/latest-mac.yml"
regex(/MyApp[._-](\d+(?:\.\d+)+)-mac-ddl-stage-(\d+(?:\.\d+)*)-([0-9a-f]+)\.dmg/i)
regex(/MyApp[._-]v?(\d+(?:\.\d+)+)-(\h+)\.dmg/i)
strategy :electron_builder do |yaml, regex|
yaml["files"]&.map do |file|
match = file["url"]&.match(regex)
next if match.blank?
"#{match[1]},#{match[2]},#{match[3]}"
"#{match[1]},#{match[2]}"
end
end
end