homebrew-core/Formula/pueue.rb

82 lines
2.5 KiB
Ruby

class Pueue < Formula
desc "Command-line tool for managing long-running shell commands"
homepage "https://github.com/Nukesor/pueue"
url "https://github.com/Nukesor/pueue/archive/v0.8.2.tar.gz"
sha256 "8db2b7b27edb968889e2027dc6543225b07d37e61728e2bee1de441d5e5a9b7a"
license "MIT"
head "https://github.com/Nukesor/pueue.git"
bottle do
cellar :any_skip_relocation
sha256 "0047a2b401f158caa786a0c09852133ec0706ad6ecada4ce268b961a0f771649" => :big_sur
sha256 "500e8f1edd3fcfd712d7002cc9d957686c74cd229502e516bc35916e44b853ba" => :catalina
sha256 "125c355ddc8b304313b9c79462cc3793778359f426be6646b36be6111f46fd33" => :mojave
end
depends_on "rust" => :build
# remove in next release
patch do
url "https://github.com/Nukesor/pueue/commit/4a3c21953c0fe7553f4b0347d9012f997bd6b840.patch?full_index=1"
sha256 "bd9cc57aef24c2c84681b020beff1c8560a8ac14910aa789db3cc669ba7fd842"
end
def install
system "cargo", "install", *std_cargo_args
system "./build_completions.sh"
bash_completion.install "utils/completions/pueue.bash" => "pueue"
fish_completion.install "utils/completions/pueue.fish" => "pueue.fish"
prefix.install_metafiles
end
plist_options manual: "pueued"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/pueued</string>
<string>--verbose</string>
</array>
<key>KeepAlive</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/pueued.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/pueued.log</string>
</dict>
</plist>
EOS
end
test do
mkdir testpath/"Library/Preferences"
begin
pid = fork do
exec bin/"pueued"
end
sleep 5
cmd = "#{bin}/pueue status"
assert_match /Task list is empty.*/m, shell_output(cmd)
ensure
Process.kill("TERM", pid)
end
assert_match "Pueue daemon #{version}", shell_output("#{bin}/pueued --version")
assert_match "Pueue client #{version}", shell_output("#{bin}/pueue --version")
end
end