class Tarantool < Formula desc "In-memory database and Lua application server" homepage "https://tarantool.org/" url "https://download.tarantool.org/tarantool/1.9/src/tarantool-1.9.0.0.tar.gz" sha256 "749c0207da2a2d3838e3c9619d33c56dc3fc515738885c798d728ed506be4717" head "https://github.com/tarantool/tarantool.git", :branch => "2.0", :shallow => false bottle do sha256 "3aaab86529a9a676ca66f84a15dea7700e70ae68d2722dbf222c51e83faefda9" => :high_sierra sha256 "3584b932f7f04786313f2b385ac6db5880ebdbaa1e023ebccb82ca70ca1bad70" => :sierra sha256 "37717b48bf4228c7806ec7200ed8fc0e2015e772983a04e2b487dc872b5be3c2" => :el_capitan end depends_on "cmake" => :build depends_on "icu4c" depends_on "openssl" depends_on "readline" def install sdk = MacOS::CLT.installed? ? "" : MacOS.sdk_path args = std_cmake_args args << "-DCMAKE_INSTALL_MANDIR=#{doc}" args << "-DCMAKE_INSTALL_SYSCONFDIR=#{etc}" args << "-DCMAKE_INSTALL_LOCALSTATEDIR=#{var}" args << "-DENABLE_DIST=ON" args << "-DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix}" args << "-DREADLINE_ROOT=#{Formula["readline"].opt_prefix}" args << "-DCURL_INCLUDE_DIR=#{sdk}/usr/include" args << "-DCURL_LIBRARY=/usr/lib/libcurl.dylib" system "cmake", ".", *args system "make" system "make", "install" end def post_install local_user = ENV["USER"] inreplace etc/"default/tarantool", /(username\s*=).*/, "\\1 '#{local_user}'" (var/"lib/tarantool").mkpath (var/"log/tarantool").mkpath (var/"run/tarantool").mkpath end test do (testpath/"test.lua").write <<~EOS box.cfg{} local s = box.schema.create_space("test") s:create_index("primary") local tup = {1, 2, 3, 4} s:insert(tup) local ret = s:get(tup[1]) if (ret[3] ~= tup[3]) then os.exit(-1) end os.exit(0) EOS system bin/"tarantool", "#{testpath}/test.lua" end end