homebrew-core/Formula/sync_gateway.rb
2019-10-13 15:37:35 +02:00

60 lines
2.2 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.6.0",
:revision => "b4c828d5d167140d75ab4c4f7402602f65f74464"
head "https://github.com/couchbase/sync_gateway.git"
bottle do
cellar :any_skip_relocation
sha256 "d023c939c11fcbfd814fc90493f7420dfff6f4e1d709142432bda2915c0bb44a" => :catalina
sha256 "b40cc2e518e0e74f3fe53e9a765fee8ecaf5b77a9b87973f237cf37c019e8ba7" => :mojave
sha256 "efb726a9bd964c275283e2bec005d13a3385a781864ef1e9433380c2461a4306" => :high_sierra
sha256 "d616e833f59e37de97a07a67e00c4babf8e04b7310c6562c64096c696188711a" => :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