homebrew-cask/Casks/gnucash.rb

37 lines
1.3 KiB
Ruby

cask "gnucash" do
version "4.13-2"
sha256 "5aad49b682d38de25a192d8e77245654e044102adc3c228de0431b75f87a4a05"
url "https://github.com/Gnucash/gnucash/releases/download/#{version.hyphens_to_dots.major_minor}/Gnucash-Intel-#{version}.dmg",
verified: "github.com/Gnucash/gnucash/"
name "GnuCash"
desc "Double-entry accounting program"
homepage "https://www.gnucash.org/"
livecheck do
url "https://github.com/Gnucash/gnucash/releases/latest"
regex(%r{href=.*/Gnucash-Intel-v?(\d+\.\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 "Gnucash.app"
zap trash: [
"~/Library/Application Support/Gnucash",
"~/Library/Preferences/org.gnucash.Gnucash.plist",
"~/Library/Saved Application State/org.gnucash.Gnucash.savedState",
]
end