Merge pull request #200213 from Homebrew/bump-tidelift-1.14.0
[Homebrew/homebrew-cask.git] / Casks / l / logitech-g-hub.rb
blobadab14fd8c9c5f688789843389fe81b1367b6c28
1 cask "logitech-g-hub" do
2   version "2024.9.649333"
3   sha256 :no_check
5   url "https://download01.logi.com/web/ftp/pub/techsupport/gaming/lghub_installer.zip",
6       verified: "download01.logi.com/"
7   name "Logitech G HUB"
8   desc "Support for Logitech G gear"
9   homepage "https://www.logitechg.com/en-us/innovation/g-hub.html"
11   livecheck do
12     url "https://support.logi.com/api/v2/help_center/en-us/articles.json?label_names=webcontent=productdownload,websoftware=eee3033c-8e0b-11e9-8db1-d7e925481d4d"
13     regex(/Software\s+Version:.*?(\d+(?:\.\d+)+)/i)
14     strategy :json do |json, regex|
15       json["articles"]&.map do |article|
16         match = article["body"]&.match(regex)
17         next if match.blank?
19         match[1]
20       end
21     end
22   end
24   auto_updates true
26   installer script: {
27     executable: "lghub_installer.app/Contents/MacOS/lghub_installer",
28     args:       ["--silent"],
29     sudo:       true,
30   }
32   postflight do
33     set_ownership "#{appdir}/lghub.app"
34     set_ownership "/Users/Shared/LGHUB"
35     set_permissions "#{appdir}/lghub.app", "0755"
36   end
38   uninstall launchctl: [
39               "com.logi.ghub",
40               "com.logi.ghub.agent",
41               "com.logi.ghub.updater",
42             ],
43             quit:      [
44               "com.logi.ghub",
45               "com.logi.ghub.agent",
46               "com.logi.ghub.updater",
47             ],
48             delete:    "/Applications/lghub.app",
49             trash:     "/Users/Shared/LGHUB"
51   zap trash: [
52     "~/Library/Application Support/lghub",
53     "~/Library/Caches/com.logi.ghub.installer",
54     "~/Library/Preferences/com.logi.ghub.plist",
55     "~/Library/Saved Application State/com.logi.ghub.savedState",
56   ]
58   caveats do
59     requires_rosetta
60   end
61 end