Skip to content

Commit 3024506

Browse files
committed
statesmith 0.17.5 (new formula)
1 parent 5749d1b commit 3024506

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Formula/s/statesmith.rb

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
class Statesmith < Formula
2+
desc "State machine code generation tool suitable for bare metal, embedded and more"
3+
homepage "https://github.com/StateSmith/StateSmith"
4+
url "https://github.com/StateSmith/StateSmith/archive/refs/tags/cli-v0.17.5.tar.gz"
5+
sha256 "185fc6c05c8c950153bb871ffdad6de47ebf2db18c4607cd4005662d5d9f79b6"
6+
license "Apache-2.0"
7+
8+
depends_on "dotnet"
9+
depends_on "icu4c@76"
10+
uses_from_macos "zlib"
11+
12+
def install
13+
dotnet_os = OS.mac? ? "osx" : "linux"
14+
dotnet_arch = Hardware::CPU.arm? ? "arm64" : "x64"
15+
dotnet_os_arch = "#{dotnet_os}-#{dotnet_arch}"
16+
17+
dotnet = Formula["dotnet"]
18+
args = %W[
19+
-c Release
20+
--framework net#{dotnet.version.major_minor}
21+
-p:Version=#{version}
22+
]
23+
24+
system "dotnet", "publish", "src/StateSmith.Cli", *args
25+
(bin/"ss.cli").write_env_script libexec/"StateSmith.Cli", DOTNET_ROOT: "${DOTNET_ROOT:-#{dotnet.opt_libexec}}"
26+
end
27+
28+
test do
29+
if OS.mac?
30+
# We have to do a different test on mac due to https://github.com/orgs/Homebrew/discussions/5966
31+
# Confirming that it fails as expected per the formula cookbook
32+
output = pipe_output("#{bin}/ss.cli --version 2>&1")
33+
assert_match "UnauthorizedAccessException", output
34+
else
35+
assert_match version.to_s, shell_output("#{bin}/ss.cli --version")
36+
37+
File.write("lightbulb.puml", <<~HERE)
38+
@startuml lightbulb
39+
[*] -> Off
40+
Off -> On : Switch
41+
On -> Off : Switch
42+
@enduml
43+
HERE
44+
45+
shell_output("#{bin}/ss.cli run --lang=JavaScript --no-ask --no-csx -h -b")
46+
assert_match version.to_s, File.read(testpath/"lightbulb.js")
47+
end
48+
end
49+
end

0 commit comments

Comments
 (0)