65 lines
2.9 KiB
Ruby
65 lines
2.9 KiB
Ruby
class Mcap < Formula
|
|
desc "Serialization-agnostic container file format for pub/sub messages"
|
|
homepage "https://mcap.dev"
|
|
url "https://github.com/foxglove/mcap/archive/releases/mcap-cli/v0.0.21.tar.gz"
|
|
sha256 "e18c322084069e96afcfd47c2255f64eb5656e164e65f9306213b875b53fe442"
|
|
license "MIT"
|
|
head "https://github.com/foxglove/mcap.git", branch: "main"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(%r{^releases/mcap-cli/v?(\d+(?:\.\d+)+)$}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_monterey: "ec310431331d37ad3ce14b0c3ea422ea8d7aca33b4c50577c08677ff7592b6c2"
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "9769169b79b63b169efcd36ddd3fa7314ce76f1c28747796625b23e2ef76c2ea"
|
|
sha256 cellar: :any_skip_relocation, monterey: "4a0816fae25df1703094d8ffa5cb92f3c9cfd6029c27dd005361e5a63513843b"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "9555cb00b98f193154482b397b6b8830c5ffe59f4a37b49e57f8208b808e271a"
|
|
sha256 cellar: :any_skip_relocation, catalina: "20b454e149b2f09edf95ee0dce8bac52ed0cc10219c9eb442549382f7de67799"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "8f3da8b41c3b024fbeb59cf786fa2fa916d3cb7c0b0d3a446d03024fe1ffae69"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
resource "homebrew-testdata-OneMessage" do
|
|
url "https://github.com/foxglove/mcap/raw/releases/mcap-cli/v0.0.20/tests/conformance/data/OneMessage/OneMessage-ch-chx-mx-pad-rch-rsh-st-sum.mcap"
|
|
sha256 "16e841dbae8aae5cc6824a63379c838dca2e81598ae08461bdcc4e7334e11da4"
|
|
end
|
|
|
|
resource "homebrew-testdata-OneAttachment" do
|
|
url "https://github.com/foxglove/mcap/raw/releases/mcap-cli/v0.0.20/tests/conformance/data/OneAttachment/OneAttachment-ax-pad-st-sum.mcap"
|
|
sha256 "f9dde0a5c9f7847e145be73ea874f9cdf048119b4f716f5847513ee2f4d70643"
|
|
end
|
|
|
|
resource "homebrew-testdata-OneMetadata" do
|
|
url "https://github.com/foxglove/mcap/raw/releases/mcap-cli/v0.0.20/tests/conformance/data/OneMetadata/OneMetadata-mdx-pad-st-sum.mcap"
|
|
sha256 "cb779e0296d288ad2290d3c1911a77266a87c0bdfee957049563169f15d6ba8e"
|
|
end
|
|
|
|
def install
|
|
cd "go/cli/mcap" do
|
|
system "make", "build", "VERSION=v#{version}"
|
|
bin.install "bin/mcap"
|
|
end
|
|
generate_completions_from_executable(bin/"mcap", "completion", shells: [:bash, :zsh, :fish])
|
|
end
|
|
|
|
test do
|
|
assert_equal "v#{version}", shell_output("#{bin}/mcap version").strip
|
|
|
|
resource("homebrew-testdata-OneMessage").stage do
|
|
assert_equal "2 example [Example] [1 2 3]",
|
|
shell_output("#{bin}/mcap cat OneMessage-ch-chx-mx-pad-rch-rsh-st-sum.mcap").strip
|
|
end
|
|
resource("homebrew-testdata-OneAttachment").stage do
|
|
assert_equal "\x01\x02\x03",
|
|
shell_output("#{bin}/mcap get attachment OneAttachment-ax-pad-st-sum.mcap --name myFile")
|
|
end
|
|
resource("homebrew-testdata-OneMetadata").stage do
|
|
assert_equal({ "foo" => "bar" },
|
|
JSON.parse(shell_output("#{bin}/mcap get metadata OneMetadata-mdx-pad-st-sum.mcap --name myMetadata")))
|
|
end
|
|
end
|
|
end
|