Skip to content

Instantly share code, notes, and snippets.

@arthurnn
Created February 23, 2018 14:13
Show Gist options
  • Save arthurnn/045b938623a980f028aefd0182f99720 to your computer and use it in GitHub Desktop.
Save arthurnn/045b938623a980f028aefd0182f99720 to your computer and use it in GitHub Desktop.
class Vitess < Formula
desc "Vitess is a database clustering system for horizontal scaling of MySQL."
homepage "http://vitess.io"
url "https://github.com/arthurnn/vitess.git",
:branch => "arthurnn/easier_build",
:revision => "f73a77ebe144e022db27c6eb9df92dc6b60a52ae"
head "https://github.com/arthurnn/vitess.git",
:shallow => false
version "2.1.1.f73a77"
depends_on "go" => :build
depends_on "pkg-config" => :build
def install
ENV["GOPATH"] = buildpath
contents = Dir["{*,.git,.gitignore}"]
(buildpath/"src/github.com/youtube/vitess").install contents
cd "src/github.com/youtube/vitess" do
system "make", "build"
prefix.install "web"
end
[
"vtclient",
"vtcombo",
"vtctl",
"vtctlclient",
"vtctld",
"vtexplain",
"vtgate",
"vtqueryserver",
"vttablet",
"vtworker",
"vtworkerclient",
].each do |binary|
bin.install "bin/#{binary}"
end
prefix.install_metafiles
end
test do
begin
pid = fork do
exec bin/"vtcombo",
"-port=15900",
"-mycnf_server_id", "1",
"-web_dir", "#{prefix}/web/vtctld",
"-web_dir2", "#{prefix}/web/vtctld2/app"
end
sleep 1
output = shell_output("curl -I 127.0.0.1:15900/app2/")
assert_match "200 OK", output
ensure
Process.kill(9, pid)
Process.wait(pid)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment