|
| 1 | +class Openapi < Formula |
| 2 | + desc "CLI tools for working with OpenAPI, Arazzo and Overlay specifications" |
| 3 | + homepage "https://github.com/speakeasy-api/openapi" |
| 4 | + url "https://github.com/speakeasy-api/openapi/archive/refs/tags/v1.6.1.tar.gz" |
| 5 | + sha256 "2d1cb22b79b515ba0faefdb721b2d199f8094d76badb671ead88bd1454e76e10" |
| 6 | + license "MIT" |
| 7 | + head "https://github.com/speakeasy-api/openapi.git", branch: "main" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "abde836a07dc5738b01357bbbacd940ebe2d44c865847de49cbd79926e4ffdb9" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "abde836a07dc5738b01357bbbacd940ebe2d44c865847de49cbd79926e4ffdb9" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "abde836a07dc5738b01357bbbacd940ebe2d44c865847de49cbd79926e4ffdb9" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "d4a892baf5ce8d9dd057fa4ec3aef81e50053a3b3da0c2df912fbd1ca0f80d04" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "d4a892baf5ce8d9dd057fa4ec3aef81e50053a3b3da0c2df912fbd1ca0f80d04" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "982630ddd89b591763d41cd0f31c2cede134f78f46aab1be6f111e01600aad9a" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "go" => :build |
| 19 | + |
| 20 | + def install |
| 21 | + ldflags = %W[ |
| 22 | + -s -w |
| 23 | + -X main.version=#{version} |
| 24 | + -X main.commit=#{stable.specs[:revision]} |
| 25 | + -X main.date=#{time.iso8601} |
| 26 | + ] |
| 27 | + system "go", "build", *std_go_args(ldflags:), "./cmd/openapi" |
| 28 | + |
| 29 | + generate_completions_from_executable(bin/"openapi", "completion", shells: [:bash, :zsh, :fish, :pwsh]) |
| 30 | + end |
| 31 | + |
| 32 | + test do |
| 33 | + assert_match version.to_s, shell_output("#{bin}/openapi --version") |
| 34 | + |
| 35 | + system bin/"openapi", "spec", "bootstrap", "test-api.yaml" |
| 36 | + assert_path_exists testpath/"test-api.yaml" |
| 37 | + |
| 38 | + system bin/"openapi", "spec", "validate", "test-api.yaml" |
| 39 | + end |
| 40 | +end |
0 commit comments