celluloid-zmq 0.17.0 → 0.17.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: e422e2646f285c80a54a9ccd97ba55c34ab7efcd
4
- data.tar.gz: b4ffc044fe8a8f4c1debf64718b1606e153132f1
3
+ metadata.gz: 36dca8ec60ff7a0f59dd559310900fcaac0ab5e5
4
+ data.tar.gz: 8a898f176a061fd629a11ceba26364b126c350dd
5
5
  SHA512:
6
- metadata.gz: fb33860007166b00eb2a75851d4fa449cb6075d2f88c9dee707eb4da563d0cbacb8a28be2658c5325e3a70619a893eb598791cffc0e3563596e1eb16a9f576ef
7
- data.tar.gz: a0426f7a176ed76d86c01203111fcb878d29293686c5757f3c0099295ca8d9cc4eb78c6201e4961022fa9723ea6aa60e1813ac63fdbb3564dbbd91228944e5af
6
+ metadata.gz: 68b728f5fa55af92097d409a0ce0e4328e294402e3a64fba0d7cd03b29f3d5e268557186e969a5d21361863994554b0bcf5fa96fe9cd29664da317b0f1f143a1
7
+ data.tar.gz: c7066885281f4ad056e2c1b6663af8feb90a7a1b08b622089c32da3f46919f3a810aac16b7d51d64df41f4247fa6d9fe8835b6445be10ab42b6ed26a82c7b24a
data/CHANGES.md CHANGED
@@ -1,4 +1,9 @@
1
- 0.70.0
1
+ 0.17.2 (2015-09-30)
2
+ -----
3
+ * Revamped test suite, using shared RSpec configuration layer provided by Celluloid itself.
4
+ * Updated gem dependencies provided by Celluloid::Sync... extraneous gems removed, or marked as development dependencies.
5
+
6
+ 0.17.0 (2015-08-15)
2
7
  -----
3
8
  * Adapted to be compliant with version 0.17.0 of Celluloid.
4
9
  * Added `write_to` for use with `Router` sockets.
