class SwaggerCodegen < Formula desc "Generate clients, server stubs, and docs from an OpenAPI spec" homepage "https://swagger.io/swagger-codegen/" url "https://github.com/swagger-api/swagger-codegen/archive/v3.0.3.tar.gz" sha256 "6b6e3e892ac32e329eab0f95d824257b628f7dcf6b7d31097c6099593234309f" head "https://github.com/swagger-api/swagger-codegen.git" bottle do cellar :any_skip_relocation sha256 "60825fac6d6996854f48c315f613dc9c3ff445f12a04019831d19e37d3dda79b" => :mojave sha256 "fd34374939e14763e276b9360a3e299501ba889007780048454a08cfb86a00f1" => :high_sierra sha256 "b53225cc14072d989e87075c3fc4f0db908444971b26edd16e6b6a30af8f96c0" => :sierra end depends_on "maven" => :build 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 system "mvn", "clean", "package" libexec.install "modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" bin.write_jar_script libexec/"swagger-codegen-cli.jar", "swagger-codegen" end test do (testpath/"minimal.yaml").write <<~EOS --- openapi: 3.0.0 info: version: 0.0.0 title: Simple API paths: /: get: responses: 200: description: OK EOS system "#{bin}/swagger-codegen", "generate", "-i", "minimal.yaml", "-l", "html" assert_includes File.read(testpath/"index.html"), "

Simple API

" end end