homebrew-cask/Casks/codeexpander.rb

30 lines
1.1 KiB
Ruby

cask "codeexpander" do
version "4.2.13"
sha256 "d2700dc3ae0dfea4727a8ce289a4238c43b72fdbfb82ec7d0db42c42b137278a"
url "https://github.com/oncework/codeexpander/releases/download/#{version.major_minor}.x/CodeExpander-#{version}.dmg"
name "CodeExpander"
desc "Cloud synchronization development tool"
homepage "https://github.com/oncework/codeexpander"
livecheck do
url "https://github.com/oncework/codeexpander/releases/latest"
regex(%r{href=.*?/CodeExpander-(\d+(?:\.\d+)+)\.dmg}i)
strategy :header_match do |headers, regex|
next if headers["location"].blank?
# Identify the latest tag from the response's `location` header
latest_tag = File.basename(headers["location"])
next if latest_tag.blank?
# Fetch the assets list HTML for the latest tag and match within it
assets_page = Homebrew::Livecheck::Strategy.page_content(
@url.sub(%r{/releases/?.+}, "/releases/expanded_assets/#{latest_tag}"),
)
assets_page[:content]&.scan(regex)&.map { |match| match[0] }
end
end
app "CodeExpander.app"
end