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.6.2.tgz"
sha256 "006deb99172532981d998ea05b995a8b2aa578092a36602f8f258a5710c5bebf"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "7fb86885ab83d18ac313002682b68c3f9282c00ac6223273cba71df73436a86b"
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