homebrew-core/Formula/markdownlint-cli.rb

36 lines
1.1 KiB
Ruby

require "language/node"
class MarkdownlintCli < Formula
desc "CLI for Node.js style checker and lint tool for Markdown files"
homepage "https://github.com/igorshubovych/markdownlint-cli"
url "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.32.2.tgz"
sha256 "0a0dc00260b09102f8111ce33833b7c797cea419b14f955e5a24d82bf179553a"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "7be52e16473a658becde9b817f86c868bcb9e41e79856d9dce542218b9515860"
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 "MD022/blanks-around-headings/blanks-around-headers",
shell_output("#{bin}/markdownlint #{testpath}/test-bad.md 2>&1", 1)
assert_empty shell_output("#{bin}/markdownlint #{testpath}/test-good.md")
end
end