43 lines
1.1 KiB
Ruby
43 lines
1.1 KiB
Ruby
require "language/node"
|
|
|
|
class AnsibleLanguageServer < Formula
|
|
desc "Language Server for Ansible Files"
|
|
homepage "https://github.com/ansible/ansible-language-server"
|
|
url "https://registry.npmjs.org/@ansible/ansible-language-server/-/ansible-language-server-1.0.2.tgz"
|
|
sha256 "84de1c97a72aded93de230565994c9f550c532e4ac524c5ca5e71084271a5b13"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "026a2fbddbce7bd21f6ca343254b4df57eb60ef0fc11950a00cb152d1d655cd5"
|
|
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
|
|
require "open3"
|
|
|
|
json = <<~JSON
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"id": 1,
|
|
"method": "initialize",
|
|
"params": {
|
|
"rootUri": null,
|
|
"capabilities": {}
|
|
}
|
|
}
|
|
JSON
|
|
|
|
Open3.popen3("#{bin}/ansible-language-server", "--stdio") do |stdin, stdout|
|
|
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
|
|
sleep 3
|
|
assert_match(/^Content-Length: \d+/i, stdout.readline)
|
|
end
|
|
end
|
|
end
|