From 6e88afd542f857c2dcad478c6bff54682c85c673 Mon Sep 17 00:00:00 2001 From: Ben Rockwood Date: Thu, 5 Oct 2023 14:41:55 -0700 Subject: [PATCH] Legacy Naming for Mondoo Cask (#23) Changing the name will leave existing customers in a lurch, this duplicates the package so people can transition to the new shorter cask name. --------- Signed-off-by: Ben Rockwood --- .github/workflows/release.yml | 1 + Casks/mondoo-cli.rb | 33 --------------------------------- Casks/mondoo.rb | 3 ++- Makefile | 5 +++-- generator/cask.go | 3 ++- generator/main.go | 13 ++++++++++++- 6 files changed, 20 insertions(+), 38 deletions(-) delete mode 100644 Casks/mondoo-cli.rb diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2830ef9..f961941 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,5 +51,6 @@ jobs: git add Formula/cnquery.rb git add Formula/cnspec.rb git add Casks/mondoo-cli.rb + git add Casks/mondoo.rb git commit -m '${{ steps.version.outputs.version }}' git push origin master diff --git a/Casks/mondoo-cli.rb b/Casks/mondoo-cli.rb deleted file mode 100644 index d8d5a14..0000000 --- a/Casks/mondoo-cli.rb +++ /dev/null @@ -1,33 +0,0 @@ - -# Copyright (c) Mondoo, Inc. -# SPDX-License-Identifier: BUSL-1.1 - -cask "mondoo" do - name "Mondoo" - desc "Mondoo Client CLI for the Mondoo Policy as Code Platform" - version "9.0.0" - homepage "https://mondoo.com" - - url "https://releases.mondoo.com/mondoo/#{version}/mondoo_#{version}_darwin_universal.pkg" - sha256 "06957b28779eccb06513f51b7256315e961d002c2980e864c8ef4425c7c8364f" - - livecheck do - url "https://releases.mondoo.com/mondoo/latest/index.html" - regex(%r{href='\.\./(\d+(?:\.\d+)+)}i) - end - - pkg "mondoo_#{version}_darwin_universal.pkg" - - uninstall script: { - executable: "/Library/Mondoo/uninstall.sh", - sudo: true, - } - - zap trash: [ - "/Library/Mondoo", - "/etc/opt/mondoo", - "/usr/local/bin/mondoo", - "/Library/LaunchDaemons/io.mondoo.client.plist", - ] -end - diff --git a/Casks/mondoo.rb b/Casks/mondoo.rb index 672c504..0811b34 100644 --- a/Casks/mondoo.rb +++ b/Casks/mondoo.rb @@ -1,7 +1,8 @@ + # Copyright (c) Mondoo, Inc. # SPDX-License-Identifier: BUSL-1.1 -cask "mondoo" do +cask mondoo do name "Mondoo" desc "Mondoo Enterprise Package for cnquery and cnspec" version "9.0.0" diff --git a/Makefile b/Makefile index b8a6861..fd58c17 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ update: cd generator && go run . formula cnquery > ../Formula/cnquery.rb - cd generator && go run . formula cnspec > ../Formula/cnspec.rb - cd generator && go run . cask mondoo> ../Casks/mondoo-cli.rb + cd generator && go run . formula cnspec > ../Formula/cnspec.rb + cd generator && go run . cask mondoo-cli > ../Casks/mondoo-cli.rb # Backwards compatibility + cd generator && go run . cask mondoo > ../Casks/mondoo.rb # Copywrite Check Tool: https://github.com/hashicorp/copywrite license: license/headers/check diff --git a/generator/cask.go b/generator/cask.go index 9cbc63e..c3eb0e8 100644 --- a/generator/cask.go +++ b/generator/cask.go @@ -9,6 +9,7 @@ import ( ) type Cask struct { + Pkg string `json:"pkg"` Desc string `json:"desc"` Homepage string `json:"homepage"` Version string `json:"version"` @@ -20,7 +21,7 @@ var caskTemplate = ` # Copyright (c) Mondoo, Inc. # SPDX-License-Identifier: BUSL-1.1 -cask "mondoo" do +cask {{ .Pkg }} do name "Mondoo" desc "{{ .Desc }}" version "{{ .Version }}" diff --git a/generator/main.go b/generator/main.go index 4558093..2c82846 100644 --- a/generator/main.go +++ b/generator/main.go @@ -18,15 +18,25 @@ type product struct { homepage string binary string class string + pkg string } var products = map[string]product{ "mondoo": { latestUrl: "https://releases.mondoo.com/mondoo/latest.json?ignoreCache=1", - desc: "Mondoo Client CLI for the Mondoo Policy as Code Platform", + desc: "Mondoo Enterprise Package for cnquery and cnspec", homepage: "https://mondoo.com", binary: "mondoo", class: "Mondoo", + pkg: "mondoo", + }, + "mondoo-cli": { + latestUrl: "https://releases.mondoo.com/mondoo/latest.json?ignoreCache=1", + desc: "Mondoo Enterprise Package for cnquery and cnspec", + homepage: "https://mondoo.com", + binary: "mondoo", + class: "Mondoo", + pkg: "mondoo-cli", }, "cnquery": { latestUrl: "https://releases.mondoo.com/cnquery/latest.json?ignoreCache=1", @@ -90,6 +100,7 @@ func main() { formula.Render(buf) case "cask": cask := &Cask{ + Pkg: product.pkg, Desc: product.desc, Homepage: product.homepage, Binary: product.binary,