data/README.md CHANGED
@@ -5,11 +5,11 @@
5
5
  [![Code Climate](https://codeclimate.com/github/celluloid/celluloid-zmq.png)](https://codeclimate.com/github/celluloid/celluloid-zmq)
6
6
  [![Coverage Status](https://coveralls.io/repos/celluloid/celluloid-zmq/badge.png?branch=master)](https://coveralls.io/r/celluloid/celluloid-zmq)
7
7
 
8
- Celluloid::ZMQ provides Celluloid actors that can interact with [0MQ sockets][0mq].
9
- Underneath, it's built on the [ffi-rzmq][ffi-rzmq] library. Celluloid::ZMQ was
8
+ `Celluloid::ZMQ` provides Celluloid actors that can interact with [0MQ sockets][0mq].
9
+ Underneath, it's built on the [ffi-rzmq][ffi-rzmq] library. `Celluloid::ZMQ` was
10
10
  primarily created for the purpose of writing [DCell][dcell], distributed Celluloid
11
11
  over 0MQ, so before you go building your own distributed Celluloid systems with
12
- Celluloid::ZMQ, be sure to give DCell a look and decide if it fits your purposes.
12
+ `Celluloid::ZMQ`, be sure to give DCell a look and decide if it fits your purposes.
13
13
 
14
14
  [0mq]: http://www.zeromq.org/
15
15
  [ffi-rzmq]: https://github.com/chuckremes/ffi-rzmq
@@ -31,13 +31,14 @@ to the JRuby executable, or set the "JRUBY_OPTS=--1.9" environment variable.
31
31
 
32
32
  ## 0MQ Socket Types
33
33
 
34
- The following 0MQ socket types are supported (see [sockets.rb][socketsrb] for more info)
34
+ The following 0MQ socket types are supported (see [types.rb][types] for more info)
35
35
 
36
- [socketsrb]: https://github.com/celluloid/celluloid-zmq/blob/master/lib/celluloid/zmq/sockets.rb
36
+ [types]: https://github.com/celluloid/celluloid-zmq/blob/master/lib/celluloid/zmq/socket/types.rb
37
37
 
38
- * ReqSocket / RepSocket
39
- * PushSocket / PullSocket
40
- * PubSocket / SubSocket
38
+ * Req / Rep
39
+ * Push / Pull
40
+ * Pub / Sub
41
+ * Dealer / Router
41
42
 
42
43
  ## Usage
43
44
 
@@ -50,7 +51,7 @@ class Server
50
51
  include Celluloid::ZMQ
51
52
 
52
53
  def initialize(address)
53
- @socket = PullSocket.new
54
+ @socket = Socket::Pull.new
54
55
 
55
56
  begin
56
57
  @socket.bind(address)
@@ -73,7 +74,7 @@ class Client
73
74
  include Celluloid::ZMQ
74
75
 
75
76
  def initialize(address)
76
- @socket = PushSocket.new
77
+ @socket = Socket::Push.new
77
78
 
78
79
  begin
79
80
  @socket.connect(address)
@@ -104,4 +105,6 @@ sleep
104
105
  Copyright
105
106
  ---------
106
107
 
107
- Copyright (c) 2014 Tony Arcieri. See LICENSE.txt for further details.
108
+ Copyright (c) 2014-2015 Tony Arcieri, Donovan Keme.
109
+
110
+ Distributed under the MIT License. See [LICENSE.txt](https://github.com/celluloid/celluloid/blob/master/LICENSE.txt) for further details.
data/Rakefile CHANGED
@@ -1,7 +1,13 @@
1
1
  #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
3
- require 'rspec/core/rake_task'
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
4
 
5
5
  RSpec::Core::RakeTask.new
6
6
 
7
- task :default => :spec
7
+ Dir["tasks/**/*.rake"].each { |task| load task }
8
+
9
+ default_tasks = ["spec"]
10
+ default_tasks << "rubocop" unless ENV["CI"]
11
+
12
+ task default: default_tasks
13
+ task ci: %w(spec)
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.add_dependency "ffi-rzmq"
18
18
 
19
19
  # Files
20
- ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten
21
- gem.files = (Dir['**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
22
- gem.test_files = (Dir['spec/**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
20
+ ignores = File.read(".gitignore").split(/\r?\n/).reject { |f| f =~ /^(#.+|\s*)$/ }.map { |f| Dir[f] }.flatten
21
+ gem.files = (Dir["**/*", ".gitignore"] - ignores).reject { |f| !File.file?(f) }
22
+ gem.test_files = (Dir["spec/**/*", ".gitignore"] - ignores).reject { |f| !File.file?(f) }
23
23
  # gem.executables = Dir['bin/*'].map { |f| File.basename(f) }
24
- gem.require_paths = ['lib']
24
+ gem.require_paths = ["lib"]
25
25
  end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Tony Arcieri, Donovan Keme
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -2,9 +2,9 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "celluloid-culture"
5
- spec.version = "0.1.1"
6
- spec.authors = ["Tony Arcieri"]
7
- spec.email = ["bascule@gmail.com"]
5
+ spec.version = "0.2"
6
+ spec.authors = ["Tony Arcieri", "Donovan Keme"]
7
+ spec.email = ["bascule@gmail.com", "code@extremist.digital"]
8
8
 
9
9
  spec.summary = "The culture of Celluloid, in RubyGem form!"
10
10
  spec.description = "In which we try to codify Celluloid's life philosophy as Ruby"
@@ -1,6 +1,11 @@
1
1
  bundler:
2
+ dependency: development
3
+
2
4
  nenv:
5
+ dependency: development
6
+
3
7
  dotenv:
8
+ dependency: development
4
9
 
5
10
  benchmark_suite:
6
11
  dependency: development
@@ -23,6 +28,9 @@ rspec:
23
28
  guard-rspec:
24
29
  dependency: development
25
30
 
31
+ rspec-retry:
32
+ dependency: development
33
+
26
34
  coveralls:
27
35
  dependency: development
28
36
  gemfile:
@@ -30,7 +38,7 @@ coveralls:
30
38
 
31
39
  celluloid:
32
40
  dependency: core
33
- version: "~> 0.17"
41
+ version: ">= 0.17.2"
34
42
  gemfile:
35
43
  github: celluloid/celluloid
36
44
  branch: master
@@ -72,13 +80,6 @@ celluloid-extras:
72
80
  submodules: true
73
81
 
74
82
  timers:
75
- version: "~> 4.0.0"
83
+ version: ">= 4.1.1"
76
84
  gemfile:
77
85
  github: celluloid/timers
78
-
79
- rspec-logsplit:
80
- version: ">= 0.1.2"
81
- gemfile:
82
- github: "abstractive/rspec-logsplit"
83
- branch: "master"
84
- require: false
File without changes
@@ -2,3 +2,4 @@ inherit_from:
2
2
  - lint.yml
3
3
  - metrics.yml
4
4
  - style.yml
5
+ - perf.yml
@@ -46,3 +46,12 @@ Style/RescueModifier:
46
46
 
47
47
  Style/GlobalVars:
48
48
  Enabled: false
49
+
50
+ Style/FormatString:
51
+ EnforcedStyle: percent
52
+
53
+ Style/TrailingUnderscoreVariable:
54
+ Enabled: false
55
+
56
+ Style/ParallelAssignment:
57
+ Enabled: false
@@ -1,4 +1,4 @@
1
- require 'celluloid/zmq/current'
1
+ require "celluloid/zmq/current"
2
2
 
3
3
  Celluloid::ZMQ.init
4
4
 
@@ -15,10 +15,10 @@ class PublishSubscribe
15
15
  s5 = Socket::Sub.new
16
16
 
17
17
  s1.linger = 100
18
- s2.subscribe('') # receive all
19
- s3.subscribe('animals') # receive any starting with this string
20
- s4.subscribe('animals.dog')
21
- s5.subscribe('animals.cat')
18
+ s2.subscribe("") # receive all
19
+ s3.subscribe("animals") # receive any starting with this string
20
+ s4.subscribe("animals.dog")
21
+ s5.subscribe("animals.cat")
22
22
 
23
23
  s1.bind(link)
24
24
  s2.connect(link)
@@ -37,32 +37,31 @@ class PublishSubscribe
37
37
  # automatically separate the topic from the body
38
38
  s1.write(topic, payload, s1.identity)
39
39
 
40
- topic = ''
40
+ topic = ""
41
41
  s2.read(topic)
42
42
 
43
- body = ''
43
+ body = ""
44
44
  s2.read(body) if s2.more_parts?
45
45
 
46
- identity = ''
46
+ identity = ""
47
47
  s2.read(identity) if s2.more_parts?
48
48
  puts "s2 received topic [#{topic}], body [#{body}], identity [#{identity}]"
49
49
 
50
-
51
- topic = ''
50
+ topic = ""
52
51
  s3.read(topic)
53
52
 
54
- body = ''
53
+ body = ""
55
54
  s3.read(body) if s3.more_parts?
56
55
  puts "s3 received topic [#{topic}], body [#{body}]"
57
56
 
58
- topic = ''
57
+ topic = ""
59
58
  s4.read(topic)
60
59
 
61
- body = ''
60
+ body = ""
62
61
  s4.read(body) if s4.more_parts?
63
62
  puts "s4 received topic [#{topic}], body [#{body}]"
64
63
 
65
- s5_string = ''
64
+ s5_string = ""
66
65
  s5.read(s5_string)
67
66
 
68
67
  # we will never get here
@@ -1,18 +1,18 @@
1
- require 'ffi-rzmq'
1
+ require "ffi-rzmq"
2
2
 
3
3
  $CELLULOID_ZMQ_BACKPORTED = (ENV["CELLULOID_ZMQ_BACKPORTED"] != "false") unless defined?($CELLULOID_ZMQ_BACKPORTED)
4
4
 
5
- require ($CELLULOID_ZMQ_BACKPORTED) ? 'celluloid' : 'celluloid/current'
5
+ require ($CELLULOID_ZMQ_BACKPORTED) ? "celluloid" : "celluloid/current"
6
6
 
7
- require 'celluloid/zmq/mailbox'
8
- require 'celluloid/zmq/reactor'
9
- require 'celluloid/zmq/socket'
10
- require 'celluloid/zmq/version'
11
- require 'celluloid/zmq/waker'
7
+ require "celluloid/zmq/mailbox"
8
+ require "celluloid/zmq/reactor"
9
+ require "celluloid/zmq/socket"
10
+ require "celluloid/zmq/version"
11
+ require "celluloid/zmq/waker"
12
12
 
13
- require 'celluloid/zmq/socket/readable'
14
- require 'celluloid/zmq/socket/writable'
15
- require 'celluloid/zmq/socket/types'
13
+ require "celluloid/zmq/socket/readable"
14
+ require "celluloid/zmq/socket/writable"
15
+ require "celluloid/zmq/socket/types"
16
16
 
17
17
  module Celluloid
18
18
  # Actors which run alongside 0MQ sockets
@@ -34,7 +34,7 @@ module Celluloid
34
34
  end
35
35
 
36
36
  def context
37
- raise UninitializedError, "you must initialize Celluloid::ZMQ by calling Celluloid::ZMQ.init" unless @context
37
+ fail UninitializedError, "you must initialize Celluloid::ZMQ by calling Celluloid::ZMQ.init" unless @context
38
38
  @context
39
39
  end
40
40
 
@@ -55,7 +55,7 @@ module Celluloid
55
55
  mailbox = Thread.current[:celluloid_mailbox]
56
56
  mailbox.reactor.wait_readable(socket)
57
57
  else
58
- raise ArgumentError, "unable to wait for ZMQ sockets outside the event loop"
58
+ fail ArgumentError, "unable to wait for ZMQ sockets outside the event loop"
59
59
  end
60
60
  nil
61
61
  end
@@ -66,7 +66,7 @@ module Celluloid
66
66
  mailbox = Thread.current[:celluloid_mailbox]
67
67
  mailbox.reactor.wait_writable(socket)
68
68
  else
69
- raise ArgumentError, "unable to wait for ZMQ sockets outside the event loop"
69
+ fail ArgumentError, "unable to wait for ZMQ sockets outside the event loop"
70
70
  end
71
71
  nil
72
72
  end
@@ -76,8 +76,7 @@ module Celluloid
76
76
  ::ZMQ::Util.resultcode_ok?(result)
77
77
  end
78
78
  module_function :result_ok?
79
-
80
79
  end
81
80
  end
82
81
 
83
- require 'celluloid/zmq/deprecate' unless $CELLULOID_BACKPORTED == false || $CELLULOID_ZMQ_BACKPORTED == false
82
+ require "celluloid/zmq/deprecate" unless $CELLULOID_BACKPORTED == false || $CELLULOID_ZMQ_BACKPORTED == false
@@ -3,7 +3,6 @@ module Celluloid
3
3
  # React to incoming 0MQ and Celluloid events. This is kinda sorta supposed
4
4
  # to resemble the Reactor design pattern.
5
5
  class Reactor
6
-
7
6
  extend Forwardable
8
7
  def_delegator :@waker, :signal, :wakeup
9
8
  def_delegator :@waker, :cleanup, :shutdown
@@ -16,9 +15,7 @@ module Celluloid
16
15
  @writers = {}
17
16
 
18
17
  rc = @poller.register @waker.socket, ::ZMQ::POLLIN
19
- unless result_ok? rc
20
- raise "0MQ poll error: #{::ZMQ::Util.error_string}"
21
- end
18
+ fail "0MQ poll error: #{::ZMQ::Util.error_string}" unless result_ok? rc
22
19
  end
23
20
 
24
21
  # Wait for the given ZMQ socket to become readable
@@ -33,8 +30,8 @@ module Celluloid
33
30
 
34
31
  # Monitor the given ZMQ socket with the given options
35
32
  def monitor_zmq(socket, set, type)
36
- if set.has_key? socket
37
- raise ArgumentError, "another method is already waiting on #{socket.inspect}"
33
+ if set.key? socket
34
+ fail ArgumentError, "another method is already waiting on #{socket.inspect}"
38
35
  else
39
36
  set[socket] = Task.current
40
37
  end
@@ -57,7 +54,7 @@ module Celluloid
57
54
  rc = @poller.poll(timeout)
58
55
 
59
56
  unless result_ok? rc
60
- raise IOError, "0MQ poll error: #{::ZMQ::Util.error_string}"
57
+ fail IOError, "0MQ poll error: #{::ZMQ::Util.error_string}"
61
58
  end
62
59
 
63
60
  @poller.readables.each do |sock|
@@ -14,7 +14,7 @@ module Celluloid
14
14
  # Address should be in the form: tcp://1.2.3.4:5678/
15
15
  def connect(addr)
16
16
  unless result_ok? @socket.connect addr
17
- raise IOError, "error connecting to #{addr}: #{::ZMQ::Util.error_string}"
17
+ fail IOError, "error connecting to #{addr}: #{::ZMQ::Util.error_string}"
18
18
  end
19
19
  true
20
20
  end
@@ -23,25 +23,25 @@ module Celluloid
23
23
  @linger = value || -1
24
24
 
25
25
  unless result_ok? @socket.setsockopt(::ZMQ::LINGER, value)
26
- raise IOError, "couldn't set linger: #{::ZMQ::Util.error_string}"
26
+ fail IOError, "couldn't set linger: #{::ZMQ::Util.error_string}"
27
27
  end
28
28
  end
29
29
 
30
30
  def identity=(value)
31
- unless result_ok? @socket.setsockopt(::ZMQ::IDENTITY, "#{value}")
32
- raise IOError, "couldn't set identity: #{::ZMQ::Util.error_string}"
31
+ unless result_ok? @socket.setsockopt(::ZMQ::IDENTITY, "#{value}")
32
+ fail IOError, "couldn't set identity: #{::ZMQ::Util.error_string}"
33
33
  end
34
- #de @socket.identity = value
34
+ # de @socket.identity = value
35
35
  end
36
36
 
37
37
  def identity
38
- #de @socket.identity
38
+ # de @socket.identity
39
39
  get(::ZMQ::IDENTITY)
40
40
  end
41
41
 
42
42
  def set(option, value, length = nil)
43
43
  unless result_ok? @socket.setsockopt(option, value, length)
44
- raise IOError, "couldn't set value for option #{option}: #{::ZMQ::Util.error_string}"
44
+ fail IOError, "couldn't set value for option #{option}: #{::ZMQ::Util.error_string}"
45
45
  end
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ module Celluloid
49
49
  option_value = []
50
50
 
51
51
  unless result_ok? @socket.getsockopt(option, option_value)
52
- raise IOError, "couldn't get value for option #{option}: #{::ZMQ::Util.error_string}"
52
+ fail IOError, "couldn't get value for option #{option}: #{::ZMQ::Util.error_string}"
53
53
  end
54
54
 
55
55
  option_value[0]
@@ -59,7 +59,7 @@ module Celluloid
59
59
  # Address should be in the form: tcp://1.2.3.4:5678/
60
60
  def bind(addr)
61
61
  unless result_ok? @socket.bind(addr)
62
- raise IOError, "couldn't bind to #{addr}: #{::ZMQ::Util.error_string}"
62
+ fail IOError, "couldn't bind to #{addr}: #{::ZMQ::Util.error_string}"
63
63
  end
64
64
  end
65
65
 
@@ -18,11 +18,11 @@ module Celluloid
18
18
  end
19
19
 
20
20
  # Read a message from the socket
21
- def read(buffer = '')
21
+ def read(buffer = "")
22
22
  ZMQ.wait_readable(@socket) if ZMQ.evented?
23
23
 
24
24
  unless result_ok? @socket.recv_string buffer
25
- raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
25
+ fail IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
26
26
  end
27
27
  buffer
28
28
  end
@@ -36,7 +36,7 @@ module Celluloid
36
36
  ZMQ.wait_readable(@socket) if ZMQ.evented?
37
37
 
38
38
  unless result_ok? @socket.recv_strings buffer
39
- raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
39
+ fail IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
40
40
  end
41
41
  buffer
42
42
  end
@@ -89,13 +89,13 @@ module Celluloid
89
89
 
90
90
  def subscribe(topic)
91
91
  unless result_ok? @socket.setsockopt(::ZMQ::SUBSCRIBE, topic)
92
- raise IOError, "couldn't set subscribe: #{::ZMQ::Util.error_string}"
92
+ fail IOError, "couldn't set subscribe: #{::ZMQ::Util.error_string}"
93
93
  end
94
94
  end
95
95
 
96
96
  def unsubscribe(topic)
97
97
  unless result_ok? @socket.setsockopt(::ZMQ::UNSUBSCRIBE, topic)
98
- raise IOError, "couldn't set unsubscribe: #{::ZMQ::Util.error_string}"
98
+ fail IOError, "couldn't set unsubscribe: #{::ZMQ::Util.error_string}"
99
99
  end
100
100
  end
101
101
  end
@@ -8,9 +8,8 @@ module Celluloid
8
8
  # Send a message to the socket
9
9
  def write(*messages)
10
10
  unless result_ok? @socket.send_strings(messages.flatten)
11
- raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}"
11
+ fail IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}"
12
12
  end
13
-
14
13
  messages
15
14
  end
16
15
  alias_method :<<, :write
@@ -18,12 +17,11 @@ module Celluloid
18
17
 
19
18
  def write_to(address, message)
20
19
  error = [IOError, "Failure sending part of message."]
21
- raise *error unless result_ok? @socket.send_string("#{address}", ::ZMQ::SNDMORE)
22
- raise *error unless result_ok? @socket.send_string("", ::ZMQ::SNDMORE)
23
- raise *error unless result_ok? @socket.send_string(message)
20
+ fail *error unless result_ok? @socket.send_string("#{address}", ::ZMQ::SNDMORE)
21
+ fail *error unless result_ok? @socket.send_string("", ::ZMQ::SNDMORE)
22
+ fail *error unless result_ok? @socket.send_string(message)
24
23
  message
25
24
  end
26
-
27
25
  end
28
26
  end
29
27
  end
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  module ZMQ
3
- VERSION = "0.17.0"
3
+ VERSION = "0.17.2"
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ module Celluloid
26
26
  def signal
27
27
  @sender_lock.synchronize do
28
28
  unless result_ok? @sender.send_string PAYLOAD
29
- raise DeadWakerError, "error sending 0MQ message: #{::ZMQ::Util.error_string}"
29
+ fail DeadWakerError, "error sending 0MQ message: #{::ZMQ::Util.error_string}"
30
30
  end
31
31
  end
32
32
  end
@@ -38,18 +38,28 @@ module Celluloid
38
38
 
39
39
  # Wait for another thread to signal this Waker
40
40
  def wait
41
- message = ''
41
+ message = ""
42
42
  rc = @receiver.recv_string message
43
43
 
44
- unless result_ok? rc and message == PAYLOAD
45
- raise DeadWakerError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
44
+ unless result_ok?(rc) && message == PAYLOAD
45
+ fail DeadWakerError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
46
46
  end
47
47
  end
48
48
 
49
49
  # Clean up the IO objects associated with this waker
50
50
  def cleanup
51
- @sender_lock.synchronize { @sender.close rescue nil }
52
- @receiver.close rescue nil
51
+ @sender_lock.synchronize do
52
+ begin
53
+ @sender.close
54
+ rescue
55
+ nil
56
+ end
57
+ end
58
+ begin
59
+ @receiver.close
60
+ rescue
61
+ nil
62
+ end
53
63
  nil
54
64
  end
55
65
  alias_method :shutdown, :cleanup
@@ -1,5 +1,5 @@
1
- require 'celluloid/rspec'
1
+ require "celluloid/rspec"
2
2
 
3
- RSpec.describe Celluloid::ZMQ do
3
+ RSpec.describe Celluloid::ZMQ, library: :ZMQ do
4
4
  it_behaves_like "a Celluloid Actor", Celluloid::ZMQ
5
- end
5
+ end
@@ -1,5 +1,5 @@
1
- require 'celluloid/rspec'
1
+ require "celluloid/rspec"
2
2
 
3
- RSpec.describe Celluloid::ZMQ::Mailbox do
3
+ RSpec.describe Celluloid::ZMQ::Mailbox, library: :ZMQ do
4
4
  it_behaves_like "a Celluloid Mailbox"
5
5
  end
@@ -1,7 +1,6 @@
1
- require 'celluloid/rspec'
2
-
3
- RSpec.describe Celluloid::ZMQ::Socket, actor_system: :global do
1
+ require "celluloid/rspec"
4
2
 
3
+ RSpec.describe Celluloid::ZMQ::Socket, library: :ZMQ do
5
4
  it "allows setting and getting ZMQ options on the socket" do
6
5
  socket = Celluloid::ZMQ::Socket::Rep.new
7
6
  socket.set(::ZMQ::IDENTITY, "Identity")
@@ -11,5 +10,4 @@ RSpec.describe Celluloid::ZMQ::Socket, actor_system: :global do
11
10
  expect(identity).to eq("Identity")
12
11
  socket.close
13
12
  end
14
-
15
13
  end
@@ -1,14 +1,14 @@
1
- RSpec.describe Celluloid::ZMQ do
1
+ RSpec.describe Celluloid::ZMQ, library: :ZMQ do
2
2
  before { @sockets = [] }
3
3
  after { @sockets.each(&:close) }
4
4
 
5
- def connect(socket, index=0)
5
+ def connect(socket, index = 0)
6
6
  socket.connect("inproc://celluloid-spec-#{index}")
7
7
  @sockets << socket
8
8
  socket
9
9
  end
10
10
 
11
- def bind(socket, index=0)
11
+ def bind(socket, index = 0)
12
12
  socket.bind("inproc://celluloid-spec-#{index}")
13
13
  @sockets << socket
14
14
  socket
@@ -1,45 +1,12 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ require "rubygems"
2
+ require "bundler/setup"
3
3
 
4
- require 'rubygems'
5
- require 'bundler/setup'
6
- require 'celluloid/zmq'
7
- require 'celluloid/rspec'
8
-
9
- module CelluloidSpecs
10
- # Require a file from Celluloid gem 'spec' location directly
11
- def self.require(path)
12
- celluloid = Pathname(Gem::Specification.find_all_by_name('celluloid').first.full_gem_path)
13
- full_path = celluloid + 'spec' + path
14
- Kernel.require(full_path.to_s)
15
- end
16
-
17
- def self.included_module
18
- Celluloid::ZMQ
19
- end
20
-
21
- # Timer accuracy enforced by the tests (50ms)
22
- TIMER_QUANTUM = 0.05
4
+ module Specs
5
+ INCLUDED_MODULE = Celluloid::ZMQ
6
+ ALLOW_SLOW_MAILBOXES = true # TODO: Remove hax.
23
7
  end
24
8
 
25
- logfile = File.open(File.expand_path("../../log/test.log", __FILE__), 'a')
26
- Celluloid.logger = Logger.new(logfile)
27
-
28
- Celluloid.shutdown_timeout = 1
9
+ require "celluloid/rspec"
10
+ require "celluloid/zmq"
29
11
 
30
- RSpec.configure(&:disable_monkey_patching!)
31
-
32
- RSpec.configure do |config|
33
- config.around do |ex|
34
- Celluloid::ZMQ.init(1) unless ex.metadata[:no_init]
35
- Celluloid.boot
36
- ex.run
37
- Celluloid.shutdown
38
- Celluloid::ZMQ.terminate
39
- end
40
-
41
- config.before(:each) do |example|
42
- @fake_logger = Specs::FakeLogger.new(Celluloid.logger, example.description)
43
- stub_const('Celluloid::Internals::Logger', @fake_logger)
44
- end
45
- end
12
+ Dir[*Specs::INCLUDE_PATHS].map { |f| require f }
@@ -0,0 +1,7 @@
1
+ require "rspec/core/rake_task"
2
+
3
+ RSpec::Core::RakeTask.new
4
+
5
+ RSpec::Core::RakeTask.new(:rcov) do |task|
6
+ task.rcov = true
7
+ end
@@ -0,0 +1,4 @@
1
+ unless ENV["CI"]
2
+ require "rubocop/rake_task"
3
+ RuboCop::RakeTask.new
4
+ end
metadata CHANGED
@@ -1,305 +1,305 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid-zmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :runtime
20
+ type: :development
21
21
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
22
+ requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nenv
29
- requirement: !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :runtime
34
+ type: :development
35
35
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
36
+ requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dotenv
43
- requirement: !ruby/object:Gem::Requirement
43
+ version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :runtime
48
+ type: :development
49
49
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
50
+ requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: benchmark_suite
57
- requirement: !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
71
+ version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
78
+ requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: transpec
85
- requirement: !ruby/object:Gem::Requirement
85
+ version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
92
+ requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
- requirement: !ruby/object:Gem::Requirement
99
+ version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
106
+ requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
- requirement: !ruby/object:Gem::Requirement
113
+ version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
120
+ requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
- requirement: !ruby/object:Gem::Requirement
127
+ version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
134
+ requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: guard-rspec
141
- requirement: !ruby/object:Gem::Requirement
141
+ version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec-retry
148
155
  version_requirements: !ruby/object:Gem::Requirement
149
156
  requirements:
150
157
  - - ">="
151
158
  - !ruby/object:Gem::Version
152
159
  version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ requirement: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: coveralls
155
- requirement: !ruby/object:Gem::Requirement
169
+ version_requirements: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - ">="
158
172
  - !ruby/object:Gem::Version
159
173
  version: '0'
160
174
  type: :development
161
175
  prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: celluloid
169
- requirement: !ruby/object:Gem::Requirement
183
+ version_requirements: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - "~>"
185
+ - - ">="
172
186
  - !ruby/object:Gem::Version
173
- version: '0.17'
187
+ version: 0.17.2
174
188
  type: :runtime
175
189
  prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
190
+ requirement: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - "~>"
192
+ - - ">="
179
193
  - !ruby/object:Gem::Version
180
- version: '0.17'
194
+ version: 0.17.2
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: celluloid-essentials
183
- requirement: !ruby/object:Gem::Requirement
197
+ version_requirements: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - ">="
186
200
  - !ruby/object:Gem::Version
187
201
  version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
204
+ requirement: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: celluloid-supervision
197
- requirement: !ruby/object:Gem::Requirement
211
+ version_requirements: !ruby/object:Gem::Requirement
198
212
  requirements:
199
213
  - - ">="
200
214
  - !ruby/object:Gem::Version
201
215
  version: '0'
202
216
  type: :development
203
217
  prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
218
+ requirement: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - ">="
207
221
  - !ruby/object:Gem::Version
208
222
  version: '0'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: celluloid-pool
211
- requirement: !ruby/object:Gem::Requirement
225
+ version_requirements: !ruby/object:Gem::Requirement
212
226
  requirements:
213
227
  - - ">="
214
228
  - !ruby/object:Gem::Version
215
229
  version: '0'
216
230
  type: :development
217
231
  prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
232
+ requirement: !ruby/object:Gem::Requirement
219
233
  requirements:
220
234
  - - ">="
221
235
  - !ruby/object:Gem::Version
222
236
  version: '0'
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: celluloid-fsm
225
- requirement: !ruby/object:Gem::Requirement
239
+ version_requirements: !ruby/object:Gem::Requirement
226
240
  requirements:
227
241
  - - ">="
228
242
  - !ruby/object:Gem::Version
229
243
  version: '0'
230
244
  type: :development
231
245
  prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
246
+ requirement: !ruby/object:Gem::Requirement
233
247
  requirements:
234
248
  - - ">="
235
249
  - !ruby/object:Gem::Version
236
250
  version: '0'
237
251
  - !ruby/object:Gem::Dependency
238
252
  name: celluloid-extras
239
- requirement: !ruby/object:Gem::Requirement
253
+ version_requirements: !ruby/object:Gem::Requirement
240
254
  requirements:
241
255
  - - ">="
242
256
  - !ruby/object:Gem::Version
243
257
  version: '0'
244
258
  type: :development
245
259
  prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
260
+ requirement: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - ">="
249
263
  - !ruby/object:Gem::Version
250
264
  version: '0'
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: timers
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - "~>"
256
- - !ruby/object:Gem::Version
257
- version: 4.0.0
258
- type: :runtime
259
- prerelease: false
260
267
  version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - "~>"
263
- - !ruby/object:Gem::Version
264
- version: 4.0.0
265
- - !ruby/object:Gem::Dependency
266
- name: rspec-logsplit
267
- requirement: !ruby/object:Gem::Requirement
268
268
  requirements:
269
269
  - - ">="
270
270
  - !ruby/object:Gem::Version
271
- version: 0.1.2
271
+ version: 4.1.1
272
272
  type: :runtime
273
273
  prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
274
+ requirement: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - ">="
277
277
  - !ruby/object:Gem::Version
278
- version: 0.1.2
278
+ version: 4.1.1
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: ffi
281
- requirement: !ruby/object:Gem::Requirement
281
+ version_requirements: !ruby/object:Gem::Requirement
282
282
  requirements:
283
283
  - - ">="
284
284
  - !ruby/object:Gem::Version
285
285
  version: '0'
286
286
  type: :runtime
287
287
  prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
288
+ requirement: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - ">="
291
291
  - !ruby/object:Gem::Version
292
292
  version: '0'
293
293
  - !ruby/object:Gem::Dependency
294
294
  name: ffi-rzmq
295
- requirement: !ruby/object:Gem::Requirement
295
+ version_requirements: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ">="
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  type: :runtime
301
301
  prerelease: false
302
- version_requirements: !ruby/object:Gem::Requirement
302
+ requirement: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - ">="
305
305
  - !ruby/object:Gem::Version
@@ -318,8 +318,9 @@ files:
318
318
  - README.md
319
319
  - Rakefile
320
320
  - celluloid-zmq.gemspec
321
- - culture/CODE_OF_CONDUCT.md
321
+ - culture/CONDUCT.md
322
322
  - culture/Gemfile
323
+ - culture/LICENSE.txt
323
324
  - culture/README.md
324
325
  - culture/Rakefile
325
326
  - culture/SYNC.md
@@ -330,6 +331,7 @@ files:
330
331
  - culture/rubocop/README.md
331
332
  - culture/rubocop/lint.yml
332
333
  - culture/rubocop/metrics.yml
334
+ - culture/rubocop/perf.yml
333
335
  - culture/rubocop/rubocop.yml
334
336
  - culture/rubocop/style.yml
335
337
  - culture/spec/gems_spec.rb
@@ -353,11 +355,14 @@ files:
353
355
  - log/test.log
354
356
  - logo.png
355
357
  - pkg/celluloid-zmq-0.16.1.gem
358
+ - pkg/celluloid-zmq-0.17.0.gem
356
359
  - spec/celluloid/zmq/actor_spec.rb
357
360
  - spec/celluloid/zmq/mailbox_spec.rb
358
361
  - spec/celluloid/zmq/socket_spec.rb
359
362
  - spec/celluloid/zmq_spec.rb
360
363
  - spec/spec_helper.rb
364
+ - tasks/rspec.rake
365
+ - tasks/rubocop.rake
361
366
  homepage: http://github.com/celluloid/celluloid-zmq
362
367
  licenses:
363
368
  - MIT
@@ -378,15 +383,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
383
  version: '0'
379
384
  requirements: []
380
385
  rubyforge_project:
381
- rubygems_version: 2.4.7
386
+ rubygems_version: 2.4.8
382
387
  signing_key:
383
388
  specification_version: 4
384
389
  summary: Celluloid::ZMQ provides concurrent Celluloid actors that can listen for 0MQ
385
390
  events
386
391
  test_files:
392
+ - spec/spec_helper.rb
393
+ - spec/celluloid/zmq_spec.rb
387
394
  - spec/celluloid/zmq/actor_spec.rb
388
- - spec/celluloid/zmq/mailbox_spec.rb
389
395
  - spec/celluloid/zmq/socket_spec.rb
390
- - spec/celluloid/zmq_spec.rb
391
- - spec/spec_helper.rb
396
+ - spec/celluloid/zmq/mailbox_spec.rb
392
397
  - ".gitignore"