57 lines
2.0 KiB
Ruby
57 lines
2.0 KiB
Ruby
cask "nextcloud" do
|
|
on_el_capitan :or_older do
|
|
version "2.6.5.20200710-legacy"
|
|
sha256 "4c67e50361dd5596fb884002d1ed907fe109d607fba2cabe07e505addd164519"
|
|
|
|
url "https://github.com/nextcloud/desktop/releases/download/v#{version.major_minor_patch}/Nextcloud-#{version}.pkg",
|
|
verified: "github.com/nextcloud/desktop/"
|
|
end
|
|
on_sierra :or_newer do
|
|
version "3.9.4"
|
|
sha256 "c1fc42be789970cc6e182ee8dcfa289fbf67a638bc011fa125b5b4c05fa89717"
|
|
|
|
url "https://github.com/nextcloud-releases/desktop/releases/download/v#{version}/Nextcloud-#{version}.pkg",
|
|
verified: "github.com/nextcloud-releases/desktop/"
|
|
end
|
|
|
|
name "Nextcloud"
|
|
desc "Desktop sync client for Nextcloud software products"
|
|
homepage "https://nextcloud.com/"
|
|
|
|
livecheck do
|
|
url "https://github.com/nextcloud-releases/desktop/releases/latest"
|
|
regex(/Nextcloud[._-]v?(\d+(?:\.\d+)+)\.pkg/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
|
|
|
|
auto_updates true
|
|
|
|
pkg "Nextcloud-#{version}.pkg"
|
|
binary "/Applications/Nextcloud.app/Contents/MacOS/nextcloudcmd"
|
|
|
|
uninstall pkgutil: "com.nextcloud.desktopclient",
|
|
delete: "/Applications/Nextcloud.app"
|
|
|
|
zap trash: [
|
|
"~/Library/Application Scripts/com.nextcloud.desktopclient.FinderSyncExt",
|
|
"~/Library/Application Support/Nextcloud",
|
|
"~/Library/Caches/Nextcloud",
|
|
"~/Library/Containers/com.nextcloud.desktopclient.FinderSyncExt",
|
|
"~/Library/Group Containers/com.nextcloud.desktopclient",
|
|
"~/Library/Preferences/com.nextcloud.desktopclient.plist",
|
|
"~/Library/Preferences/Nextcloud",
|
|
]
|
|
end
|