2015-07-21 01:29:06 +00:00
|
|
|
class Jsonschema2pojo < Formula
|
|
|
|
desc "Generates Java types from JSON Schema (or example JSON)"
|
|
|
|
homepage "http://www.jsonschema2pojo.org/"
|
2016-09-27 13:49:35 +00:00
|
|
|
url "https://github.com/joelittlejohn/jsonschema2pojo/releases/download/jsonschema2pojo-0.4.27/jsonschema2pojo-0.4.27.tar.gz"
|
|
|
|
sha256 "b31d6371277da8f3e96f6e74ef4431084d5b5219d7cbc7eac6b318d38c6f8d44"
|
2015-07-21 01:29:06 +00:00
|
|
|
|
2015-10-23 12:00:19 +00:00
|
|
|
bottle :unneeded
|
|
|
|
|
2016-09-24 15:45:48 +00:00
|
|
|
depends_on :java => "1.6+"
|
2015-07-21 01:29:06 +00:00
|
|
|
|
|
|
|
def install
|
2016-07-18 08:06:30 +00:00
|
|
|
libexec.install %W[jsonschema2pojo-cli-#{version}.jar lib]
|
|
|
|
bin.write_jar_script libexec/"jsonschema2pojo-cli-#{version}.jar", "jsonschema2pojo"
|
2015-07-21 01:29:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-07-18 08:06:30 +00:00
|
|
|
(testpath/"src/jsonschema.json").write <<-EOS.undent
|
2015-07-21 01:29:06 +00:00
|
|
|
{
|
|
|
|
"type":"object",
|
|
|
|
"properties": {
|
|
|
|
"foo": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"bar": {
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"baz": {
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOS
|
2016-07-18 08:06:30 +00:00
|
|
|
system bin/"jsonschema2pojo", "-s", "src", "-t", testpath
|
|
|
|
assert File.exist?("Jsonschema.java"), "Failed to generate Jsonschema.java"
|
2015-07-21 01:29:06 +00:00
|
|
|
end
|
|
|
|
end
|