homebrew-core/Formula/dcd.rb

53 lines
2.1 KiB
Ruby

class Dcd < Formula
desc "Auto-complete program for the D programming language"
homepage "https://github.com/dlang-community/DCD"
url "https://github.com/dlang-community/DCD.git",
tag: "v0.13.6",
revision: "02acaa534b9be65142aed7b202a6a8d5524abf2a"
license "GPL-3.0-or-later"
head "https://github.com/dlang-community/dcd.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_ventura: "5ffdfedffcd4042b0a465b01ec5c9d0ded3e0f0cad6e39b361b851e5d298d32f"
sha256 cellar: :any_skip_relocation, arm64_monterey: "56500aa45f06a73e05c97dc0162ded325510615148e59cda54ef9e9187951a39"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "7e2b6351728ee0dad099824dd51e31042a3f66f3e66695063530e115e1e3e44e"
sha256 cellar: :any_skip_relocation, ventura: "e4bea961c017d7686de1ffaa9cd1ac55ac31e64cd668d81dba5a98f4f72142f5"
sha256 cellar: :any_skip_relocation, monterey: "9e223a3fef8a39d75bbec9012bfa534d50772aa2d536857160c39221fe08f5bb"
sha256 cellar: :any_skip_relocation, big_sur: "e97405796485c96ea4dd9f7458cd548ed609f61ed8d5e006fb73ec00072d0811"
sha256 cellar: :any_skip_relocation, catalina: "1455dd1a3d4919d261c6cc8a73d05f62f4436f17b66d8790db249bcf4fbdcc6f"
sha256 cellar: :any_skip_relocation, mojave: "484f3c51a322172c8bab3cfa850685f91ce9dfdcccc85daeedead97cc63f13e1"
sha256 cellar: :any_skip_relocation, x86_64_linux: "58b613aa6a40fb855b592944f97bc7d66cbf87ee30e2243fd4e1551536b02d4f"
end
on_macos do
depends_on "ldc" => :build
end
on_linux do
depends_on "dmd" => :build
end
def install
target = OS.mac? ? "ldc" : "dmd"
system "make", target
bin.install "bin/dcd-client", "bin/dcd-server"
end
test do
port = free_port
# spawn a server, using a non-default port to avoid
# clashes with pre-existing dcd-server instances
server = fork do
exec "#{bin}/dcd-server", "-p", port.to_s
end
# Give it generous time to load
sleep 0.5
# query the server from a client
system "#{bin}/dcd-client", "-q", "-p", port.to_s
ensure
Process.kill "TERM", server
Process.wait server
end
end