2013-09-16 11:06:27 +00:00
|
|
|
class Etcd < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Key value store for shared configuration and service discovery"
|
2014-07-20 18:47:35 +00:00
|
|
|
homepage "https://github.com/coreos/etcd"
|
2015-11-17 08:36:44 +00:00
|
|
|
url "https://github.com/coreos/etcd/archive/v2.2.1.tar.gz"
|
|
|
|
sha256 "1c0ce63812ef951f79c0a544c91f9f1ba3c6b50cb3e8197de555732454864d05"
|
2014-07-20 18:47:35 +00:00
|
|
|
head "https://github.com/coreos/etcd.git"
|
2013-09-16 11:06:27 +00:00
|
|
|
|
2014-06-14 11:33:16 +00:00
|
|
|
bottle do
|
2015-09-23 08:40:37 +00:00
|
|
|
cellar :any_skip_relocation
|
2015-11-17 08:59:06 +00:00
|
|
|
sha256 "0d6eb79f2c7d8be1a773c2f379fc048568bfd65029d79a6c00d75e985b36ad81" => :el_capitan
|
|
|
|
sha256 "dbea8903765c7288b3c8efcb99eb235098aa2a88fb8efd417d8038f0b891e7c4" => :yosemite
|
|
|
|
sha256 "c1a6291ac315bafb7b9ac6a949f25a3914d3550ff818d26881801e39b2a50a75" => :mavericks
|
2014-06-14 11:33:16 +00:00
|
|
|
end
|
|
|
|
|
2015-08-30 07:06:42 +00:00
|
|
|
devel do
|
2015-11-17 08:36:44 +00:00
|
|
|
url "https://github.com/coreos/etcd/archive/v2.3.0-alpha.0.tar.gz"
|
|
|
|
version "2.3.0-alpha.0"
|
|
|
|
sha256 "6603684824a650c472c791fc7c4cdf6811920f473e01bcfe8b1d95b0fd1f25c6"
|
2015-08-30 07:06:42 +00:00
|
|
|
end
|
|
|
|
|
2014-07-20 18:47:35 +00:00
|
|
|
depends_on "go" => :build
|
2013-09-16 11:06:27 +00:00
|
|
|
|
|
|
|
def install
|
2014-07-20 18:47:35 +00:00
|
|
|
ENV["GOPATH"] = buildpath
|
2013-09-16 11:06:27 +00:00
|
|
|
system "./build"
|
2014-07-20 18:47:35 +00:00
|
|
|
bin.install "bin/etcd"
|
2015-03-08 17:24:17 +00:00
|
|
|
bin.install "bin/etcdctl"
|
2013-09-16 11:06:27 +00:00
|
|
|
end
|
2014-05-09 21:47:23 +00:00
|
|
|
|
2015-04-27 01:47:31 +00:00
|
|
|
test do
|
|
|
|
begin
|
|
|
|
require "utils/json"
|
|
|
|
test_string = "Hello from brew test!"
|
|
|
|
etcd_pid = fork do
|
|
|
|
exec "etcd", "--force-new-cluster", "--data-dir=#{testpath}"
|
|
|
|
end
|
|
|
|
# sleep to let etcd get its wits about it
|
|
|
|
sleep 10
|
|
|
|
etcd_uri = "http://127.0.0.1:4001/v2/keys/brew_test"
|
|
|
|
system "curl", "--silent", "-L", etcd_uri, "-XPUT", "-d", "value=#{test_string}"
|
|
|
|
curl_output = shell_output "curl --silent -L #{etcd_uri}"
|
|
|
|
response_hash = Utils::JSON.load(curl_output)
|
|
|
|
assert_match(test_string, response_hash.fetch("node").fetch("value"))
|
|
|
|
ensure
|
|
|
|
# clean up the etcd process before we leave
|
|
|
|
Process.kill("HUP", etcd_pid)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-05-09 21:47:23 +00:00
|
|
|
def plist; <<-EOS.undent
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>KeepAlive</key>
|
|
|
|
<dict>
|
|
|
|
<key>SuccessfulExit</key>
|
|
|
|
<false/>
|
|
|
|
</dict>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{opt_bin}/etcd</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{var}</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
|
|
|
end
|
2013-09-16 11:06:27 +00:00
|
|
|
end
|