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

43 lines
1.1 KiB
Ruby

require "language/node"
class PurescriptLanguageServer < Formula
desc "Language Server Protocol server for PureScript"
homepage "https://github.com/nwolverson/purescript-language-server"
url "https://registry.npmjs.org/purescript-language-server/-/purescript-language-server-0.17.1.tgz"
sha256 "139bc898210ae77342fbfd9d93de3be2c36368319be8840be8952182ed62b1bf"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "381f05121b322f200c6e9416965f059b988958b3bf7ea0a1fd42d32ab8287a0c"
end
depends_on "node"
depends_on "purescript"
def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
require "open3"
json = <<~JSON
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"rootUri": null,
"capabilities": {}
}
}
JSON
Open3.popen3("#{bin}/purescript-language-server", "--stdio") do |stdin, stdout|
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
assert_match(/^Content-Length: \d+/i, stdout.readline)
end
end
end