excalidrawz 1.2.5
[Homebrew/homebrew-cask.git] / Casks / k / kdocs.rb
blobc6ad04f0cd17f7333be178cf1dad0aad5b46a351
1 cask "kdocs" do
2   version "3.9.8,1001"
3   sha256 "c04dd170cf0ef1c9fd6d442c556fb9e8cc9a698ebb997254389e161c29f54a8d"
5   url "https://qn.cache.wpscdn.cn/kdocs/apk/kdesktopmac/KDocs_#{version.csv.second}_v#{version.csv.first}.dmg",
6       verified: "qn.cache.wpscdn.cn/kdocs/apk/kdesktopmac/"
7   name "金山文档"
8   desc "Online collaborate editor for Word, Excel and PPT documents"
9   homepage "https://www.kdocs.cn/"
11   livecheck do
12     url "https://www.kdocs.cn/kd/api/configure/list?idList=appOfficial"
13     regex(/kdocs[._-](\d+(?:\.\d+)*)[._-]v?(\d+(?:\.\d+)+)\.dmg/i)
14     strategy :json do |json, regex|
15       json_string = json.dig("data", "appOfficial")
16       next if json_string.blank?
18       app_json = Homebrew::Livecheck::Strategy::Json.parse_json(json_string)
19       match = app_json.dig("kdesktopMacOfficial", 0, "url")&.match(regex)
20       next if match.blank?
22       "#{match[2]},#{match[1]}"
23     end
24   end
26   depends_on macos: ">= :high_sierra"
28   app "金山文档.app"
30   zap trash: [
31     "~/Library/Preferences/com.kingsoft.kdocs.mac.plist",
32     "~/Library/Saved Application State/com.kingsoft.kdocs.mac.savedState",
33   ]
35   caveats do
36     requires_rosetta
37   end
38 end