class Frpc < Formula desc "Client 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.29.0", :revision => "e62d9a52429f54dee8df1c42f2d4bad7a267b05d" bottle do cellar :any_skip_relocation sha256 "c5da5563684fc54f234fd4a0d37100423a6bb212f5e2b28fd4aac49b525baa94" => :catalina sha256 "2ed284c0f7f2c864672071fec6995264b3057e4a77c310bf27216e10e34f6293" => :mojave sha256 "6fa70559da5b933edb589755a0c07d33b8c6b6794737356b7a8e9f3dba89f9a8" => :high_sierra sha256 "9130a28e18506a287e41c58b82e50f94fc6b706e2e2a94ed028ec0c17bb296b6" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = buildpath contents = Dir["{*,.git,.gitignore}"] (buildpath/"src/github.com/fatedier/frp").install contents (buildpath/"bin").mkpath (etc/"frp").mkpath cd "src/github.com/fatedier/frp" do system "make", "frpc" bin.install "bin/frpc" etc.install "conf/frpc.ini" => "frp/frpc.ini" etc.install "conf/frpc_full.ini" => "frp/frpc_full.ini" prefix.install_metafiles end end plist_options :manual => "frpc -c #{HOMEBREW_PREFIX}/etc/frp/frpc.ini" def plist; <<~EOS Label #{plist_name} KeepAlive ProgramArguments #{opt_bin}/frpc -c #{etc}/frp/frpc.ini StandardErrorPath #{var}/log/frpc.log StandardOutPath #{var}/log/frpc.log EOS end test do system bin/"frpc", "-v" assert_match "Commands", shell_output("#{bin}/frpc help") assert_match "local_port", shell_output("#{bin}/frpc http", 1) assert_match "local_port", shell_output("#{bin}/frpc https", 1) assert_match "local_port", shell_output("#{bin}/frpc stcp", 1) assert_match "local_port", shell_output("#{bin}/frpc tcp", 1) assert_match "local_port", shell_output("#{bin}/frpc udp", 1) assert_match "local_port", shell_output("#{bin}/frpc xtcp", 1) assert_match "admin_port", shell_output("#{bin}/frpc status -c #{etc}/frp/frpc.ini", 1) assert_match "admin_port", shell_output("#{bin}/frpc reload -c #{etc}/frp/frpc.ini", 1) end end