Initial commit.
This commit is contained in:
commit
99f4730aaf
1 changed files with 91 additions and 0 deletions
91
Formula/tinyproxy.rb
Normal file
91
Formula/tinyproxy.rb
Normal file
|
@ -0,0 +1,91 @@
|
|||
class Tinyproxy < Formula
|
||||
desc "HTTP/HTTPS proxy for POSIX systems"
|
||||
homepage "https://www.banu.com/tinyproxy/"
|
||||
url "https://github.com/tinyproxy/tinyproxy/releases/download/1.8.4/tinyproxy-1.8.4.tar.xz"
|
||||
sha256 "59be87689c415ba0d9c9bc6babbdd3df3b372d60b21e526b118d722dbc995682"
|
||||
|
||||
bottle do
|
||||
rebuild 1
|
||||
sha256 "7e7250cfbda60dcf40e291ce777842953bdfa573023ca28d2b09eefe41c0e523" => :high_sierra
|
||||
end
|
||||
|
||||
option "with-reverse", "Enable reverse proxying"
|
||||
option "with-transparent", "Enable transparent proxying"
|
||||
option "with-filter", "Enable url filtering"
|
||||
|
||||
deprecated_option "reverse" => "with-reverse"
|
||||
|
||||
depends_on "asciidoc" => :build
|
||||
depends_on "docbook-xsl" => :build
|
||||
|
||||
def install
|
||||
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
|
||||
|
||||
args = %W[
|
||||
--disable-debug
|
||||
--disable-dependency-tracking
|
||||
--disable-silent-rules
|
||||
--prefix=#{prefix}
|
||||
--localstatedir=#{var}
|
||||
--sysconfdir=#{etc}
|
||||
--disable-regexcheck
|
||||
]
|
||||
|
||||
args << "--enable-reverse" if build.with? "reverse"
|
||||
args << "--enable-transparent" if build.with? "transparent"
|
||||
args << "--enable-filter" if build.with? "filter"
|
||||
|
||||
system "./configure", *args
|
||||
|
||||
# Fix broken XML lint
|
||||
# See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=154624
|
||||
inreplace %w[docs/man5/Makefile docs/man8/Makefile], "-f manpage",
|
||||
"-f manpage \\\n -L"
|
||||
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"log/tinyproxy").mkpath
|
||||
(var/"run/tinyproxy").mkpath
|
||||
end
|
||||
|
||||
plist_options :manual => "tinyproxy"
|
||||
|
||||
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>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<false/>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>#{opt_sbin}/tinyproxy</string>
|
||||
<string>-d</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>#{HOMEBREW_PREFIX}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOS
|
||||
end
|
||||
|
||||
test do
|
||||
pid = fork do
|
||||
exec "#{sbin}/tinyproxy"
|
||||
end
|
||||
sleep 2
|
||||
|
||||
begin
|
||||
assert_match /tinyproxy/, shell_output("curl localhost:8888")
|
||||
ensure
|
||||
Process.kill("SIGINT", pid)
|
||||
Process.wait(pid)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue