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.28.1.tgz"
sha256 "1a7a6170da3d2efabdfdf7bcc35873723733e40223aef6180bf2b8257308574c"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "aef43dde992da295db35a12094a40a5be61e2daea48f23026776fab7089215ce"
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