I'm trying to submit a cask for Tentacle Sync Studio but I'm having issues with livecheck being able to find the most recent version. I ran brew audit --new-cask tentacle-sync-studio
and received the following error - Version '1.30' differs from '' retrieved by livecheck.
cask "tentacle-sync-studio" do
version "1.30"
sha256 "4f7bdaef85b78f576babac91d57da3b3276cc98a2f81ac621bea96a48fe8796a"
url "https://tentaclesync.com/files/downloads/ttsyncstudio-v#{version.dots_to_underscores}.dmg"
name "Tentacle Sync Studio"
desc "Automatically synchronize video and audio via timecode"
homepage "https://tentaclesync.com/"
livecheck do
url "https://tentaclesync.zendesk.com/hc/en-us/articles/115003866805-Tentacle-Sync-Studio-macOS-"
strategy :page_match
regex(%r{/v?(\d (?:\.\d ) )/ttsyncstudio\.dmg}i)
end
depends_on macos: ">= :high_sierra"
app "Tentacle Sync Studio.app"
end
I might not be using the correct "strategy" and I honestly have no idea how to set the regex despite reading Homebrew's instructions. Any help is appreciated.
CodePudding user response:
The vitalsource-bookshelf
cask had a similar issue:
Previous livecheck URL had Cloudflare protection, use API URL instead.
You'll want to change
https://tentaclesync.zendesk.com/hc/en-us/articles/115003866805-Tentacle-Sync-Studio-macOS-
to
https://tentaclesync.zendesk.com/api/v2/help_center/en-us/articles/115003866805
However, a few more changes must be made for the livecheck to work:
Change the regex to
href=.*?/ttsyncstudio-v?(\d (?:[._-]\d ) )\.dmg
- We want to match this string:
href=\"https://tentaclesync.com/files/downloads/ttsyncstudio-v1_30.dmg
href=.*?
is a convention inhomebrew/cask
[._-]
matches a dot, underscore, or hyphen (another convention)
- We want to match this string:
Add a
do
tostrategy :page_match
to change underscores to dots:strategy :page_match do |page, regex| page.scan(regex).map { |match| match[0].tr("_", ".") } end
match[0]
corresponds to the regex capture(\d (?:[._-]\d ) )
Finally, your cask file should look like this.