forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgenerate-json-schema.rb
41 lines (37 loc) · 1.16 KB
/
generate-json-schema.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class GenerateJsonSchema < Formula
desc "Generate a JSON Schema from Sample JSON"
homepage "https://github.com/Nijikokun/generate-schema"
url "https://registry.npmjs.org/generate-schema/-/generate-schema-2.6.0.tgz"
sha256 "1ddbf91aab2d649108308d1de7af782d9270a086919edb706f48d0216d51374a"
license "MIT"
head "https://github.com/Nijikokun/generate-schema.git", branch: "master"
bottle do
rebuild 3
sha256 cellar: :any_skip_relocation, all: "455469fbc5354030c4c7e62fcaba25fb9610bd32078ced0b95502195f9b6972a"
end
depends_on "node"
def install
system "npm", "install", *std_npm_args
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
(testpath/"test.json").write <<~JSON
{
"id": 2,
"name": "An ice sculpture",
"price": 12.50,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
}
}
JSON
assert_match "schema.org", shell_output("#{bin}/generate-schema test.json", 1)
end
end