class Riak < Formula desc "Distributed database" homepage "https://basho.com/products/#riak" url "https://s3.amazonaws.com/downloads.basho.com/riak/2.1/2.1.3/osx/10.8/riak-2.1.3-OSX-x86_64.tar.gz" version "2.1.3" sha256 "a0408d83c89504ef987bd8b34e7b3bb14459c35359ebf1adfb2a1634306c2e80" bottle :unneeded depends_on :macos => :mountain_lion depends_on :arch => :x86_64 def install logdir = var + "log/riak" datadir = var + "lib/riak" libexec.install Dir["*"] logdir.mkpath datadir.mkpath (datadir + "ring").mkpath inreplace "#{libexec}/lib/env.sh" do |s| s.change_make_var! "RUNNER_BASE_DIR", libexec s.change_make_var! "RUNNER_LOG_DIR", logdir end inreplace "#{libexec}/etc/riak.conf" do |c| c.gsub! /(platform_data_dir *=).*$/, "\\1 #{datadir}" c.gsub! /(platform_log_dir *=).*$/, "\\1 #{logdir}" end bin.write_exec_script libexec/"bin/riak" bin.write_exec_script libexec/"bin/riak-admin" bin.write_exec_script libexec/"bin/riak-debug" bin.write_exec_script libexec/"bin/search-cmd" end end