2015-08-18 17:59:58 +00:00
|
|
|
class Jsonnet < Formula
|
|
|
|
desc "Domain specific configuration language for defining JSON data."
|
|
|
|
homepage "https://google.github.io/jsonnet/doc/"
|
2016-05-06 19:05:57 +00:00
|
|
|
url "https://github.com/google/jsonnet/archive/v0.8.8.tar.gz"
|
|
|
|
sha256 "668f4ffe1796d22902a485e0c383c1e149dcf7b5364c1bd79e48d8a62b4943b9"
|
2015-08-18 17:59:58 +00:00
|
|
|
|
2015-09-26 15:53:23 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-05-06 21:40:03 +00:00
|
|
|
sha256 "3e398400d16ad859db77f6c0f5150369fa355c3e50d47971cc339292ef5c15b5" => :el_capitan
|
|
|
|
sha256 "c1193f9c7e550643f90b3e18708287424430729e4ff266ec47dcd78d48e4794a" => :yosemite
|
|
|
|
sha256 "9de0592ed42f1af11a850a3297225b457f72d03428bc37cb33da1cbb95e15fc7" => :mavericks
|
2015-09-26 15:53:23 +00:00
|
|
|
end
|
|
|
|
|
2015-08-18 17:59:58 +00:00
|
|
|
needs :cxx11
|
|
|
|
|
|
|
|
depends_on :macos => :mavericks
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.cxx11
|
|
|
|
system "make"
|
|
|
|
bin.install "jsonnet"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-01-06 20:37:05 +00:00
|
|
|
require "utils/json"
|
2015-08-18 17:59:58 +00:00
|
|
|
|
|
|
|
(testpath/"example.jsonnet").write <<-EOS
|
|
|
|
{
|
|
|
|
person1: {
|
|
|
|
name: "Alice",
|
|
|
|
welcome: "Hello " + self.name + "!",
|
|
|
|
},
|
|
|
|
person2: self.person1 { name: "Bob" },
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
2016-01-06 20:37:05 +00:00
|
|
|
expected_output = {
|
|
|
|
"person1" => {
|
|
|
|
"name" => "Alice",
|
2016-05-06 19:05:57 +00:00
|
|
|
"welcome" => "Hello Alice!",
|
2016-01-06 20:37:05 +00:00
|
|
|
},
|
|
|
|
"person2" => {
|
|
|
|
"name" => "Bob",
|
2016-05-06 19:05:57 +00:00
|
|
|
"welcome" => "Hello Bob!",
|
|
|
|
},
|
2016-01-06 20:37:05 +00:00
|
|
|
}
|
2015-08-18 17:59:58 +00:00
|
|
|
|
|
|
|
output = shell_output("#{bin}/jsonnet #{testpath}/example.jsonnet")
|
2016-01-06 20:37:05 +00:00
|
|
|
assert_equal expected_output, Utils::JSON.load(output)
|
2015-08-18 17:59:58 +00:00
|
|
|
end
|
|
|
|
end
|