homebrew-core/Formula/commitlint.rb

30 lines
910 B
Ruby
Raw Normal View History

require "language/node"
class Commitlint < Formula
desc "Lint commit messages according to a commit convention"
homepage "https://commitlint.js.org/#/"
url "https://registry.npmjs.org/commitlint/-/commitlint-17.1.2.tgz"
sha256 "aca659da30c4c3e25483fca656f60b35b521f397f1edf5fb4d5eaaf2a65d83e3"
license "MIT"
head "https://github.com/conventional-changelog/commitlint.git", branch: "master"
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/"commitlint.config.js").write <<~EOS
module.exports = {
rules: {
'type-enum': [2, 'always', ['foo']],
},
};
EOS
assert_match version.to_s, shell_output("#{bin}/commitlint --version")
assert_equal "", pipe_output("#{bin}/commitlint", "foo: message")
end
end