Merge pull request #194004 from Homebrew/bump-binance-1.54.4
[Homebrew/homebrew-cask.git] / Casks / k / keepassxc@snapshot.rb
blob8097af6fe5292445406f8496ac17d5b20828cc25
1 cask "keepassxc@snapshot" do
2   version "2.8.0,255789"
3   sha256 "6e04fe12dc0c3a68a5d7d3341ad4e296dfd7166bf46b830b22bb9ec27a511bfc"
5   url "https://snapshot.keepassxc.org/build-#{version.csv.second}/KeePassXC-#{version.csv.first}-snapshot.dmg"
6   name "KeePassXC"
7   desc "Password manager app"
8   homepage "https://keepassxc.org/"
10   livecheck do
11     url "https://snapshot.keepassxc.org/"
12     regex(/href=.*?KeePassXC[._-]v?(\d+(?:\.\d+)+)-snapshot\.dmg/i)
13     strategy :page_match do |page, regex|
14       # Identify build numbers from directories like `build-123456`
15       newest_build = page.scan(%r{href=["']?build[._-]v?(\d+(?:\.\d+)*)/?["' >]}i)
16                          .flatten
17                          .uniq
18                          .max
19       next if newest_build.blank?
21       # Fetch the directory listing page for newest build
22       build_response = Homebrew::Livecheck::Strategy.page_content("https://snapshot.keepassxc.org/build-#{newest_build}/")
23       next if (build_page = build_response[:content]).blank?
25       match = build_page.match(regex)
26       next if match.blank?
28       "#{match[1]},#{newest_build}"
29     end
30   end
32   deprecate! date: "2025-05-01", because: :unsigned
34   app "KeePassXC.app"
35   binary "#{appdir}/KeePassXC.app/Contents/MacOS/keepassxc-cli"
37   zap trash: "~/.keepassxc"
39   caveats do
40     requires_rosetta
41   end
42 end