homebrew-core/Formula/pueue.rb

74 lines
2.2 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.1.6.tar.gz"
sha256 "6b11643497cedfa7517d1c041951be907f6e138e8efc339cd36309943995b8f1"
head "https://github.com/Nukesor/pueue.git"
bottle do
cellar :any_skip_relocation
sha256 "ba1a92b9e140d929233dad0f10a5a2687fb022967017ad78847588ed9d377ed0" => :catalina
sha256 "6c3f3b24e1d6a36e4cdb79e045f6662d83f5961f30b21620cfa8c704bf78b43a" => :mojave
sha256 "387038f36ce71a0f3fdb4fe15192db99b3be770c939623566dd85180d2ee4aed" => :high_sierra
end
depends_on "rust" => :build
def install
system "cargo", "install", "--locked", "--root", prefix, "--path", "."
prefix.install_metafiles
bash_completion.install "utils/completions/pueue.bash" => "pueue"
fish_completion.install "utils/completions/pueue.fish" => "pueue.fish"
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