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.5.tgz"
sha256 "580285cf3d2902fd9d86c5a4bef13be10cf2a4bc1bf50dac7ed51a99dbc26246"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "842831f0cd20a3898d9ca4bf8040b92f5c4ef55736479349dd491daa9a24a1fd"
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