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.2.1.tgz"
sha256 "0a936c20613116faa9d23ebab289aa5300f6804523a3656d1ddbc8dae38eac20"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "c92fce756e8733de4ab57249cdc067f2b5c38e5bfb79fcfeaa83012f168d43d1"
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