class Tor < Formula desc "Anonymizing overlay network for TCP" homepage "https://www.torproject.org/" url "https://dist.torproject.org/tor-0.2.7.6.tar.gz" mirror "https://tor.eff.org/dist/tor-0.2.7.6.tar.gz" sha256 "493a8679f904503048114aca6467faef56861206bab8283d858f37141d95105d" bottle do sha256 "32bb77890419cef8b2152e9a6cd554b71021baa64d3dac8fc8d48d7d24d51e99" => :el_capitan sha256 "a3edf9af56c01b70f582ca4d4ddb552274b876db7922c0494407804f3877975b" => :yosemite sha256 "595d64e121de2417e647d5c8a1d0051d5a3e3de9c0e15429134c5dd494459573" => :mavericks end devel do url "https://dist.torproject.org/tor-0.2.8.3-alpha.tar.gz" mirror "https://tor.eff.org/dist/tor-0.2.8.3-alpha.tar.gz" version "0.2.8.3-alpha" sha256 "88da40c24f0bb19e19b37b8deab1b0d86608798746c81380cf17996d269f9053" end depends_on "libevent" depends_on "openssl" depends_on "libnatpmp" => :optional depends_on "miniupnpc" => :optional depends_on "libscrypt" => :optional def install args = %W[ --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --sysconfdir=#{etc} --with-openssl-dir=#{Formula["openssl"].opt_prefix} ] args << "--with-libnatpmp-dir=#{Formula["libnatpmp"].opt_prefix}" if build.with? "libnatpmp" args << "--with-libminiupnpc-dir=#{Formula["miniupnpc"].opt_prefix}" if build.with? "miniupnpc" args << "--disable-libscrypt" if build.without? "libscrypt" system "./configure", *args system "make", "install" end def caveats; <<-EOS.undent You will find a sample `torrc` file in #{etc}/tor. It is advisable to edit the sample `torrc` to suit your own security needs: https://www.torproject.org/docs/faq#torrc After editing the `torrc` you need to restart tor. EOS end plist_options :manual => "tor start" test do pipe_output("script -q /dev/null #{bin}/tor-gencert --create-identity-key", "passwd\npasswd\n") assert (testpath/"authority_certificate").exist? assert (testpath/"authority_signing_key").exist? assert (testpath/"authority_identity_key").exist? end def plist; <<-EOS.undent Label #{plist_name} RunAtLoad KeepAlive ProgramArguments #{opt_bin}/tor WorkingDirectory #{HOMEBREW_PREFIX} StandardErrorPath #{var}/log/tor.log StandardOutPath #{var}/log/tor.log EOS end end