70 lines
2.0 KiB
Ruby
70 lines
2.0 KiB
Ruby
class Frps < Formula
|
|
desc "Server app of fast reverse proxy to expose a local server to the internet"
|
|
homepage "https://github.com/fatedier/frp"
|
|
url "https://github.com/fatedier/frp.git",
|
|
tag: "v0.33.0",
|
|
revision: "2406ecdfea62567a576bdb71e38adbafa3b4814a"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
rebuild 1
|
|
sha256 "ebc86082a21c9c7050154c679dc0f55b6e397fb05142fe11b0ec14093cf716ed" => :catalina
|
|
sha256 "e128a70843505b72e81e63e1bb4dfb9615755257127c4c260836c94e648d00b1" => :mojave
|
|
sha256 "11a0d53a68c156d0b9761f94f1a4a8710af73978fb33f808f2c70b02ddb5999a" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
(buildpath/"bin").mkpath
|
|
(etc/"frp").mkpath
|
|
|
|
system "make", "frps"
|
|
bin.install "bin/frps"
|
|
etc.install "conf/frps.ini" => "frp/frps.ini"
|
|
etc.install "conf/frps_full.ini" => "frp/frps_full.ini"
|
|
end
|
|
|
|
plist_options manual: "frps -c #{HOMEBREW_PREFIX}/etc/frp/frps.ini"
|
|
|
|
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>KeepAlive</key>
|
|
<true/>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/frps</string>
|
|
<string>-c</string>
|
|
<string>#{etc}/frp/frps.ini</string>
|
|
</array>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/frps.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/frps.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/frps -v")
|
|
assert_match "Flags", shell_output("#{bin}/frps --help")
|
|
|
|
read, write = IO.pipe
|
|
fork do
|
|
exec bin/"frps", out: write
|
|
end
|
|
sleep 3
|
|
|
|
output = read.gets
|
|
assert_match "frps tcp listen on", output
|
|
end
|
|
end
|