homebrew-core/Formula/rethinkdb.rb
2016-01-12 11:52:22 +00:00

73 lines
2.2 KiB
Ruby

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.3-1.tgz"
sha256 "d2d59532bd46da8d1f947e3ec9028746b4f4bbbc13f215b8314852ab1cd0db95"
bottle do
cellar :any
sha256 "e61864683e159589a6a50a579ddd0ab33103d5a3d697a2189348c736ed9d8a1a" => :el_capitan
sha256 "6a38238014c9a83bd553fd982498a9e7dcd7b1d718d9c11b45aa7825346a9167" => :yosemite
sha256 "49cbb24b1c75dcb59cb8098e18eb9cbbe76d97091eca8d3c7d5b87a9deb0de39" => :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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>ProgramArguments</key>
<array>
<string>#{opt_bin}/rethinkdb</string>
<string>--config-file</string>
<string>#{etc}/rethinkdb.conf</string>
</array>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>StandardOutPath</key>
<string>#{var}/log/rethinkdb/rethinkdb.log</string>
<key>StandardErrorPath</key>
<string>#{var}/log/rethinkdb/rethinkdb.log</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
EOS
end
test do
shell_output("#{bin}/rethinkdb create -d test")
assert File.read("test/metadata").start_with?("RethinkDB")
end
end