44 lines
1.2 KiB
Ruby
44 lines
1.2 KiB
Ruby
class Jsonschema2pojo < Formula
|
|
desc "Generates Java types from JSON Schema (or example JSON)"
|
|
homepage "https://www.jsonschema2pojo.org/"
|
|
url "https://github.com/joelittlejohn/jsonschema2pojo/releases/download/jsonschema2pojo-1.1.1/jsonschema2pojo-1.1.1.tar.gz"
|
|
sha256 "8d4bf09bc45d709941c6766cd336950a5b81fc53de401da92dab03942c91926b"
|
|
license "Apache-2.0"
|
|
|
|
livecheck do
|
|
url :stable
|
|
strategy :github_latest
|
|
regex(%r{href=.*?/tag/jsonschema2pojo[._-]v?(\d+(?:\.\d+)+)["' >]}i)
|
|
end
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
libexec.install "jsonschema2pojo-#{version}-javadoc.jar", "lib"
|
|
bin.write_jar_script libexec/"lib/jsonschema2pojo-cli-#{version}.jar", "jsonschema2pojo"
|
|
end
|
|
|
|
test do
|
|
(testpath/"src/jsonschema.json").write <<~EOS
|
|
{
|
|
"type":"object",
|
|
"properties": {
|
|
"foo": {
|
|
"type": "string"
|
|
},
|
|
"bar": {
|
|
"type": "integer"
|
|
},
|
|
"baz": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
}
|
|
EOS
|
|
system bin/"jsonschema2pojo", "-s", "src", "-t", testpath
|
|
assert_predicate testpath/"Jsonschema.java", :exist?, "Failed to generate Jsonschema.java"
|
|
end
|
|
end
|