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.27.0", :revision => "95444ea46b40ca4b7f636a66530f48e8b68969bf" bottle do cellar :any_skip_relocation sha256 "231d5a3ee8e82753e750f5401a8c166b152309c9fa8d0036308d16d01cc00634" => :mojave sha256 "9ceef4983a50f989f0615dc7b21aaa9b06427a54fb137c0fbea0de9638141b04" => :high_sierra sha256 "a9bea8fd81b62ab038fc20b1ff013578b06e8058efe471c3b1d3f9b558c1186d" => :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