homebrew-core/Formula/sync_gateway.rb

65 lines
2.3 KiB
Ruby

class SyncGateway < Formula
desc "Make Couchbase Server a replication endpoint for Couchbase Lite"
homepage "https://docs.couchbase.com/sync-gateway/current/index.html"
url "https://github.com/couchbase/sync_gateway.git",
tag: "2.8.2",
revision: "4df7a2da36c88a72131b23eb044b7d0b69b456bd"
license "Apache-2.0"
head "https://github.com/couchbase/sync_gateway.git"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "e445a768ff0ec3e3e33d7a0ccd14c7a66cfb8401cfa385e68ee62ce8cef4668a"
sha256 cellar: :any_skip_relocation, big_sur: "b718f1e3d7fee3d47e9091606afd43891f6323558c8d3a4c30c88eff563147e3"
sha256 cellar: :any_skip_relocation, catalina: "6abd3e4f3d682d3e1bc6e7ffcee385c95b33664af989f22d1c86f96c3e4b7474"
sha256 cellar: :any_skip_relocation, mojave: "e43aa516b0457ef79f599773ccfe110c34ddbc492b552fd63bc5e97fda432c06"
end
depends_on "gnupg" => :build
depends_on "go" => :build
depends_on "repo" => :build
depends_on "python@3.9"
def install
# Cache the vendored Go dependencies gathered by depot_tools' `repo` command
repo_cache = buildpath/"repo_cache/#{name}/.repo"
repo_cache.mkpath
(buildpath/"build").install_symlink repo_cache
cp Dir["*.sh"], "build"
manifest = buildpath/"new-manifest.xml"
manifest.write Utils.safe_popen_read "python", "rewrite-manifest.sh",
"--manifest-url",
"file://#{buildpath}/manifest/default.xml",
"--project-name", "sync_gateway",
"--set-revision", Utils.git_head
cd "build" do
ENV["GO111MODULE"] = "auto"
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
interface_port = free_port
admin_port = free_port
fork do
exec "#{bin}/sync_gateway_ce -interface :#{interface_port} -adminInterface 127.0.0.1:#{admin_port}"
end
sleep 1
system "nc", "-z", "localhost", interface_port
system "nc", "-z", "localhost", admin_port
end
end