From 0606ddcabb91c90a6597e0fee885607d7c09f106 Mon Sep 17 00:00:00 2001 From: BastianZim <10774221+BastianZim@users.noreply.github.com> Date: Sun, 27 Dec 2020 12:04:08 +0100 Subject: [PATCH] mermaid-cli 8.8.4 (new formula) * mermaid-cli 8.8.4 (new formula) * mermaid-cli 8.8.4 (new formula) mermaid-cli 8.8.4 (new formula) Add bin to test Closes #67804. Co-authored-by: Dawid Dziurla Co-authored-by: Bastian Zimmermann <10774221+BastianZim@users.noreply.github.com> Signed-off-by: chenrui --- Formula/mermaid-cli.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Formula/mermaid-cli.rb diff --git a/Formula/mermaid-cli.rb b/Formula/mermaid-cli.rb new file mode 100644 index 0000000000000..c0019af5332ff --- /dev/null +++ b/Formula/mermaid-cli.rb @@ -0,0 +1,42 @@ +require "language/node" + +class MermaidCli < Formula + desc "Command-line interface (CLI) for mermaid" + homepage "https://github.com/mermaid-js/mermaid-cli" + url "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-8.8.4.tgz" + sha256 "d56089a4e82c0c2bba00397bd7ee73164338da32b8e1c381518242a00e29689b" + license "MIT" + + depends_on "node" + + def install + system "npm", "install", *Language::Node.std_npm_install_args(libexec) + bin.install_symlink Dir["#{libexec}/bin/*"] + end + + test do + (testpath/"test.mmd").write <<~EOS + sequenceDiagram + participant Alice + participant Bob + Alice->>John: Hello John, how are you? + loop Healthcheck + John->>John: Fight against hypochondria + end + Note right of John: Rational thoughts
prevail! + John-->>Alice: Great! + John->>Bob: How about you? + Bob-->>John: Jolly good! + EOS + + (testpath/"puppeteer-config.json").write <<~EOS + { + "args": ["--no-sandbox"] + } + EOS + + system bin/"mmdc", "-p", "puppeteer-config.json", "-i", "#{testpath}/test.mmd", "-o", "#{testpath}/out.svg" + + assert_predicate testpath/"out.svg", :exist? + end +end