homebrew-core/Formula/conftest.rb

24 lines
935 B
Ruby
Raw Normal View History

class Conftest < Formula
desc "Test your configuration files using Open Policy Agent"
homepage "https://www.conftest.dev/"
url "https://github.com/open-policy-agent/conftest/archive/v0.23.0.tar.gz"
sha256 "116bfd3c00fcaa31a3468cace6df5b03eeff0150d0d096aee53dd74c7c9647bd"
license "Apache-2.0"
head "https://github.com/open-policy-agent/conftest.git"
depends_on "go" => :build
def install
system "go", "build", *std_go_args(ldflags: "-X github.com/open-policy-agent/conftest/internal/commands.version=#{version}")
end
test do
assert_match "Test your configuration files using Open Policy Agent", shell_output("#{bin}/conftest --help")
# Using the policy parameter changes the default location to look for policies.
# If no policies are found, a non-zero status code is returned.
(testpath/"test.rego").write("package main")
system "#{bin}/conftest", "verify", "-p", "test.rego"
end
end