homebrew-core/Formula/clojure-lsp.rb

45 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-20201009T224414",
revision: "a6803d9a329961764956c7bdc05a379cd09fa3d0"
version "20201009T224414"
license "MIT"
revision 1
head "https://github.com/snoe/clojure-lsp.git"
bottle do
cellar :any_skip_relocation
sha256 "4ecead5fe9522b71166075b3eb40ff9194fd4bc5f5534eb08d5c2525a89c93c0" => :catalina
sha256 "7c39d1f1b3cf68f04b8dcd10024d1c7669c3d0fb540665c938c03a4faff81fc8" => :mojave
sha256 "713e1b16819bae5f60936e27ae604b83145c681aef453f7fe98319f0a1e96a51" => :high_sierra
end
depends_on "leiningen" => :build
# The Java Runtime version only recognizes class file versions up to 52.0
depends_on "openjdk@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"
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")
Process.kill "SIGKILL", pid
end
end