From 2f047cee5c36285aa59bc9c342a5007a2e25fa82 Mon Sep 17 00:00:00 2001 From: olofwalker <23613882+olofwalker@users.noreply.github.com> Date: Wed, 8 May 2024 13:11:39 +0200 Subject: [PATCH] Clean up & attaching commercial license for the CLI (#85) --- .github/workflows/update-akkasls.yml | 44 ------------------- Formula/akkasls.rb | 63 ---------------------------- Formula/kalix.rb | 2 +- Formula/kubectl-cloudflow.rb | 56 ------------------------- README.md | 48 --------------------- scripts/script.py | 46 -------------------- scripts/update.js | 55 ------------------------ 7 files changed, 1 insertion(+), 313 deletions(-) delete mode 100644 .github/workflows/update-akkasls.yml delete mode 100644 Formula/akkasls.rb delete mode 100644 Formula/kubectl-cloudflow.rb delete mode 100755 scripts/script.py delete mode 100644 scripts/update.js diff --git a/.github/workflows/update-akkasls.yml b/.github/workflows/update-akkasls.yml deleted file mode 100644 index 4ea739b..0000000 --- a/.github/workflows/update-akkasls.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Update CLI version - -## This workflow can be triggered manually -on: - workflow_dispatch: - issues: - types: ["opened"] - -jobs: - update_akkasls: - runs-on: ubuntu-latest - - steps: - - uses: actions/github-script@v6 - id: check - with: - script: | - if ("${{ github.rest.issue.title }}" != "update akkasls" && "${{ github.event_name }}" != "workflow_dispatch") { - console.log('Issue is not to update akkasls'); - return 'stop' - } else { - return 'build' - } - console.log("${{ github.event_name }}") - result-encoding: string - - uses: actions/checkout@v3 - if: steps.check.outputs.result == 'build' - # Force fetching only latest main - with: - ref: 'main' - - name: Run command - run: python3 -m pip install requests && ./scripts/script.py - if: steps.check.outputs.result == 'build' - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - if: steps.check.outputs.result == 'build' - with: - title: Update akkasls version - branch-suffix: short-commit-hash - body: Update akkasls to latest stable version - delete-branch: true - labels: enhancement, Feature - commit-message: "feat(cli): update akkasls to latest stable version" - author: "GitHub " diff --git a/Formula/akkasls.rb b/Formula/akkasls.rb deleted file mode 100644 index d039b87..0000000 --- a/Formula/akkasls.rb +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2021 Lightbend Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -class Akkasls < Formula - version "0.1.10" - desc "Akka Serverless :: Command Line Interface" - homepage "https://akkaserverless.com" - license "" - - if OS.mac? - if Hardware::CPU.intel? - url "https://downloads.akkaserverless.com/#{version}/akkasls_darwin_amd64_#{version}.tar.gz" - sha256 "5bece23ea934bdbcbb8a3c42f15c9d0d3219bf066967f2111913032c55f04dc9" - else - url "https://downloads.akkaserverless.com/#{version}/akkasls_darwin_arm64_#{version}.tar.gz" - sha256 "adf16d3dbbf5d6c8225bc9d11452f008b99edca7655372439804730d814b8a33" - end - end - - if OS.linux? - url "https://downloads.akkaserverless.com/#{version}/akkasls_linux_amd64_#{version}.tar.gz" - sha256 "0ca7709205013933542375fbd2945d137076c99debb473eb7a63859bc6d9b137" - end - - def install - bin.install "akkasls" - (bash_completion/"akkasls").write `#{bin}/akkasls completion --shell bash` - (fish_completion/"akkasls.fish").write `#{bin}/akkasls completion --shell fish` - (zsh_completion/"_akkasls").write `#{bin}/akkasls completion --shell zsh` - end - - def caveats - <<~EOS - #{name} is the command line interface for Akka Serverless. - - Accounts: - To use #{name} you'll need to have an active account on Akka Serverless. - You can register for an account on https://console.akkaserverless.lightbend.com - or sign up using - #{name} auth signup - - Log in: - To log in to your Akka Serverless account, run - #{name} auth login - - EOS - end - - test do - assert_equal version, shell_output("#{bin}/akkasls version").strip - end -end diff --git a/Formula/kalix.rb b/Formula/kalix.rb index 57184a3..8742b71 100644 --- a/Formula/kalix.rb +++ b/Formula/kalix.rb @@ -16,7 +16,7 @@ class Kalix < Formula version "2.0.42" desc "Kalix :: Command Line Interface" homepage "https://kalix.io" - license "" + license "https://downloads.lightbend.com/website/legal/lightbend-commercial-software-license-agreement.txt" if OS.mac? if Hardware::CPU.intel? diff --git a/Formula/kubectl-cloudflow.rb b/Formula/kubectl-cloudflow.rb deleted file mode 100644 index 5e2dc5a..0000000 --- a/Formula/kubectl-cloudflow.rb +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2021 Lightbend Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -class KubectlCloudflow < Formula - version "2.0.25" - desc "Akka Data Pipelines :: Command Line Interface" - homepage "https://cloudflow.io" - license "" - - if OS.mac? - url "https://bintray.com/lightbend/cloudflow-cli/download_file?file_path=kubectl-cloudflow-#{version}-darwin-amd64.tar.gz" - sha256 "6b15098fc6f5bf02bb69551a9c9173e88e21768b347f159f30cb8861e9c30a80" - end - - if OS.linux? - url "https://bintray.com/lightbend/cloudflow-cli/download_file?file_path=kubectl-cloudflow-#{version}-linux-amd64.tar.gz" - sha256 "7becc1eb987b09f7190e7664ab05cdfd3a5db7aaa688db5ba98aef844ee8bd76" - end - - depends_on "sbt" - depends_on "kubectl" - depends_on "kubernetes-helm" - - def install - bin.install "kubectl-cloudflow" - end - - def caveats - <<~EOS - The #{name} command line interface is an extension to kubectl used to develop and deploy Cloudflow applications. - - As prerequisites you'll need: - * Java (JDK): >= 8 - * Docker : v18.09 or higher - - As part of this installation, sbt, helm, and kubectl are already installed. For more info - see https://developer.lightbend.com/docs/cloudflow/current/get-started/prepare-development-environment.html - - EOS - end - - test do - assert_match /#{version}/, shell_output("#{bin}/kubectl-cloudflow version").strip - end -end \ No newline at end of file diff --git a/README.md b/README.md index f00c07b..48e2cec 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ This repository is a `tap` that you can use with [`brew`](https://brew.sh) to install Lightbend tools onto your system. Currently, supported tools are: * `kalix` the command line interface for [Kalix](https://kalix.io) -* `akkasls` the command line interface for [Akka Serverless](https://akkaserverless.com) -* `kubectl-cloudflow` the command line interface for [Cloudflow](https://cloudflow.io) and [Akka Data Pipelines](https://developer.lightbend.com/docs/cloudflow/current/index.html) ## Using this tap @@ -47,52 +45,6 @@ To uninstall `kalix` run `brew uninstall kalix` To update `kalix` run `brew update kalix` -## `akkasls` - -### Install - -To install `akkasls` using this tap run `brew install lightbend/brew/akkasls` (which will install the tap automatically) or run - -```bash -brew tap lightbend/brew -brew install akkasls -``` - -### Uninstall - -To uninstall `akkasls` run `brew uninstall akkasls` - -### Update - -To update `akkasls` run `brew update akkasls` - -## `kubectl-cloudflow` - -### Install - -To install `kubectl-cloudflow` using this tap run `brew install lightbend/brew/kubectl-cloudflow` (which will install the tap automatically) or run - -```bash -brew tap lightbend/brew -brew install kubectl-cloudflow -``` - -### Uninstall - -To uninstall `kubectl-cloudflow` run `brew uninstall kubectl-cloudflow` - -### Update - -To update `kubectl-cloudflow` run `brew update kubectl-cloudflow` - -## Update the `akkasls` formula - -To update the `akkasls.rb` formula file, run `node scripts/update.js` - -## Update the `kalix` formula - -To update the `kalix.rb` formula file, run `node scripts/kalix-update.js` - ## Contributing We welcome all contributions! [Pull requests](https://github.com/lightbend/homebrew-brew/pulls) are the preferred way to share your contributions. For major changes, please open [an issue](https://github.com/lightbend/homebrew-brew/issues) first to discuss what you would like to change. diff --git a/scripts/script.py b/scripts/script.py deleted file mode 100755 index 7b2663b..0000000 --- a/scripts/script.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 -import requests as req -import subprocess -from sys import platform - -scriptlines = { - "version": ["16",' version \\"{0}\\"'], - "darwinamd64": ["24", ' sha256 \\"{0}\\"'], - "darwinarm64": ["27", ' sha256 \\"{0}\\"'], - "linuxamd64": ["33", ' sha256 \\"{0}\\"'] -} - -def parseLine(line): - elems = line.split(' ') - sha = elems[0].strip() - elems = elems[2].split('_') - os = elems[1] - proc = elems[2] - version = '.'.join(elems[3].split('.')[0:3]) - return { - "sha": sha, - "os": os, - "processor": proc, - "version": version - } - -url = 'https://downloads.akkaserverless.com/latest/checksums.txt' -resp = req.get(url) - -lines = resp.text.splitlines() - -sedCommand = "sed" -if platform == "darwin": - sedCommand = "gsed" - -for line in lines: - d = parseLine(line) - if d['os'] + d['processor'] in scriptlines: - ## Update the SHA - ln = scriptlines[d['os'] + d['processor']][0] - ct = scriptlines[d['os'] + d['processor']][1].format(d['sha']) - subprocess.call(["{2} -i \"{0}s/.*/{1}/\" Formula/akkasls.rb".format(ln, ct, sedCommand)], shell=True) - ## Update the version - ln = scriptlines['version'][0] - ct = scriptlines['version'][1].format(d['version']) - subprocess.call(["{2} -i \"{0}s/.*/{1}/\" Formula/akkasls.rb".format(ln, ct, sedCommand)], shell=True) \ No newline at end of file diff --git a/scripts/update.js b/scripts/update.js deleted file mode 100644 index 67f8b31..0000000 --- a/scripts/update.js +++ /dev/null @@ -1,55 +0,0 @@ -const http = require("https"); -const cp = require("child_process"); - -const options = { - "method": "GET", - "hostname": "downloads.akkaserverless.com", - "path": "/latest/checksums.txt", - "headers": { - "Content-Type": "Application/x-www-form-urlencoded", - "Content-Length": "0" - } -}; - -const req = http.request(options, function (res) { - const chunks = []; - - res.on("data", function (chunk) { - chunks.push(chunk); - }); - - res.on("end", function () { - const body = Buffer.concat(chunks); - const lines = body.toString().split('\n'); - lines.forEach(element => { - if (element.includes('darwin_amd64')) { - const sha = element.substring(0, element.indexOf(' ')); - updateLine(24, ` sha256 \\"${sha}\\"`); - } else if (element.includes('darwin_arm64')) { - const sha = element.substring(0, element.indexOf(' ')); - updateLine(27, ` sha256 \\"${sha}\\"`); - } else if (element.includes('linux')) { - const version = element.substring(element.indexOf('amd64_') + 6, element.indexOf('.tar.gz')); - console.log(`Found version ${version} in latest/checksums.txt`); - updateLine(16, ` version \\"${version}\\"`); - const sha = element.substring(0, element.indexOf(' ')); - updateLine(33, ` sha256 \\"${sha}\\"`); - } - }); - }); -}); - -req.end(); - -function updateLine(line, content) { - cp.exec(`sed -i "${line}s/.*/${content}/" Formula/akkasls.rb`, (error, stdout, stderr) => { - if (error) { - console.log(`error: ${error.message}`); - return; - } - if (stderr) { - console.log(`stderr: ${stderr}`); - return; - } - }); -} \ No newline at end of file