32 lines
839 B
Ruby
32 lines
839 B
Ruby
|
class Tflint < Formula
|
||
|
desc "Linter for Terraform files"
|
||
|
homepage "https://github.com/wata727/tflint"
|
||
|
url "https://github.com/wata727/tflint/archive/v0.9.1.tar.gz"
|
||
|
sha256 "a4f9f845584c51b3d0db3d2ee9ab48435db52ade3ddde1a8689e2ad8cf9acdca"
|
||
|
head "https://github.com/wata727/tflint.git"
|
||
|
|
||
|
depends_on "go" => :build
|
||
|
|
||
|
def install
|
||
|
ENV["GOPATH"] = buildpath
|
||
|
ENV["GO111MODULE"] = "on"
|
||
|
|
||
|
dir = buildpath/"src/github.com/wata727/tflint"
|
||
|
dir.install buildpath.children
|
||
|
|
||
|
cd dir do
|
||
|
system "go", "build", "-o", bin/"tflint"
|
||
|
prefix.install_metafiles
|
||
|
end
|
||
|
end
|
||
|
|
||
|
test do
|
||
|
(testpath/"test.tf").write <<~EOS
|
||
|
provider "aws" {
|
||
|
region = "${var.aws_region}"
|
||
|
}
|
||
|
EOS
|
||
|
assert_match "Awesome! Your code is following the best practices :)", shell_output("#{bin}/tflint test.tf")
|
||
|
end
|
||
|
end
|