37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
require "language/node"
|
|
|
|
class Autorest < Formula
|
|
desc "Swagger (OpenAPI) Specification code generator"
|
|
homepage "https://github.com/Azure/autorest"
|
|
url "https://registry.npmjs.org/autorest/-/autorest-3.5.1.tgz"
|
|
sha256 "3361f0cf71b7013efb38376f65f973f0dfa83a86a59cfb749380344bcea8bdbe"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "42c2714757885b2ce0383b48ee0ae82ef1ba0e836bcc44706a9ea822cc0b09c4"
|
|
end
|
|
|
|
depends_on arch: :x86_64
|
|
depends_on :macos # test fails on Linux
|
|
depends_on "node"
|
|
|
|
resource "homebrew-petstore" do
|
|
url "https://raw.githubusercontent.com/Azure/autorest/5c170a02c009d032e10aa9f5ab7841e637b3d53b/Samples/1b-code-generation-multilang/petstore.yaml"
|
|
sha256 "e981f21115bc9deba47c74e5c533d92a94cf5dbe880c4304357650083283ce13"
|
|
end
|
|
|
|
def install
|
|
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
|
|
bin.install_symlink Dir["#{libexec}/bin/*"]
|
|
end
|
|
|
|
test do
|
|
resource("homebrew-petstore").stage do
|
|
system (bin/"autorest"), "--input-file=petstore.yaml",
|
|
"--nodejs",
|
|
"--output-folder=petstore"
|
|
assert_includes File.read("petstore/package.json"), "Microsoft Corporation"
|
|
end
|
|
end
|
|
end
|