excalidrawz 1.2.5
[Homebrew/homebrew-cask.git] / Casks / l / libreoffice-still.rb
blobfb5b13dbd3791fc92280989d0d303621419b683a
1 cask "libreoffice-still" do
2   arch arm: "aarch64", intel: "x86-64"
3   folder = on_arch_conditional arm: "aarch64", intel: "x86_64"
5   version "24.2.7"
6   sha256 arm:   "44e2229c4e26bdd7f9270a79e4da363a08f4de87b698a3806295e9e50cbb1b62",
7          intel: "57b0af3ca12043ec3da6782ba58c094b12123549806451557f5a0a6e307a575a"
9   url "https://download.documentfoundation.org/libreoffice/stable/#{version}/mac/#{folder}/LibreOffice_#{version}_MacOS_#{arch}.dmg",
10       verified: "download.documentfoundation.org/libreoffice/stable/"
11   name "LibreOffice Still"
12   desc "Free cross-platform office suite, stable version recommended for enterprises"
13   homepage "https://www.libreoffice.org/"
15   # LibreOffice "still" releases are the stable versions with a lower
16   # major/minor.
17   livecheck do
18     url "https://download.documentfoundation.org/libreoffice/stable/"
19     regex(%r{href=["']v?(\d+(?:\.\d+)+)/?["' >]}i)
20     strategy :page_match do |page, regex|
21       versions = page.scan(regex).map(&:first)
22       uniq_major_minor = versions.map { |version| Version.new(version).major_minor }.uniq.sort.reverse
23       next if uniq_major_minor.length < 2
25       versions.select { |version| Version.new(version).major_minor == uniq_major_minor[1] }
26     end
27   end
29   conflicts_with cask: "libreoffice"
30   depends_on macos: ">= :catalina"
32   app "LibreOffice.app"
33   binary "#{appdir}/LibreOffice.app/Contents/MacOS/gengal"
34   binary "#{appdir}/LibreOffice.app/Contents/MacOS/regview"
35   binary "#{appdir}/LibreOffice.app/Contents/MacOS/senddoc"
36   binary "#{appdir}/LibreOffice.app/Contents/MacOS/uno"
37   binary "#{appdir}/LibreOffice.app/Contents/MacOS/unoinfo"
38   binary "#{appdir}/LibreOffice.app/Contents/MacOS/unopkg"
39   binary "#{appdir}/LibreOffice.app/Contents/MacOS/uri-encode"
40   binary "#{appdir}/LibreOffice.app/Contents/MacOS/xpdfimport"
41   # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
42   shimscript = "#{staged_path}/soffice.wrapper.sh"
43   binary shimscript, target: "soffice"
45   preflight do
46     File.write shimscript, <<~EOS
47       #!/bin/sh
48       '#{appdir}/LibreOffice.app/Contents/MacOS/soffice' "$@"
49     EOS
50   end
52   zap trash: [
53     "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.libreoffice.script.sfl*",
54     "~/Library/Application Support/LibreOffice",
55     "~/Library/Preferences/org.libreoffice.script.plist",
56     "~/Library/Saved Application State/org.libreoffice.script.savedState",
57   ]
58 end