diff --git a/Formula/benthos.rb b/Formula/benthos.rb new file mode 100644 index 0000000000..57e4671574 --- /dev/null +++ b/Formula/benthos.rb @@ -0,0 +1,47 @@ +class Benthos < Formula + desc "Stream processor for mundane tasks written in Go" + homepage "https://www.benthos.dev" + url "https://github.com/Jeffail/benthos/archive/v2.9.3.tar.gz" + sha256 "40c8e53081ce6ea115dad574769f74b0cd7de467ec4f2212747d867bb10e96bc" + + depends_on "go" => :build + + def install + ENV["GOPATH"] = buildpath + ENV["GO111MODULE"] = "on" + + src = buildpath/"src/github.com/Jeffail/benthos" + src.install buildpath.children + src.cd do + system "make", "VERSION=#{version}" + bin.install "target/bin/benthos" + prefix.install_metafiles + end + end + + test do + (testpath/"sample.txt").write <<~EOS + QmVudGhvcyByb2NrcyE= + EOS + + (testpath/"test_pipeline.yaml").write <<~EOS + --- + logger: + level: ERROR + input: + type: file + file: + path: ./sample.txt + pipeline: + threads: 1 + processors: + - type: decode + decode: + scheme: base64 + output: + type: stdout + EOS + output = shell_output("#{bin}/benthos -c test_pipeline.yaml") + assert_match "Benthos rocks!", output.strip + end +end