nsq-cluster 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +93 -0
- data/LICENSE +20 -0
- data/README.md +17 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/nsq-cluster +36 -0
- data/lib/nsq-cluster.rb +83 -0
- data/lib/nsq-cluster/nsqadmin.rb +34 -0
- data/lib/nsq-cluster/nsqd.rb +74 -0
- data/lib/nsq-cluster/nsqlookupd.rb +28 -0
- data/lib/nsq-cluster/process_wrapper.rb +52 -0
- data/nsq-cluster.gemspec +74 -0
- data/test/helper.rb +33 -0
- data/test/nsq_cluster_spec.rb +12 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f22947bac09ad1ac1a45fac63b669d0adf275421
|
4
|
+
data.tar.gz: c54f9eac0639203bd805a7b2b3720270ca213fa8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a2897e1ee5a2f1b25f8dc04f2e3b3653fe30baaa6f102409e8ca69abaebaf73cb63788fbfb29d11f9dd05030bf0382f9d30bc3d96a92a378bb4c33a2449c87e4
|
7
|
+
data.tar.gz: a48a8ee1ecc632bfa5f00e860bb4b1046a13d7ecd1f3282bd53c1d1543967f7d9c2edd4de7d1caba0a7fcb5058eeb8543d2d1a05402aa72c6fc7fdf4fcfb192f
|
data/.document
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
nsq-cluster
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.0
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nsq-cluster (0.1.0)
|
5
|
+
nsq-cluster
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (4.1.0)
|
11
|
+
i18n (~> 0.6, >= 0.6.9)
|
12
|
+
json (~> 1.7, >= 1.7.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
addressable (2.3.6)
|
17
|
+
builder (3.2.2)
|
18
|
+
descendants_tracker (0.0.4)
|
19
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
20
|
+
docile (1.1.3)
|
21
|
+
faraday (0.9.0)
|
22
|
+
multipart-post (>= 1.2, < 3)
|
23
|
+
git (1.2.6)
|
24
|
+
github_api (0.11.3)
|
25
|
+
addressable (~> 2.3)
|
26
|
+
descendants_tracker (~> 0.0.1)
|
27
|
+
faraday (~> 0.8, < 0.10)
|
28
|
+
hashie (>= 1.2)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
nokogiri (~> 1.6.0)
|
31
|
+
oauth2
|
32
|
+
hashie (2.1.1)
|
33
|
+
highline (1.6.21)
|
34
|
+
i18n (0.6.9)
|
35
|
+
jeweler (2.0.1)
|
36
|
+
builder
|
37
|
+
bundler (>= 1.0)
|
38
|
+
git (>= 1.2.5)
|
39
|
+
github_api
|
40
|
+
highline (>= 1.6.15)
|
41
|
+
nokogiri (>= 1.5.10)
|
42
|
+
rake
|
43
|
+
rdoc
|
44
|
+
json (1.8.1)
|
45
|
+
json (1.8.1-java)
|
46
|
+
jwt (0.1.11)
|
47
|
+
multi_json (>= 1.5)
|
48
|
+
mini_portile (0.5.3)
|
49
|
+
minitest (5.3.2)
|
50
|
+
multi_json (1.9.2)
|
51
|
+
multi_xml (0.5.5)
|
52
|
+
multipart-post (2.0.0)
|
53
|
+
nokogiri (1.6.1)
|
54
|
+
mini_portile (~> 0.5.0)
|
55
|
+
nokogiri (1.6.1-java)
|
56
|
+
mini_portile (~> 0.5.0)
|
57
|
+
oauth2 (0.9.3)
|
58
|
+
faraday (>= 0.8, < 0.10)
|
59
|
+
jwt (~> 0.1.8)
|
60
|
+
multi_json (~> 1.3)
|
61
|
+
multi_xml (~> 0.5)
|
62
|
+
rack (~> 1.2)
|
63
|
+
rack (1.5.2)
|
64
|
+
rake (10.2.2)
|
65
|
+
rdoc (3.12.2)
|
66
|
+
json (~> 1.4)
|
67
|
+
shoulda (3.5.0)
|
68
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
69
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
70
|
+
shoulda-context (1.2.1)
|
71
|
+
shoulda-matchers (2.6.0)
|
72
|
+
activesupport (>= 3.0.0)
|
73
|
+
simplecov (0.8.2)
|
74
|
+
docile (~> 1.1.0)
|
75
|
+
multi_json
|
76
|
+
simplecov-html (~> 0.8.0)
|
77
|
+
simplecov-html (0.8.0)
|
78
|
+
thread_safe (0.3.3)
|
79
|
+
thread_safe (0.3.3-java)
|
80
|
+
tzinfo (1.1.0)
|
81
|
+
thread_safe (~> 0.1)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
java
|
85
|
+
ruby
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
bundler (~> 1.0)
|
89
|
+
jeweler (~> 2.0.1)
|
90
|
+
nsq-cluster!
|
91
|
+
rdoc (~> 3.12)
|
92
|
+
shoulda
|
93
|
+
simplecov
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Wistia, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# nsq-cluster
|
2
|
+
|
3
|
+
Easily start up a local NSQ cluster. This is great for testing.
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
# Start a cluster of 3 nsqd's and 2 nsqlookupd's
|
7
|
+
cluster = NsqCluster.new(nsqd_count: 3, nsqlookupd_count: 2)
|
8
|
+
|
9
|
+
# Stop the 3rd nsqd instance
|
10
|
+
cluster.nsqd.last.stop
|
11
|
+
|
12
|
+
# Start it back up again
|
13
|
+
cluster.nsqd.last.start
|
14
|
+
|
15
|
+
# Tear down the whole cluster
|
16
|
+
cluster.destroy
|
17
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "nsq-cluster"
|
18
|
+
gem.homepage = "http://github.com/wistia/nsq-cluster"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Easily setup and manage a local NSQ cluster}
|
21
|
+
gem.description = %Q{Setup nsqd, nsqlookupd, and nsqadmin in a jiffy. Great for testing!}
|
22
|
+
gem.email = "brendan@wistia.com"
|
23
|
+
gem.authors = ["Brendan Schwartz"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/*_spec.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Code coverage detail"
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = "true"
|
38
|
+
Rake::Task['test'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "nsq-cluster #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/nsq-cluster
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nsq-cluster'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {
|
7
|
+
nsqd_count: 1,
|
8
|
+
nsqlookupd_count: 1,
|
9
|
+
nsqadmin: true,
|
10
|
+
silent: false
|
11
|
+
}
|
12
|
+
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
opts.banner = "Usage: nsq-cluster [options]"
|
15
|
+
|
16
|
+
opts.on("-q", "--nsqd", "Number of nsqd instances to run") do |c|
|
17
|
+
options[:nsqd_count] = c
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-l", "--nsqlookupd", "Number of nsqd instances to run") do |l|
|
21
|
+
options[:nsqlookupd_count] = l
|
22
|
+
end
|
23
|
+
end.parse!
|
24
|
+
|
25
|
+
print 'Starting cluster ... '
|
26
|
+
cluster = NsqCluster.new(options)
|
27
|
+
puts 'started'
|
28
|
+
|
29
|
+
Signal.trap('INT') do
|
30
|
+
print 'Shutting down ... '
|
31
|
+
cluster.destroy
|
32
|
+
puts 'done'
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
|
36
|
+
loop { sleep(1) }
|
data/lib/nsq-cluster.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#
|
2
|
+
# This provides an easy way to locally spin up a cluster of `nsqd` and
|
3
|
+
# `nsqlookupd` processes.
|
4
|
+
#
|
5
|
+
# Usage:
|
6
|
+
#
|
7
|
+
# require 'nsq-cluster'
|
8
|
+
# cluster = NsqCluster.new(nsqd_count: 2, nsqlookupd_count: 2)
|
9
|
+
# cluster.nsqd[0].stop
|
10
|
+
# cluster.nsqd[0].start
|
11
|
+
# cluster.destroy
|
12
|
+
#
|
13
|
+
|
14
|
+
require_relative 'nsq-cluster/nsqlookupd'
|
15
|
+
require_relative 'nsq-cluster/nsqd'
|
16
|
+
require_relative 'nsq-cluster/nsqadmin'
|
17
|
+
|
18
|
+
class NsqCluster
|
19
|
+
|
20
|
+
attr_reader :nsqd, :nsqlookupd, :nsqadmin
|
21
|
+
|
22
|
+
def initialize(opts = {})
|
23
|
+
opts = {
|
24
|
+
nsqlookupd_count: 0,
|
25
|
+
nsqd_count: 0,
|
26
|
+
nsqadmin: false,
|
27
|
+
nsqd_options: {},
|
28
|
+
silent: true
|
29
|
+
}.merge(opts)
|
30
|
+
|
31
|
+
@silent = opts[:silent]
|
32
|
+
|
33
|
+
@nsqlookupd = create_nsqlookupds(opts[:nsqlookupd_count])
|
34
|
+
@nsqd = create_nsqds(opts[:nsqd_count], opts[:nsqd_options])
|
35
|
+
@nsqadmin = create_nsqadmin if opts[:nsqadmin]
|
36
|
+
|
37
|
+
# start everything!
|
38
|
+
(@nsqlookupd + @nsqd + [@nsqadmin]).compact.each { |d| d.start }
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def create_nsqlookupds(count)
|
43
|
+
(0...count).map do |idx|
|
44
|
+
Nsqlookupd.new(
|
45
|
+
tcp_port: 4160 + idx * 2,
|
46
|
+
http_port: 4161 + idx * 2,
|
47
|
+
silent: @silent
|
48
|
+
)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def create_nsqds(count, options)
|
54
|
+
(0...count).map do |idx|
|
55
|
+
Nsqd.new(options.merge({
|
56
|
+
tcp_port: 4150 + idx * 2,
|
57
|
+
http_port: 4151 + idx * 2,
|
58
|
+
nsqlookupd: @nsqlookupd,
|
59
|
+
silent: @silent
|
60
|
+
}))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
def create_nsqadmin
|
66
|
+
Nsqadmin.new(
|
67
|
+
nsqlookupd: @nsqlookupd,
|
68
|
+
silent: @silent
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
def destroy
|
74
|
+
(@nsqd + @nsqlookupd).each { |d| d.destroy }
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
# return an array of http endpoints
|
79
|
+
def nsqlookupd_http_endpoints
|
80
|
+
@nsqlookupd.map { |lookupd| "http://#{lookupd.host}:#{lookupd.http_port}" }
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'process_wrapper'
|
2
|
+
|
3
|
+
class Nsqadmin < ProcessWrapper
|
4
|
+
|
5
|
+
attr_reader :host, :http_port
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
@host = '127.0.0.1'
|
9
|
+
@http_port = opts[:http_port] || 4171
|
10
|
+
@lookupd = opts[:nsqlookupd] || []
|
11
|
+
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def command
|
17
|
+
'nsqadmin'
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def args
|
22
|
+
base_args = [
|
23
|
+
%Q(--http-address=#{@host}:#{@http_port})
|
24
|
+
]
|
25
|
+
|
26
|
+
lookupd_args = @lookupd.map do |ld|
|
27
|
+
%Q(--lookupd-http-address=#{ld.host}:#{ld.http_port})
|
28
|
+
end
|
29
|
+
|
30
|
+
base_args + lookupd_args
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require_relative 'process_wrapper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
class Nsqd < ProcessWrapper
|
5
|
+
|
6
|
+
|
7
|
+
attr_reader :host, :tcp_port, :http_port
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(opts = {})
|
11
|
+
@host = '127.0.0.1'
|
12
|
+
@tcp_port = opts[:tcp_port] || 4150
|
13
|
+
@http_port = opts[:http_port] || 4151
|
14
|
+
@lookupd = opts[:nsqlookupd] || []
|
15
|
+
@msg_timeout = opts[:msg_timeout] || '60s'
|
16
|
+
|
17
|
+
clear_data_directory
|
18
|
+
create_data_directory
|
19
|
+
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
super
|
26
|
+
clear_data_directory
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def command
|
31
|
+
'nsqd'
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def args
|
36
|
+
base_args = [
|
37
|
+
%Q(--tcp-address=#{@host}:#{@tcp_port}),
|
38
|
+
%Q(--http-address=#{@host}:#{@http_port}),
|
39
|
+
%Q(--data-path=#{data_path}),
|
40
|
+
%Q(--worker-id=#{worker_id}),
|
41
|
+
%Q(--msg-timeout=#{@msg_timeout})
|
42
|
+
]
|
43
|
+
|
44
|
+
lookupd_args = @lookupd.map do |ld|
|
45
|
+
%Q(--lookupd-tcp-address=#{ld.host}:#{ld.tcp_port})
|
46
|
+
end
|
47
|
+
|
48
|
+
base_args + lookupd_args
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def worker_id
|
53
|
+
@tcp_port
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# find or create a temporary data directory for this instance
|
58
|
+
def data_path
|
59
|
+
"/tmp/nsqd-#{worker_id}"
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def create_data_directory
|
66
|
+
Dir.mkdir(data_path)
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def clear_data_directory
|
71
|
+
FileUtils.rm_rf(data_path) if Dir.exist?(data_path)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'process_wrapper'
|
2
|
+
|
3
|
+
class Nsqlookupd < ProcessWrapper
|
4
|
+
|
5
|
+
attr_reader :host, :tcp_port, :http_port
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
@host = '127.0.0.1'
|
9
|
+
@tcp_port = opts[:tcp_port] || 4160
|
10
|
+
@http_port = opts[:http_port] || 4161
|
11
|
+
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def command
|
17
|
+
'nsqlookupd'
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def args
|
22
|
+
[
|
23
|
+
%Q(--tcp-address=#{@host}:#{@tcp_port}),
|
24
|
+
%Q(--http-address=#{@host}:#{@http_port})
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class ProcessWrapper
|
2
|
+
|
3
|
+
|
4
|
+
def initialize(opts = {})
|
5
|
+
@silent = opts[:silent]
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def start
|
10
|
+
raise "#{command} is already running" if running?
|
11
|
+
@pid = spawn(command, *args, [:out, :err] => output)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def stop
|
16
|
+
raise "#{command} is not running" unless running?
|
17
|
+
Process.kill('TERM', @pid)
|
18
|
+
Process.waitpid(@pid)
|
19
|
+
@pid = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def destroy
|
24
|
+
stop if running?
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def running?
|
29
|
+
!!@pid
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def command
|
34
|
+
raise 'you have to override this in a subclass, hotshot'
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def args
|
39
|
+
raise 'you have to override this in a subclass as well, buddy'
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def output
|
44
|
+
if @silent
|
45
|
+
'/dev/null'
|
46
|
+
else
|
47
|
+
:out
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
data/nsq-cluster.gemspec
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: nsq-cluster 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "nsq-cluster"
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Brendan Schwartz"]
|
14
|
+
s.date = "2014-04-14"
|
15
|
+
s.description = "Setup nsqd, nsqlookupd, and nsqadmin in a jiffy. Great for testing!"
|
16
|
+
s.email = "brendan@wistia.com"
|
17
|
+
s.executables = ["nsq-cluster"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".ruby-gemset",
|
25
|
+
".ruby-version",
|
26
|
+
"Gemfile",
|
27
|
+
"Gemfile.lock",
|
28
|
+
"LICENSE",
|
29
|
+
"README.md",
|
30
|
+
"Rakefile",
|
31
|
+
"VERSION",
|
32
|
+
"bin/nsq-cluster",
|
33
|
+
"lib/nsq-cluster.rb",
|
34
|
+
"lib/nsq-cluster/nsqadmin.rb",
|
35
|
+
"lib/nsq-cluster/nsqd.rb",
|
36
|
+
"lib/nsq-cluster/nsqlookupd.rb",
|
37
|
+
"lib/nsq-cluster/process_wrapper.rb",
|
38
|
+
"nsq-cluster.gemspec",
|
39
|
+
"test/helper.rb",
|
40
|
+
"test/nsq_cluster_spec.rb"
|
41
|
+
]
|
42
|
+
s.homepage = "http://github.com/wistia/nsq-cluster"
|
43
|
+
s.licenses = ["MIT"]
|
44
|
+
s.rubygems_version = "2.2.2"
|
45
|
+
s.summary = "Easily setup and manage a local NSQ cluster"
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
s.specification_version = 4
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_runtime_dependency(%q<nsq-cluster>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
56
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<nsq-cluster>, [">= 0"])
|
59
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
62
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
63
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
64
|
+
end
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<nsq-cluster>, [">= 0"])
|
67
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
70
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
71
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'minitest/pride'
|
4
|
+
|
5
|
+
module SimpleCov::Configuration
|
6
|
+
def clean_filters
|
7
|
+
@filters = []
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
SimpleCov.configure do
|
12
|
+
clean_filters
|
13
|
+
load_profile 'test_frameworks'
|
14
|
+
end
|
15
|
+
|
16
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
17
|
+
add_filter "/.rvm/"
|
18
|
+
end
|
19
|
+
require 'rubygems'
|
20
|
+
require 'bundler'
|
21
|
+
begin
|
22
|
+
Bundler.setup(:default, :development)
|
23
|
+
rescue Bundler::BundlerError => e
|
24
|
+
$stderr.puts e.message
|
25
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
26
|
+
exit e.status_code
|
27
|
+
end
|
28
|
+
require 'shoulda'
|
29
|
+
|
30
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
31
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
32
|
+
require 'nsq-cluster'
|
33
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe NsqCluster do
|
4
|
+
|
5
|
+
it 'should start up a cluster for realsies' do
|
6
|
+
cluster = NsqCluster.new(nsqd_count: 1, nsqlookupd_count: 1)
|
7
|
+
cluster.nsqd.length.must_equal 1
|
8
|
+
cluster.nsqlookupd.length.must_equal 1
|
9
|
+
cluster.destroy
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nsq-cluster
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brendan Schwartz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nsq-cluster
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: shoulda
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Setup nsqd, nsqlookupd, and nsqadmin in a jiffy. Great for testing!
|
98
|
+
email: brendan@wistia.com
|
99
|
+
executables:
|
100
|
+
- nsq-cluster
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files:
|
103
|
+
- LICENSE
|
104
|
+
- README.md
|
105
|
+
files:
|
106
|
+
- ".document"
|
107
|
+
- ".ruby-gemset"
|
108
|
+
- ".ruby-version"
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- VERSION
|
115
|
+
- bin/nsq-cluster
|
116
|
+
- lib/nsq-cluster.rb
|
117
|
+
- lib/nsq-cluster/nsqadmin.rb
|
118
|
+
- lib/nsq-cluster/nsqd.rb
|
119
|
+
- lib/nsq-cluster/nsqlookupd.rb
|
120
|
+
- lib/nsq-cluster/process_wrapper.rb
|
121
|
+
- nsq-cluster.gemspec
|
122
|
+
- test/helper.rb
|
123
|
+
- test/nsq_cluster_spec.rb
|
124
|
+
homepage: http://github.com/wistia/nsq-cluster
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.2.2
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Easily setup and manage a local NSQ cluster
|
148
|
+
test_files: []
|