51 lines
1.5 KiB
Ruby
51 lines
1.5 KiB
Ruby
class GoJsonnet < Formula
|
|
desc "Go implemention of configuration language for defining JSON data"
|
|
homepage "https://jsonnet.org/"
|
|
url "https://github.com/google/go-jsonnet/archive/v0.17.0.tar.gz"
|
|
sha256 "4fd04d0c9e38572ef388d28ea6b1ac151b8a9a5026ff94e3a68bdbc18c4db38a"
|
|
license "Apache-2.0"
|
|
head "https://github.com/google/go-jsonnet.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "23f5eb16c0d2b90ec651b9fb0e92d7aa1fa457bcde5fa0d4357e1693a93b4718" => :big_sur
|
|
sha256 "887524b030cf86ef63cef5157e420efda21d14826ad19060aa06c22aa38d1398" => :catalina
|
|
sha256 "97f7f9d9a73b46f100483396d228b158f6cbdeb85cb9d72406a6319f2ac11791" => :mojave
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
conflicts_with "jsonnet", because: "both install binaries with the same name"
|
|
|
|
def install
|
|
system "go", "build", "-o", bin/"jsonnet", "./cmd/jsonnet"
|
|
system "go", "build", "-o", bin/"jsonnetfmt", "./cmd/jsonnetfmt"
|
|
end
|
|
|
|
test do
|
|
(testpath/"example.jsonnet").write <<~EOS
|
|
{
|
|
person1: {
|
|
name: "Alice",
|
|
welcome: "Hello " + self.name + "!",
|
|
},
|
|
person2: self.person1 { name: "Bob" },
|
|
}
|
|
EOS
|
|
|
|
expected_output = {
|
|
"person1" => {
|
|
"name" => "Alice",
|
|
"welcome" => "Hello Alice!",
|
|
},
|
|
"person2" => {
|
|
"name" => "Bob",
|
|
"welcome" => "Hello Bob!",
|
|
},
|
|
}
|
|
|
|
output = shell_output("#{bin}/jsonnet #{testpath}/example.jsonnet")
|
|
assert_equal expected_output, JSON.parse(output)
|
|
end
|
|
end
|