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.13.tar.gz" sha256 "52affa2cf74d6e10c4a70da2c7b9621f7de1cc8ae4380d110a37ffc249066452" head "https://github.com/swagger-api/swagger-codegen.git" bottle do cellar :any_skip_relocation sha256 "6cec19b8cece012808c074b3396bba867200f5598af05c3cb58fe2b03ca6f3a9" => :catalina sha256 "2e514b12d8f058e9977b2f9e7e73f2c7bee3cbb8d2754057ea46090bdd207d31" => :mojave sha256 "162075201143d225c420496cdc5529093be529ebe4ad7ec1d7a7fa922bb35d4b" => :high_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