nsq-cluster 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 033d98f5168d98c5ccbbcf74f07c39e664381211
4
- data.tar.gz: 2bbce8696cb02e03e1957a50ceab19497f8d6a5c
3
+ metadata.gz: af4e1c18926766a3b124a0e962e60b9395f0330e
4
+ data.tar.gz: 9fc20529ef3b4d5c58e82e43617bb679d52327f9
5
5
  SHA512:
6
- metadata.gz: 806ce00281ea63daec5f0cb793cd3db757cb1d7e4999c842417426de1c61b97174509eab98abf987fc51fa32ed6dd1fd55ba98ac040fb6196320b6dc7ddd0887
7
- data.tar.gz: c7c335b5e6e6b984de79d7c758c45ada043f2e4fa63e5e5f44b4be716e700a3a194d549d441e576f7836858b5404c05f4e2663e7c9260a4776917b60a374c3f0
6
+ metadata.gz: c0d65780e1ff49e975ebb9450ada77d62551dcd405d1c030970fe84c0446d75e920a545359c5f05a04f7809887de5f79fe6318f35bb6e92a93ba7c7ca87ef550
7
+ data.tar.gz: 3e979a9a31a934cfd093bf4fa8dbcf14dc90960659c2d9129e9957a07207ba70c042fde6fafec1db99165b3d0a543f56ae16f816d85f796acccfb68a7c179d1f
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.1.0
1
+ ruby-2.1.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nsq-cluster (0.1.1)
4
+ nsq-cluster (0.1.2)
5
5
  nsq-cluster
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/nsq-cluster.rb CHANGED
@@ -22,6 +22,7 @@ class NsqCluster
22
22
  def initialize(opts = {})
23
23
  opts = {
24
24
  nsqlookupd_count: 0,
25
+ nsqdlookupd_options: {},
25
26
  nsqd_count: 0,
26
27
  nsqadmin: false,
27
28
  nsqd_options: {},
@@ -30,7 +31,7 @@ class NsqCluster
30
31
 
31
32
  @silent = opts[:silent]
32
33
 
33
- @nsqlookupd = create_nsqlookupds(opts[:nsqlookupd_count])
34
+ @nsqlookupd = create_nsqlookupds(opts[:nsqlookupd_count], opts[:nsqdlookupd_options])
34
35
  @nsqd = create_nsqds(opts[:nsqd_count], opts[:nsqd_options])
35
36
  @nsqadmin = create_nsqadmin if opts[:nsqadmin]
36
37
 
@@ -39,13 +40,13 @@ class NsqCluster
39
40
  end
40
41
 
41
42
 
42
- def create_nsqlookupds(count)
43
+ def create_nsqlookupds(count, options)
43
44
  (0...count).map do |idx|
44
- Nsqlookupd.new(
45
+ Nsqlookupd.new(options.merge({
45
46
  tcp_port: 4160 + idx * 2,
46
47
  http_port: 4161 + idx * 2,
47
48
  silent: @silent
48
- )
49
+ }))
49
50
  end
50
51
  end
51
52
 
@@ -10,11 +10,12 @@ class Nsqd < ProcessWrapper
10
10
 
11
11
 
12
12
  def initialize(opts = {})
13
- @host = '127.0.0.1'
13
+ @host = opts[:host] || '127.0.0.1'
14
14
  @tcp_port = opts[:tcp_port] || 4150
15
15
  @http_port = opts[:http_port] || 4151
16
16
  @lookupd = opts[:nsqlookupd] || []
17
17
  @msg_timeout = opts[:msg_timeout] || '60s'
18
+ @broadcast_address = opts[:broadcast_address] || @host
18
19
 
19
20
  clear_data_directory
20
21
  create_data_directory
@@ -40,7 +41,8 @@ class Nsqd < ProcessWrapper
40
41
  %Q(--http-address=#{@host}:#{@http_port}),
41
42
  %Q(--data-path=#{data_path}),
42
43
  %Q(--worker-id=#{worker_id}),
43
- %Q(--msg-timeout=#{@msg_timeout})
44
+ %Q(--msg-timeout=#{@msg_timeout}),
45
+ %Q(--broadcast-address=#{@broadcast_address})
44
46
  ]
45
47
 
46
48
  lookupd_args = @lookupd.map do |ld|
@@ -7,9 +7,10 @@ class Nsqlookupd < ProcessWrapper
7
7
  attr_reader :host, :tcp_port, :http_port
8
8
 
9
9
  def initialize(opts = {})
10
- @host = '127.0.0.1'
10
+ @host = opts[:host] || '127.0.0.1'
11
11
  @tcp_port = opts[:tcp_port] || 4160
12
12
  @http_port = opts[:http_port] || 4161
13
+ @broadcast_address = opts[:broadcast_address] || @host
13
14
 
14
15
  super
15
16
  end
@@ -23,7 +24,8 @@ class Nsqlookupd < ProcessWrapper
23
24
  def args
24
25
  [
25
26
  %Q(--tcp-address=#{@host}:#{@tcp_port}),
26
- %Q(--http-address=#{@host}:#{@http_port})
27
+ %Q(--http-address=#{@host}:#{@http_port}),
28
+ %Q(--broadcast-address=#{@broadcast_address})
27
29
  ]
28
30
  end
29
31
 
data/nsq-cluster.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: nsq-cluster 0.1.1 ruby lib
5
+ # stub: nsq-cluster 0.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nsq-cluster"
9
- s.version = "0.1.1"
9
+ s.version = "0.1.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Brendan Schwartz"]
14
- s.date = "2014-06-26"
14
+ s.date = "2014-07-17"
15
15
  s.description = "Setup nsqd, nsqlookupd, and nsqadmin in a jiffy. Great for testing!"
16
16
  s.email = "brendan@wistia.com"
17
17
  s.executables = ["nsq-cluster"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsq-cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Schwartz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-26 00:00:00.000000000 Z
11
+ date: 2014-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nsq-cluster