From 557741f9ec655186aa8591aea6e52c7a9e21549b 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 1/2] mermaid-cli 8.8.4 (new formula) --- 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..bc30be3894f1d --- /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 "mmdc", "-p", "puppeteer-config.json", "-i", "#{testpath}/test.mmd", "-o", "#{testpath}/out.svg" + + assert_predicate testpath/"out.svg", :exist? + end +end From 9ae6c0a130fdb9621c04c9ab9d7cc306ec85e46c Mon Sep 17 00:00:00 2001 From: Bastian Zimmermann <10774221+BastianZim@users.noreply.github.com> Date: Mon, 28 Dec 2020 11:00:08 +0100 Subject: [PATCH 2/2] mermaid-cli 8.8.4 (new formula) mermaid-cli 8.8.4 (new formula) Add bin to test Co-authored-by: Dawid Dziurla --- Formula/mermaid-cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/mermaid-cli.rb b/Formula/mermaid-cli.rb index bc30be3894f1d..c0019af5332ff 100644 --- a/Formula/mermaid-cli.rb +++ b/Formula/mermaid-cli.rb @@ -35,7 +35,7 @@ def install } EOS - system "mmdc", "-p", "puppeteer-config.json", "-i", "#{testpath}/test.mmd", "-o", "#{testpath}/out.svg" + system bin/"mmdc", "-p", "puppeteer-config.json", "-i", "#{testpath}/test.mmd", "-o", "#{testpath}/out.svg" assert_predicate testpath/"out.svg", :exist? end