homebrew-core/Formula/autorest.rb

36 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.3.2.tgz"
sha256 "07b16e43c4618272482a1df08c7ec377e09ea2b7b3666b7f2105b60945aa1200"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "010ce652a01befea7f101d2dd601b6ddcccd60f6e8d21d7fcd8ada89561ede03"
end
depends_on arch: :x86_64
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