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 "http://www.jsonschema2pojo.org/"
|
|
url "https://github.com/joelittlejohn/jsonschema2pojo/releases/download/jsonschema2pojo-1.0.2/jsonschema2pojo-1.0.2.tar.gz"
|
|
sha256 "158e927558e3ae4779dc2b7cd00e2010e43465af5a5aebdb55c889ccacb4d6e3"
|
|
license "Apache-2.0"
|
|
revision 2
|
|
|
|
livecheck do
|
|
url "https://github.com/joelittlejohn/jsonschema2pojo/releases/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
|