homebrew-core/Formula/neovim-remote.rb

71 lines
2.9 KiB
Ruby

class NeovimRemote < Formula
include Language::Python::Virtualenv
desc "Control nvim processes using `nvr` command-line tool"
homepage "https://github.com/mhinz/neovim-remote"
url "https://files.pythonhosted.org/packages/69/50/4fe9ef6fd794929ceae73e476ac8a4ddbf3b0913fa248d834c9bb72978b7/neovim-remote-2.5.1.tar.gz"
sha256 "4b3cc35463544c5747c895c52a0343cfdbba15d307647d7f57f1cce0c6a27d02"
license "MIT"
head "https://github.com/mhinz/neovim-remote.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "70fd1dc7d92012d97b9f93321c28b5153507bf6708161c5c6769e53c98224541"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "7e041bfc51360e3324177bef8536b3a2fae05f2343223b4961a63fb4183114a7"
sha256 cellar: :any_skip_relocation, monterey: "4d8eca98889cfb7fcd2b4198136b084b3c8e8cce25abe27e6406ed2f708404fa"
sha256 cellar: :any_skip_relocation, big_sur: "5029b2d27bfa64527011105a15f9094bbf6a42e5834296e3638a9fe6b218aa1d"
sha256 cellar: :any_skip_relocation, catalina: "298e97c28e94dda82cfa139e5bd9e2ef474e8b5b0d8c53540208ab8b0cb8885b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "ab19308790c8e99c6dab4677699978555e5ec60c757ce6deffba8621eb1b0152"
end
depends_on "neovim"
depends_on "python@3.10"
resource "greenlet" do
url "https://files.pythonhosted.org/packages/0c/10/754e21b5bea89d0e73f99d60c83754df7cc64db74f47d98ab187669ce341/greenlet-1.1.2.tar.gz"
sha256 "e30f5ea4ae2346e62cedde8794a56858a67b878dd79f7df76a0767e356b1744a"
end
resource "msgpack" do
url "https://files.pythonhosted.org/packages/61/3c/2206f39880d38ca7ad8ac1b28d2d5ca81632d163b2d68ef90e46409ca057/msgpack-1.0.3.tar.gz"
sha256 "51fdc7fb93615286428ee7758cecc2f374d5ff363bdd884c7ea622a7a327a81e"
end
resource "psutil" do
url "https://files.pythonhosted.org/packages/47/b6/ea8a7728f096a597f0032564e8013b705aa992a0990becd773dcc4d7b4a7/psutil-5.9.0.tar.gz"
sha256 "869842dbd66bb80c3217158e629d6fceaecc3a3166d3d1faee515b05dd26ca25"
end
resource "pynvim" do
url "https://files.pythonhosted.org/packages/7a/01/2d0898ba6cefbe2736283ee3155cba1c602de641ca5667ac55a0e4857276/pynvim-0.4.3.tar.gz"
sha256 "3a795378bde5e8092fbeb3a1a99be9c613d2685542f1db0e5c6fd467eed56dff"
end
def install
virtualenv_install_with_resources
end
test do
socket = testpath/"nvimsocket"
file = testpath/"test.txt"
ENV["NVIM_LISTEN_ADDRESS"] = socket
nvim = spawn(
{ "NVIM_LISTEN_ADDRESS" => socket },
Formula["neovim"].opt_bin/"nvim", "--headless", "-i", "NONE", "-u", "NONE", file,
[:out, :err] => "/dev/null"
)
sleep 5
str = "Hello from neovim-remote!"
system bin/"nvr", "--remote-send", "i#{str}<esc>:write<cr>"
assert_equal str, file.read.chomp
assert_equal Process.kill(0, nvim), 1
system bin/"nvr", "--remote-send", ":quit<cr>"
# Test will be terminated by the timeout
# if `:quit` was not sent correctly
Process.wait nvim
end
end