47 lines
1.4 KiB
Ruby
47 lines
1.4 KiB
Ruby
class ClojureLsp < Formula
|
|
desc "Language Server (LSP) for Clojure"
|
|
homepage "https://github.com/snoe/clojure-lsp"
|
|
# Switch to use git tag/revision as needed by `lein-git-version`
|
|
url "https://github.com/snoe/clojure-lsp.git",
|
|
tag: "release-20200706T152722",
|
|
revision: "2ced4b1f218223e4bcf534866021be5574fcf3cd"
|
|
version "20200706T152722"
|
|
license "MIT"
|
|
head "https://github.com/snoe/clojure-lsp.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "9fba43cf1c7c6da52e20aea0b31d542642107ab5d38019ed7b30c126462e0f16" => :catalina
|
|
sha256 "bc81ca815f623bde094b13d92516932690d91a4ac4ba2d143d53c97154c042d6" => :mojave
|
|
sha256 "a6050c2e6c7e3a21fc047ff3e1498995816754904a9506424079d87c424122b9" => :high_sierra
|
|
end
|
|
|
|
depends_on "leiningen" => :build
|
|
# The Java Runtime version only recognizes class file versions up to 52.0
|
|
depends_on java: "1.8"
|
|
|
|
def install
|
|
system "lein", "uberjar"
|
|
jar = Dir["target/clojure-lsp-*-standalone.jar"][0]
|
|
libexec.install jar
|
|
bin.write_jar_script libexec/File.basename(jar), "clojure-lsp"
|
|
end
|
|
|
|
test do
|
|
require "Open3"
|
|
|
|
begin
|
|
stdin, stdout, _, wait_thr = Open3.popen3("#{bin}/clojure-lsp")
|
|
pid = wait_thr.pid
|
|
stdin.write <<~EOF
|
|
Content-Length: 58
|
|
|
|
{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}
|
|
EOF
|
|
assert_match "Content-Length", stdout.gets("\n")
|
|
ensure
|
|
Process.kill "SIGKILL", pid
|
|
end
|
|
end
|
|
end
|