homebrew-core/Formula/bash-language-server.rb

38 lines
1.0 KiB
Ruby

require "language/node"
class BashLanguageServer < Formula
desc "Language Server for Bash"
homepage "https://github.com/bash-lsp/bash-language-server"
url "https://registry.npmjs.org/bash-language-server/-/bash-language-server-4.1.2.tgz"
sha256 "04bfc644ff8535035d6d9a0b4acf54f14289df8826e35bc7cdf7ea48169899fc"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "94eab98d90d02176860601e7aa1b6fd223951763b530bda4e2e8820b6671db8a"
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
json = <<~JSON
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"rootUri": null,
"capabilities": {}
}
}
JSON
input = "Content-Length: #{json.size}\r\n\r\n#{json}"
output = pipe_output("#{bin}/bash-language-server start", input, 0)
assert_match(/^Content-Length: \d+/i, output)
end
end