Skip to content

Commit 051d26a

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

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Formula/s/statesmith.rb

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
--no-self-contained
22+
--use-current-runtime
23+
-p:AppHostRelativeDotNet=#{dotnet.opt_libexec.relative_path_from(bin)}
24+
-p:Version=#{version}
25+
-p:PublishSingleFile=true
26+
]
27+
28+
chdir "src/StateSmith.Cli" do
29+
system "dotnet", "publish", *args
30+
31+
libexec.install "./bin/Release/net#{dotnet.version.major_minor}/#{dotnet_os_arch}/publish/StateSmith.Cli"
32+
end
33+
34+
(bin/"ss.cli").write_env_script libexec/"StateSmith.Cli", DOTNET_ROOT: "${DOTNET_ROOT:-#{dotnet.opt_libexec}}"
35+
end
36+
37+
test do
38+
if OS.mac?
39+
# We have to do a different test on mac due to https://github.com/orgs/Homebrew/discussions/5966
40+
# Confirming that it fails as expected per the formula cookbook
41+
output = pipe_output("#{bin}/ss.cli --version 2>&1")
42+
assert_match "UnauthorizedAccessException", output
43+
else
44+
assert_match version.to_s, shell_output("#{bin}/ss.cli --version")
45+
46+
File.write("lightbulb.puml", <<~HERE)
47+
@startuml lightbulb
48+
[*] -> Off
49+
Off -> On : Switch
50+
On -> Off : Switch
51+
@enduml
52+
HERE
53+
54+
shell_output("#{bin}/ss.cli run --lang=JavaScript --no-ask --no-csx -h -b")
55+
assert_match version.to_s, File.read(testpath/"lightbulb.js")
56+
end
57+
end
58+
end

0 commit comments

Comments
 (0)