|
| 1 | +class PrismCli < Formula |
| 2 | + desc "Set of packages for API mocking and contract testing" |
| 3 | + homepage "https://stoplight.io/open-source/prism" |
| 4 | + url "https://registry.npmjs.org/@stoplight/prism-cli/-/prism-cli-5.12.0.tgz" |
| 5 | + sha256 "43eef5f8b30f0da3d27f4d7dcd539fe91d0f0adfa2c8c5cef7d7e95601113cf4" |
| 6 | + license "Apache-2.0" |
| 7 | + |
| 8 | + bottle do |
| 9 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "13c54a7c8d5e0ada56a59a40b42c65915f9b5df39f46e03a093a491272b06d07" |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "13c54a7c8d5e0ada56a59a40b42c65915f9b5df39f46e03a093a491272b06d07" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "13c54a7c8d5e0ada56a59a40b42c65915f9b5df39f46e03a093a491272b06d07" |
| 12 | + sha256 cellar: :any_skip_relocation, sonoma: "ec079ffe4838d0eef1b31982ed56f4f63884d7ade66e7ab75d3109c6ad17e8f4" |
| 13 | + sha256 cellar: :any_skip_relocation, ventura: "ec079ffe4838d0eef1b31982ed56f4f63884d7ade66e7ab75d3109c6ad17e8f4" |
| 14 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "13c54a7c8d5e0ada56a59a40b42c65915f9b5df39f46e03a093a491272b06d07" |
| 15 | + end |
| 16 | + |
| 17 | + depends_on "node" |
| 18 | + |
| 19 | + def install |
| 20 | + system "npm", "install", *std_npm_args |
| 21 | + bin.install_symlink Dir["#{libexec}/bin/*"] |
| 22 | + end |
| 23 | + |
| 24 | + test do |
| 25 | + port = free_port |
| 26 | + pid = spawn bin/"prism", "mock", "--port", port.to_s, "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/refs/heads/main/tests/v3.0/pass/petstore.yaml" |
| 27 | + |
| 28 | + sleep 5 |
| 29 | + sleep 10 if OS.mac? && Hardware::CPU.intel? |
| 30 | + |
| 31 | + system "curl", "http://127.0.0.1:#{port}/pets" |
| 32 | + |
| 33 | + assert_match version.to_s, shell_output("#{bin}/prism --version") |
| 34 | + ensure |
| 35 | + Process.kill("TERM", pid) |
| 36 | + Process.wait(pid) |
| 37 | + end |
| 38 | +end |
0 commit comments