83 lines
2.7 KiB
Ruby
83 lines
2.7 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.12.0.tar.gz"
|
|
sha256 "9c3930380120bf8479caa55236fb9fdbbad5bfe3d41c0729a667c777cbc856e2"
|
|
license "MIT"
|
|
head "https://github.com/Nukesor/pueue.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "34050139a57ab4f6874cae421082f2449c61d28703fc39f988b9470fe4bd9263"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "47feda4778516a8b2b68afd05b86013e6383d112c4553c466658549a94786222"
|
|
sha256 cellar: :any_skip_relocation, catalina: "6f48e1ac9b2705da5e8d5a5fc147c06a78af1067a7e639a3cbc3dee4ec47e9b1"
|
|
sha256 cellar: :any_skip_relocation, mojave: "3c604c05fa8f52884fd9513051b98792387861f0627e0a71a47c030a97da3166"
|
|
end
|
|
|
|
depends_on "rust" => :build
|
|
|
|
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"
|
|
zsh_completion.install "utils/completions/_pueue" => "_pueue"
|
|
|
|
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
|
|
pid = fork do
|
|
exec bin/"pueued"
|
|
end
|
|
sleep 2
|
|
|
|
begin
|
|
mkdir testpath/"Library/Preferences"
|
|
output = shell_output("#{bin}/pueue status")
|
|
assert_match "Task list is empty. Add tasks with `pueue add -- [cmd]`", output
|
|
|
|
output = shell_output("#{bin}/pueue add x")
|
|
assert_match "New task added (id 0).", output
|
|
|
|
output = shell_output("#{bin}/pueue status")
|
|
assert_match "(1 parallel): running", output
|
|
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
|