Skip to content

Commit

Permalink
noir: make crystal a build dep, add head
Browse files Browse the repository at this point in the history
  • Loading branch information
branchvincent committed Jan 25, 2025
1 parent e4ee666 commit 0d7da23
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Formula/n/noir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Noir < Formula
url "https://github.com/owasp-noir/noir/archive/refs/tags/v0.19.0.tar.gz"
sha256 "59d62446ce42797f3834a13f7453f80902d80c681e5b8f969dee9118a104b990"
license "MIT"
head "https://github.com/owasp-noir/noir.git", branch: "main"

bottle do
sha256 arm64_sequoia: "205b6311807258e529d6ae93ae60efefca6557aee64023f9e434fc1e28e6b3b5"
Expand All @@ -14,8 +15,9 @@ class Noir < Formula
sha256 x86_64_linux: "53773fc10ea1dc1056bfb4761ebc79707836ef9a995de4b240d8094c235f2bfc"
end

depends_on "crystal" => :build
depends_on "pkgconf" => :build
depends_on "bdw-gc"
depends_on "crystal"
depends_on "libevent"
depends_on "libyaml"
depends_on "openssl@3"
Expand All @@ -24,19 +26,27 @@ class Noir < Formula
uses_from_macos "zlib"

def install
system "shards", "install"
system "shards", "build", "--release", "--no-debug"
system "shards", "build", "--production", "--release", "--no-debug"
bin.install "bin/noir"

generate_completions_from_executable(bin/"noir", shell_parameter_format: "--generate-completion=",
shells: [:bash, :zsh, :fish])
generate_completions_from_executable(bin/"noir", "--generate-completion")
end

test do
assert_match version.to_s, shell_output("#{bin}/noir --version")

system "git", "clone", "https://github.com/owasp-noir/noir.git"
output = shell_output("#{bin}/noir -b noir 2>&1")
(testpath/"api.py").write <<~PYTHON
from fastapi import FastAPI
app = FastAPI()
@app.get("/hello")
def hello():
return {"Hello": "World"}
PYTHON

output = shell_output("#{bin}/noir --no-color --base-path . 2>&1")
assert_match "Generating Report.", output
assert_match "GET /hello", output
end
end

0 comments on commit 0d7da23

Please sign in to comment.