Onset: version control where nobody waits and nothing gets lost. The on command, its core and onset-server.
| VERSION=$1 |
| 6 | DIR=$2 |
| 7 | BASE=${ONSET_DOWNLOADS:-https://downloads.coline.dev/onset} |
| 8 | sha() { sha256sum "$DIR/onset-$VERSION-$1.tar.gz" | cut -d' ' -f1; } |
| 9 | block() { # platform (left out when it wasn't built: a check of one build) |
| 10 | [ -e "$DIR/onset-$VERSION-$1.tar.gz" ] || return 0 |
| 11 | printf ' url "%s/%s/onset-%s-%s.tar.gz"\n sha256 "%s"\n' "$BASE" "$VERSION" "$VERSION" "$1" "$(sha "$1")" |
| 12 | } |
| 13 | cat <<EOF |
| 14 | class Onset < Formula |
| 15 | desc "Version control where nobody waits and nothing gets lost" |
| 16 | homepage "https://upstream.codes/onset" |
| 17 | version "$VERSION" |
| 18 | license "Apache-2.0" |
| 19 |
| 20 | on_macos do |
| 21 | on_arm do |
| 22 | $(block darwin-arm64) |
| 23 | end |
| 24 | on_intel do |
| 25 | $(block darwin-x64) |
| 26 | end |
| 27 | end |
| 28 |
| 29 | on_linux do |
| 30 | on_arm do |
| 31 | $(block linux-arm64) |
| 32 | end |
| 33 | on_intel do |
| 34 | $(block linux-x64) |
| 35 | end |
| 36 | end |
| 37 |
| 38 | def install |
| 39 | bin.install "on" |
| 40 | bin.install "onset-server" if File.exist?("onset-server") |
| 41 | generate_completions_from_executable(bin/"on", "completions") |
| 42 | end |
| 43 |
| 44 | test do |
| 45 | assert_match version.to_s, shell_output("#{bin}/on --version") |
| 46 | end |
| 47 | end |
| 48 | EOF |
| 49 |