homebrew-core/Formula/signal-cli.rb

33 lines
1014 B
Ruby

class SignalCli < Formula
desc "CLI and dbus interface for WhisperSystems/libsignal-service-java"
homepage "https://github.com/AsamK/signal-cli"
url "https://github.com/AsamK/signal-cli/releases/download/v0.6.10/signal-cli-0.6.10.tar.gz"
sha256 "35d65c080f7de25b7039188bb0a7b590b574a1ac04c53f251c4c62ea4b67f47d"
license "GPL-3.0-or-later"
bottle :unneeded
depends_on "openjdk"
def install
libexec.install Dir["lib", "bin"]
(bin/"signal-cli").write_env_script libexec/"bin/signal-cli", JAVA_HOME: Formula["openjdk"].opt_prefix
end
test do
# test 1: checks class loading is working and version is correct
output = shell_output("#{bin}/signal-cli --version")
assert_match "signal-cli #{version}", output
# test 2: ensure crypto is working
begin
io = IO.popen("#{bin}/signal-cli link", err: [:child, :out])
sleep 8
ensure
Process.kill("SIGINT", io.pid)
Process.wait(io.pid)
end
assert_match "tsdevice:/?uuid=", io.read
end
end