homebrew-core/Formula/sync_gateway.rb

60 lines
2.1 KiB
Ruby

class SyncGateway < Formula
desc "Make Couchbase Server a replication endpoint for Couchbase Lite"
homepage "https://docs.couchbase.com/sync-gateway"
url "https://github.com/couchbase/sync_gateway.git",
:tag => "2.7.0",
:revision => "a52b9c42ba1d29d948255dd6a8a976d655bf6d32"
head "https://github.com/couchbase/sync_gateway.git"
bottle do
cellar :any_skip_relocation
sha256 "a416ddb7c6d6187d0d1bd64404e42c3a8efb51872d81b96445756a208fbd08a7" => :catalina
sha256 "e7f4d546225f5191290425cee6e69cfa9477cedc4d681f638a0bc50e950f2323" => :mojave
sha256 "ab4fe6072b033c1106064a8bb4246e863a10a38a6d8131bc837df36aa5a909ea" => :high_sierra
end
depends_on "gnupg" => :build
depends_on "go" => :build
resource "depot_tools" do
url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",
:revision => "b97d193baafa7343cc869e2b48d3bffec46a0c31"
end
def install
# Cache the vendored Go dependencies gathered by depot_tools' `repo` command
repo_cache = buildpath/"repo_cache/#{name}/.repo"
repo_cache.mkpath
(buildpath/"depot_tools").install resource("depot_tools")
ENV.prepend_path "PATH", buildpath/"depot_tools"
(buildpath/"build").install_symlink repo_cache
cp Dir["*.sh"], "build"
git_commit = `git rev-parse HEAD`.chomp
manifest = buildpath/"new-manifest.xml"
manifest.write Utils.popen_read "python", "rewrite-manifest.sh",
"--manifest-url",
"file://#{buildpath}/manifest/default.xml",
"--project-name", "sync_gateway",
"--set-revision", git_commit
cd "build" do
mkdir "godeps"
system "repo", "init", "-u", stable.url, "-m", "manifest/default.xml"
cp manifest, ".repo/manifest.xml"
system "repo", "sync"
ENV["SG_EDITION"] = "CE"
system "sh", "build.sh", "-v"
mv "godeps/bin", prefix
end
end
test do
pid = fork { exec "#{bin}/sync_gateway" }
sleep 1
Process.kill("SIGINT", pid)
Process.wait(pid)
end
end