homebrew-core/Formula/twoping.rb
2015-11-16 18:59:59 +08:00

57 lines
1.9 KiB
Ruby

class Twoping < Formula
desc "Ping utility to determine directional packet loss"
homepage "http://www.finnie.org/software/2ping/"
url "http://www.finnie.org/software/2ping/2ping-3.0.1.tar.gz"
sha256 "d6997cd1680151e6f7d5e60137d45cd41bf385d26029878afdaaf5dc4f63dcc4"
revision 1
bottle do
cellar :any_skip_relocation
sha256 "f63e7af668f34e6b293e5a554832a7432de14cbb71c15e0a225c6ea1ce3e3924" => :el_capitan
sha256 "13794ca27a86eec6ede9a1f1cd3d01cda5f675db91c2e937471bf7d718c0fed4" => :yosemite
sha256 "b2a81bf692ca4fc69367536e069634438dd2dce53a9f0f7e05b6749342a96db4" => :mavericks
end
def install
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages"
system "python", *Language::Python.setup_install_args(libexec)
man1.install "doc/2ping.1"
man1.install_symlink "2ping.1" => "2ping6.1"
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
plist_options :manual => "2ping --listen", :startup => true
def plist; <<-EOS.undent
<?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}/2ping</string>
<string>--listen</string>
<string>--quiet</string>
</array>
<key>UserName</key>
<string>nobody</string>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
EOS
end
test do
system bin/"2ping", "-c", "5", "test.2ping.net"
end
end