Skip to content

Commit a3cf2ec

Browse files
committed
boa 0.20 (new formula)
Signed-off-by: Rui Chen <[email protected]>
1 parent f88bf06 commit a3cf2ec

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.github/autobump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ blueutil
320320
bluez
321321
bmake
322322
bnd
323+
boa
323324
bob
324325
bochs
325326
bold

Formula/b/boa.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class Boa < Formula
2+
desc "Embeddable and experimental Javascript engine written in Rust"
3+
homepage "https://github.com/boa-dev/boa"
4+
url "https://github.com/boa-dev/boa/archive/refs/tags/v0.20.tar.gz"
5+
sha256 "10cc1e8c8f62b6fb0b22ec2ddc7031715f99bd8bed6168b14c93a89cb8dab597"
6+
license any_of: ["MIT", "Unlicense"]
7+
head "https://github.com/boa-dev/boa.git", branch: "main"
8+
9+
depends_on "rust" => :build
10+
11+
def install
12+
system "cargo", "install", *std_cargo_args(path: "cli")
13+
end
14+
15+
test do
16+
assert_match version.to_s, shell_output("#{bin}/boa --version")
17+
18+
(testpath/"test.js").write <<~JS
19+
function factorial(n) {
20+
return n <= 1 ? 1 : n * factorial(n - 1);
21+
}
22+
console.log(`Factorial of 5 is: ${factorial(5)}`);
23+
JS
24+
25+
output = shell_output("#{bin}/boa #{testpath}/test.js")
26+
assert_match "Factorial of 5 is: 120", output
27+
end
28+
end

0 commit comments

Comments
 (0)