openapi-generator 3.0.1 (new formula) (#28921)
This commit is contained in:
parent
ca4bbdc262
commit
7bc3bd1403
1 changed files with 47 additions and 0 deletions
47
Formula/openapi-generator.rb
Normal file
47
Formula/openapi-generator.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
class OpenapiGenerator < Formula
|
||||
desc "Generate clients, server & docs from an OpenAPI spec (v2, v3)"
|
||||
homepage "https://openapi-generator.tech/"
|
||||
url "https://search.maven.org/remotecontent?filepath=org/openapitools/openapi-generator-cli/3.0.1/openapi-generator-cli-3.0.1.jar"
|
||||
sha256 "f3a6fcb06abf19f955d9c9cd8c734e1ebcb5b93dfaa5dbbad5d98e0f2e2e0524"
|
||||
|
||||
head do
|
||||
url "https://github.com/OpenAPITools/openapi-generator.git"
|
||||
|
||||
depends_on "maven" => :build
|
||||
end
|
||||
|
||||
bottle :unneeded
|
||||
|
||||
depends_on :java => "1.8"
|
||||
|
||||
def install
|
||||
# Need to set JAVA_HOME manually since maven overrides 1.8 with 1.7+
|
||||
cmd = Language::Java.java_home_cmd("1.8")
|
||||
ENV["JAVA_HOME"] = Utils.popen_read(cmd).chomp
|
||||
if build.head?
|
||||
system "mvn", "clean", "package"
|
||||
libexec.install "modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
bin.write_jar_script libexec/"openapi-generator-cli.jar", "openapi-generator"
|
||||
else
|
||||
libexec.install "openapi-generator-cli-#{version}.jar"
|
||||
bin.write_jar_script libexec/"openapi-generator-cli-#{version}.jar", "openapi-generator"
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"minimal.yaml").write <<~EOS
|
||||
---
|
||||
swagger: '2.0'
|
||||
info:
|
||||
version: 0.0.0
|
||||
title: Simple API
|
||||
paths:
|
||||
/:
|
||||
get:
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
EOS
|
||||
system bin/"openapi-generator", "generate", "-i", "minimal.yaml", "-l", "openapi"
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue