2014-09-07 19:27:04 +00:00
|
|
|
require "language/go"
|
2013-12-02 05:17:12 +00:00
|
|
|
|
|
|
|
class Nsq < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Realtime distributed messaging platform"
|
2015-05-02 22:05:43 +00:00
|
|
|
homepage "http://nsq.io"
|
2015-04-26 22:48:00 +00:00
|
|
|
url "https://github.com/bitly/nsq/archive/v0.3.5.tar.gz"
|
2015-05-02 22:05:43 +00:00
|
|
|
sha256 "4120ad24e3700be1e65549b9a55eab5d4e744cd114d9b39779a47b6dedda0b35"
|
|
|
|
|
|
|
|
head "https://github.com/bitly/nsq.git"
|
2013-12-02 05:17:12 +00:00
|
|
|
|
2014-07-25 13:50:20 +00:00
|
|
|
bottle do
|
2015-02-20 15:37:33 +00:00
|
|
|
cellar :any
|
2015-04-26 23:42:34 +00:00
|
|
|
sha256 "eb9dd459eec6603dd720b58b8fcee5ccfc122999aed51845ff2c98e0bb3fabfe" => :yosemite
|
|
|
|
sha256 "b17656e4e8b93abf9d6b0b65b614ffa7fecc2b0920a8d0329aa6abda2e5a2f7e" => :mavericks
|
|
|
|
sha256 "dd00b16b6708fd69764ec0276568f88b4d3c8729c6be45859b3450b313a0f3b6" => :mountain_lion
|
2014-07-25 13:50:20 +00:00
|
|
|
end
|
|
|
|
|
2013-12-02 05:17:12 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
2014-09-07 19:27:04 +00:00
|
|
|
go_resource "github.com/BurntSushi/toml" do
|
|
|
|
url "https://github.com/BurntSushi/toml.git",
|
|
|
|
:revision => "2dff11163ee667d51dcc066660925a92ce138deb"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/bitly/go-hostpool" do
|
|
|
|
url "https://github.com/bitly/go-hostpool.git",
|
|
|
|
:revision => "58b95b10d6ca26723a7f46017b348653b825a8d6"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/bitly/go-nsq" do
|
|
|
|
url "https://github.com/bitly/go-nsq.git",
|
2015-04-26 22:48:00 +00:00
|
|
|
:revision => "22a8bd48c443ec23bb559675b6df8284bbbdab29"
|
2014-09-07 19:27:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/bitly/go-simplejson" do
|
|
|
|
url "https://github.com/bitly/go-simplejson.git",
|
|
|
|
:revision => "fc395a5db941cf38922b1ccbc083640cd76fe4bc"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/bmizerany/perks" do
|
|
|
|
url "https://github.com/bmizerany/perks.git",
|
|
|
|
:revision => "6cb9d9d729303ee2628580d9aec5db968da3a607"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mreiferson/go-options" do
|
|
|
|
url "https://github.com/mreiferson/go-options.git",
|
2015-01-22 06:24:15 +00:00
|
|
|
:revision => "2cf7eb1fdd83e2bb3375fef6fdadb04c3ad564da"
|
2014-09-07 19:27:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mreiferson/go-snappystream" do
|
|
|
|
url "https://github.com/mreiferson/go-snappystream.git",
|
2015-04-26 22:48:00 +00:00
|
|
|
:revision => "028eae7ab5c4c9e2d1cb4c4ca1e53259bbe7e504"
|
2013-12-02 05:17:12 +00:00
|
|
|
end
|
|
|
|
|
2015-02-08 18:16:18 +00:00
|
|
|
go_resource "github.com/bitly/timer_metrics" do
|
|
|
|
url "https://github.com/bitly/timer_metrics.git",
|
|
|
|
:revision => "afad1794bb13e2a094720aeb27c088aa64564895"
|
|
|
|
end
|
|
|
|
|
2015-04-26 22:48:00 +00:00
|
|
|
go_resource "github.com/blang/semver" do
|
|
|
|
url "https://github.com/blang/semver.git",
|
|
|
|
:revision => "9bf7bff48b0388cb75991e58c6df7d13e982f1f2"
|
|
|
|
end
|
|
|
|
|
2013-12-02 05:17:12 +00:00
|
|
|
def install
|
2014-02-17 16:24:17 +00:00
|
|
|
# build a proper GOPATH tree for local dependencies
|
2015-04-26 22:48:00 +00:00
|
|
|
(buildpath + "src/github.com/bitly/nsq").install "internal", "nsqlookupd", "nsqd", "nsqadmin"
|
2013-12-02 05:17:12 +00:00
|
|
|
|
2014-08-12 22:13:36 +00:00
|
|
|
ENV["GOPATH"] = buildpath
|
2014-09-07 19:27:04 +00:00
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
|
2013-12-02 05:17:12 +00:00
|
|
|
system "make"
|
|
|
|
system "make", "DESTDIR=#{prefix}", "PREFIX=", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2015-05-02 22:05:43 +00:00
|
|
|
begin
|
|
|
|
lookupd = fork do
|
2015-07-21 06:14:42 +00:00
|
|
|
exec bin/"nsqlookupd"
|
2015-05-02 22:05:43 +00:00
|
|
|
end
|
|
|
|
sleep 2
|
|
|
|
d = fork do
|
2015-07-21 06:14:42 +00:00
|
|
|
exec bin/"nsqd", "--lookupd-tcp-address=127.0.0.1:4160"
|
2015-05-02 22:05:43 +00:00
|
|
|
end
|
|
|
|
sleep 2
|
|
|
|
admin = fork do
|
2015-07-21 06:14:42 +00:00
|
|
|
exec bin/"nsqadmin", "--lookupd-http-address=127.0.0.1:4161"
|
2015-05-02 22:05:43 +00:00
|
|
|
end
|
|
|
|
sleep 2
|
|
|
|
to_file = fork do
|
2015-07-21 06:14:42 +00:00
|
|
|
exec bin/"nsq_to_file", "--topic=test", "--output-dir=#{testpath}",
|
2015-05-02 22:05:43 +00:00
|
|
|
"--lookupd-http-address=127.0.0.1:4161"
|
|
|
|
end
|
|
|
|
sleep 2
|
|
|
|
system "curl", "-d", "hello", "http://127.0.0.1:4151/put?topic=test"
|
|
|
|
|
|
|
|
dat = File.read(Dir["*.dat"].first)
|
|
|
|
assert_match "test", dat
|
|
|
|
assert_match version.to_s, dat
|
|
|
|
ensure
|
|
|
|
Process.kill(9, lookupd)
|
|
|
|
Process.kill(9, d)
|
|
|
|
Process.kill(9, admin)
|
|
|
|
Process.kill(9, to_file)
|
|
|
|
Process.wait lookupd
|
|
|
|
Process.wait d
|
|
|
|
Process.wait admin
|
|
|
|
Process.wait to_file
|
|
|
|
end
|
2013-12-02 05:17:12 +00:00
|
|
|
end
|
|
|
|
end
|