summaryrefslogtreecommitdiffhomepage
path: root/tools/unitctl/pkg/brew/unitctl.rb.template
diff options
context:
space:
mode:
Diffstat (limited to 'tools/unitctl/pkg/brew/unitctl.rb.template')
-rw-r--r--tools/unitctl/pkg/brew/unitctl.rb.template29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/unitctl/pkg/brew/unitctl.rb.template b/tools/unitctl/pkg/brew/unitctl.rb.template
new file mode 100644
index 00000000..db6991f6
--- /dev/null
+++ b/tools/unitctl/pkg/brew/unitctl.rb.template
@@ -0,0 +1,29 @@
+class Unitctl < Formula
+ desc "CLI interface to the NGINX UNIT Control API"
+ homepage "https://github.com/nginxinc/unit-rust-sdk"
+ version "$VERSION"
+ package_name = "$PACKAGE_NAME"
+ src_repo = "$SRC_REPO"
+
+ if OS.mac? and Hardware::CPU.intel?
+ url "#{src_repo}/releases/download/v#{version}/#{package_name}_v#{version}_x86_64-apple-darwin.tar.gz"
+ sha256 "$X86_64_APPLE_DARWIN_SHA256"
+ elsif OS.mac? and Hardware::CPU.arm?
+ url "#{src_repo}/releases/download/v#{version}/#{package_name}_#{version}_aarch64-apple-darwin.tar.gz"
+ sha256 "$AARCH64_APPLE_DARWIN_SHA256"
+ elsif OS.linux? and Hardware::CPU.intel?
+ url "#{src_repo}/releases/download/v#{version}/#{package_name}_#{version}_x86_64-unknown-linux-gnu.tar.gz"
+ sha256 "$X86_64_UNKNOWN_LINUX_GNU_SHA256"
+ elsif OS.linux? and Hardware::CPU.arm? and Hardware::CPU.is_64_bit?
+ url "#{src_repo}/releases/download/v#{version}/#{package_name}_#{version}_aarch64-unknown-linux-gnu.tar.gz"
+ sha256 "$AARCH64_UNKNOWN_LINUX_GNU_SHA256"
+ else
+ odie "Unsupported architecture"
+ end
+
+
+ def install
+ bin.install "unitctl"
+ man1.install "unitctl.1.gz"
+ end
+end