class Rethinkdb < Formula desc "The open-source database for the realtime web" homepage "https://www.rethinkdb.com/" url "https://download.rethinkdb.com/dist/rethinkdb-2.2.2.tgz" sha256 "47982f07a1003c452822bec0cb358c589c85dbaf6b3dd161c533076e81bb5c7f" bottle do cellar :any sha256 "25aa8beafc05066341bab0de8eb83688007ea623bd411559dca2a7082e224f7b" => :el_capitan sha256 "48dce6621be11b27a92b361a9347d854ee84202350125cef2b65d12cf7b306b2" => :yosemite sha256 "0e64afd05055b045fc26ded3f9d5a425d88e4caad5a32a292c3dffe42f17e97d" => :mavericks end depends_on :macos => :lion depends_on "boost" => :build depends_on "openssl" fails_with :gcc do build 5666 # GCC 4.2.1 cause "RethinkDB uses C++0x" end def install args = ["--prefix=#{prefix}"] # rethinkdb requires that protobuf be linked against libc++ # but brew's protobuf is sometimes linked against libstdc++ args += ["--fetch", "protobuf"] system "./configure", *args system "make" system "make", "install-osx" (var/"log/rethinkdb").mkpath inreplace "packaging/assets/config/default.conf.sample", /^# directory=.*/, "directory=#{var}/rethinkdb" etc.install "packaging/assets/config/default.conf.sample" => "rethinkdb.conf" end def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_bin}/rethinkdb --config-file #{etc}/rethinkdb.conf WorkingDirectory #{HOMEBREW_PREFIX} StandardOutPath #{var}/log/rethinkdb/rethinkdb.log StandardErrorPath #{var}/log/rethinkdb/rethinkdb.log RunAtLoad KeepAlive EOS end test do shell_output("#{bin}/rethinkdb create -d test") assert File.read("test/metadata").start_with?("RethinkDB") end end