60 lines
1.9 KiB
Ruby
60 lines
1.9 KiB
Ruby
class Tarantool < Formula
|
|
desc "In-memory database and Lua application server."
|
|
homepage "https://tarantool.org/"
|
|
url "https://download.tarantool.org/tarantool/1.7/src/tarantool-1.7.5.126.tar.gz"
|
|
sha256 "3e2a528a7693680fcf4844e10216aae38419fcd1617119ad712fc30dbad5df5a"
|
|
|
|
head "https://github.com/tarantool/tarantool.git", :branch => "1.8", :shallow => false
|
|
|
|
bottle do
|
|
sha256 "4dd4ea7651721a83d95d1008200752b3f6c6c98ca62dbe700bec840bcecc9acf" => :high_sierra
|
|
sha256 "9175de277609a39cc6ab6af9488bb80d08b6256393f310351e7b026db38c860b" => :sierra
|
|
sha256 "9f2660acec86032f37ec1b6e198a9d37a51b5cd1ec8b7c7cb6a5aeb38793470f" => :el_capitan
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "openssl"
|
|
depends_on "readline"
|
|
|
|
def install
|
|
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=#{MacOS.sdk_path}/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.undent
|
|
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
|