/
markdownlint-cli2.rb
36 lines (30 loc) 路 1.06 KB
/
markdownlint-cli2.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "language/node"
class MarkdownlintCli2 < Formula
desc "Fast, flexible, config-based cli for linting Markdown/CommonMark files"
homepage "https://github.com/DavidAnson/markdownlint-cli2"
url "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.13.0.tgz"
sha256 "db7d09de0f934fb8146b5a2a01a819faf361aff36099de3030825d75ae1c4178"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "24bcd6ac3183471c29cf60683657f0996396e93e1ebda0cf3885770b21a4957f"
end
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-bad.md").write <<~EOS
# Header 1
body
EOS
(testpath/"test-good.md").write <<~EOS
# Header 1
body
EOS
assert_match "Summary: 1 error(s)",
shell_output("#{bin}/markdownlint-cli2 :#{testpath}/test-bad.md 2>&1", 1)
assert_match "Summary: 0 error(s)",
shell_output("#{bin}/markdownlint-cli2 :#{testpath}/test-good.md")
end
end