From 1c34a615aa8108b467703f3136de503da90e5a90 Mon Sep 17 00:00:00 2001 From: Dmytro Milinevskyy Date: Sat, 18 Apr 2015 13:33:35 +0200 Subject: [PATCH 01/17] upgrade to rpec 3.0 --- Gemfile | 1 + celluloid-zmq.gemspec | 2 +- spec/celluloid/zmq_spec.rb | 2 +- spec/spec_helper.rb | 4 +--- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 15d7970..1e283b8 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source 'http://rubygems.org' gem 'coveralls', require: false gem 'celluloid', github: 'celluloid/celluloid', branch: 'master' +gem 'transpec', github: 'yujinakayama/transpec', tag: 'v3.1.0' # Specify your gem's dependencies in celluloid-zmq.gemspec gemspec diff --git a/celluloid-zmq.gemspec b/celluloid-zmq.gemspec index 8d51d01..846a85b 100644 --- a/celluloid-zmq.gemspec +++ b/celluloid-zmq.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |gem| gem.add_dependency "ffi-rzmq" gem.add_development_dependency "rake" - gem.add_development_dependency "rspec", "~> 2.14.0" + gem.add_development_dependency "rspec", "~> 3.0" # Files ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten diff --git a/spec/celluloid/zmq_spec.rb b/spec/celluloid/zmq_spec.rb index 1e14f45..13c6cde 100644 --- a/spec/celluloid/zmq_spec.rb +++ b/spec/celluloid/zmq_spec.rb @@ -146,7 +146,7 @@ def close_socket client.recv_string(message) expect(message).to eq("hello world") - expect(result.value).to be_true + expect(result.value).to be_truthy end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8940cf4..39d48ef 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,10 +10,8 @@ Celluloid.shutdown_timeout = 1 RSpec.configure do |config| - config.treat_symbols_as_metadata_keys_with_true_values = true - config.around do |ex| - Celluloid::ZMQ.init(1) unless example.metadata[:no_init] + Celluloid::ZMQ.init(1) unless ex.metadata[:no_init] Celluloid.boot ex.run Celluloid.shutdown From f8f5e68226fe4e55147c2b2eed7eccb5a62cf461 Mon Sep 17 00:00:00 2001 From: Dmytro Milinevskyy Date: Sat, 18 Apr 2015 13:45:29 +0200 Subject: [PATCH 02/17] spec: close socket as in some cases rspec is stuck on destroying the object --- spec/celluloid/zmq/socket_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/celluloid/zmq/socket_spec.rb b/spec/celluloid/zmq/socket_spec.rb index fb6dbcf..fb3c760 100644 --- a/spec/celluloid/zmq/socket_spec.rb +++ b/spec/celluloid/zmq/socket_spec.rb @@ -10,6 +10,7 @@ identity = socket.get(::ZMQ::IDENTITY) expect(identity).to eq("Identity") + socket.close end end From 119c35e554a4419c5c9025986d37e4e7fb07cd89 Mon Sep 17 00:00:00 2001 From: Dmytro Milinevskyy Date: Sat, 18 Apr 2015 13:45:51 +0200 Subject: [PATCH 03/17] fix rspec warning --- lib/celluloid/zmq.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/celluloid/zmq.rb b/lib/celluloid/zmq.rb index 6884340..5b49dfb 100644 --- a/lib/celluloid/zmq.rb +++ b/lib/celluloid/zmq.rb @@ -23,8 +23,7 @@ def included(klass) # Obtain a 0MQ context def init(worker_threads = 1) - return @context if @context - @context = ::ZMQ::Context.new(worker_threads) + @context ||= ::ZMQ::Context.new(worker_threads) end def context From 67082d2ed477936fca8ba62acbc72fa71a9caa55 Mon Sep 17 00:00:00 2001 From: //de Date: Sat, 18 Apr 2015 09:52:49 -0700 Subject: [PATCH 04/17] Removing jruby as an allowed failure Without the allowed failure for jruby, #47 is going to fail now. @niamster, any idea why? --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6fa327d..16210cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ rvm: matrix: allow_failures: - - rvm: jruby - rvm: rbx-2 - rvm: ruby-head - rvm: jruby-head From 4a3a4552cbc12fc2672aba1829d936216d64bd22 Mon Sep 17 00:00:00 2001 From: Dmytro Milinevskyy Date: Sat, 18 Apr 2015 21:55:36 +0200 Subject: [PATCH 05/17] celluloid mailbox was renaimed in celluloid v0.17 --- Gemfile | 2 +- celluloid-zmq.gemspec | 2 +- lib/celluloid/zmq/mailbox.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 1e283b8..d26d6a2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'http://rubygems.org' gem 'coveralls', require: false -gem 'celluloid', github: 'celluloid/celluloid', branch: 'master' +gem 'celluloid', github: 'celluloid/celluloid', branch: '0.17.0-prerelease' gem 'transpec', github: 'yujinakayama/transpec', tag: 'v3.1.0' # Specify your gem's dependencies in celluloid-zmq.gemspec diff --git a/celluloid-zmq.gemspec b/celluloid-zmq.gemspec index 846a85b..750aa1d 100644 --- a/celluloid-zmq.gemspec +++ b/celluloid-zmq.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |gem| gem.name = "celluloid-zmq" gem.version = Celluloid::ZMQ::VERSION - gem.add_dependency "celluloid", ">= 0.16.0" + gem.add_dependency "celluloid", ">= 0.17.0" gem.add_dependency "ffi" gem.add_dependency "ffi-rzmq" diff --git a/lib/celluloid/zmq/mailbox.rb b/lib/celluloid/zmq/mailbox.rb index fdccf45..6f75566 100644 --- a/lib/celluloid/zmq/mailbox.rb +++ b/lib/celluloid/zmq/mailbox.rb @@ -1,7 +1,7 @@ module Celluloid module ZMQ # Replacement mailbox for Celluloid::ZMQ actors - class Mailbox < Celluloid::EventedMailbox + class Mailbox < Celluloid::Mailbox::Evented def initialize super(Reactor) end From c481a5366b59328244b62aa65b201e17b33cd166 Mon Sep 17 00:00:00 2001 From: Dmytro Milinevskyy Date: Sun, 19 Apr 2015 21:39:50 +0200 Subject: [PATCH 06/17] update spec according to changes from celluloid/#537 --- Gemfile | 10 ++++++++-- celluloid-zmq.gemspec | 5 ++++- spec/celluloid/zmq/actor_spec.rb | 4 +--- spec/celluloid/zmq/mailbox_spec.rb | 4 +--- spec/spec_helper.rb | 28 ++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index d26d6a2..3133c5b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,14 @@ source 'http://rubygems.org' -gem 'coveralls', require: false -gem 'celluloid', github: 'celluloid/celluloid', branch: '0.17.0-prerelease' +gem 'celluloid', github: 'celluloid/celluloid', branch: '0.17.0-prerelease' + +# folowwing should be removed as soon as celluloid marks them as runtime dependencies +gem 'celluloid-pool', github: 'celluloid/celluloid-pool', branch: 'master' +gem 'celluloid-fsm', github: 'celluloid/celluloid-fsm', branch: 'master' +gem 'celluloid-supervision', github: 'celluloid/celluloid-supervision', branch: 'master' + gem 'transpec', github: 'yujinakayama/transpec', tag: 'v3.1.0' +gem 'coveralls', require: false # Specify your gem's dependencies in celluloid-zmq.gemspec gemspec diff --git a/celluloid-zmq.gemspec b/celluloid-zmq.gemspec index 750aa1d..e1d2240 100644 --- a/celluloid-zmq.gemspec +++ b/celluloid-zmq.gemspec @@ -11,7 +11,10 @@ Gem::Specification.new do |gem| gem.name = "celluloid-zmq" gem.version = Celluloid::ZMQ::VERSION - gem.add_dependency "celluloid", ">= 0.17.0" + gem.add_dependency "celluloid", "~> 0.17.0.pre3" + gem.add_dependency "celluloid-pool" + gem.add_dependency "celluloid-fsm" + gem.add_dependency "celluloid-supervision" gem.add_dependency "ffi" gem.add_dependency "ffi-rzmq" diff --git a/spec/celluloid/zmq/actor_spec.rb b/spec/celluloid/zmq/actor_spec.rb index 79437e6..b80caaa 100644 --- a/spec/celluloid/zmq/actor_spec.rb +++ b/spec/celluloid/zmq/actor_spec.rb @@ -1,6 +1,4 @@ require 'spec_helper' require 'celluloid/rspec' -describe Celluloid::ZMQ do - it_behaves_like "a Celluloid Actor", Celluloid::ZMQ -end +CelluloidSpecs.require('celluloid/actor_spec') diff --git a/spec/celluloid/zmq/mailbox_spec.rb b/spec/celluloid/zmq/mailbox_spec.rb index 207d56f..7a6986d 100644 --- a/spec/celluloid/zmq/mailbox_spec.rb +++ b/spec/celluloid/zmq/mailbox_spec.rb @@ -1,6 +1,4 @@ require 'spec_helper' require 'celluloid/rspec' -describe Celluloid::ZMQ::Mailbox do - it_behaves_like "a Celluloid Mailbox" -end +CelluloidSpecs.require('shared/shared_examples_for_mailbox') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 39d48ef..54ae0e6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,31 @@ require 'coveralls' Coveralls.wear! +require 'rubygems' require 'bundler/setup' require 'celluloid/zmq' +require 'celluloid/rspec' + +module CelluloidSpecs + # Require a file from Celluloid gem 'spec' location directly + def self.require(path) + celluloid = Pathname(Gem::Specification.find_all_by_name('celluloid').first.full_gem_path) + full_path = celluloid + 'spec' + path + Kernel.require(full_path.to_s) + end + + def self.included_module + Celluloid::ZMQ + end + + # Timer accuracy enforced by the tests (50ms) + TIMER_QUANTUM = 0.05 +end + +CelluloidSpecs.require('support/actor_example_class') +CelluloidSpecs.require('support/crash_checking') +CelluloidSpecs.require('support/logging') +CelluloidSpecs.require('support/sleep_and_wait') logfile = File.open(File.expand_path("../../log/test.log", __FILE__), 'a') Celluloid.logger = Logger.new(logfile) @@ -17,4 +40,9 @@ Celluloid.shutdown Celluloid::ZMQ.terminate end + + config.before(:each) do |example| + @fake_logger = Specs::FakeLogger.new(Celluloid.logger, example.description) + stub_const('Celluloid::Internals::Logger', @fake_logger) + end end From c50854f102170406c4226f8dd5cb6cb43db0c4fd Mon Sep 17 00:00:00 2001 From: //de Date: Wed, 13 May 2015 21:54:58 -0700 Subject: [PATCH 07/17] updating per convention, to sync with 0.17.0 standards --- .env-ci | 4 + .env-dev | 4 + CHANGES.md | 18 ++-- Gemfile | 3 +- celluloid-zmq.gemspec | 2 +- examples/publish_subscribe.rb | 2 + lib/celluloid/zmq.rb | 6 ++ lib/celluloid/zmq/deprecate.rb | 9 ++ lib/celluloid/zmq/mailbox.rb | 2 +- lib/celluloid/zmq/socket/readable.rb | 45 ++++++++ lib/celluloid/zmq/socket/types.rb | 104 ++++++++++++++++++ lib/celluloid/zmq/socket/writable.rb | 19 ++++ lib/celluloid/zmq/sockets.rb | 153 --------------------------- 13 files changed, 207 insertions(+), 164 deletions(-) create mode 100644 .env-ci create mode 100644 .env-dev create mode 100644 lib/celluloid/zmq/deprecate.rb create mode 100644 lib/celluloid/zmq/socket/readable.rb create mode 100644 lib/celluloid/zmq/socket/types.rb create mode 100644 lib/celluloid/zmq/socket/writable.rb diff --git a/.env-ci b/.env-ci new file mode 100644 index 0000000..04573e7 --- /dev/null +++ b/.env-ci @@ -0,0 +1,4 @@ +CELLULOID_SPECS_LOG_STRATEGY=stderr +CELLULOID_SPECS_LOG_LEVEL=3 +CELLULOID_SPECS_LOG_FILE=log/ci.log +CELLULOID_SPECS_LOG_SYNC=false diff --git a/.env-dev b/.env-dev new file mode 100644 index 0000000..91e6111 --- /dev/null +++ b/.env-dev @@ -0,0 +1,4 @@ +CELLULOID_SPECS_LOG_STRATEGY=single +CELLULOID_SPECS_LOG_FILE=log/test.log +CELLULOID_SPECS_LOG_LEVEL=0 +CELLULOID_SPECS_LOG_SYNC=true diff --git a/CHANGES.md b/CHANGES.md index cd9a0ec..63c8fb0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,37 +1,41 @@ +0.16.5 +----- +* Adapted to be compliant with version 0.17.0-prerelease of Celluloid. + 0.16.1 (2015-04-26) -------------------- +----- * Support for XPUB sockets * Support for reading multipart messages * Spec cleanup 0.16.0 (2014-09-04) -------------------- +----- * Support for setting socket options * More specs 0.15.0 (2013-09-04) -------------------- +----- * Tracking release for Celluloid 0.15 0.14.0 (2013-05-07) -------------------- +----- * Add pubsub example * Add identity support to Sockets * Depend on EventedMailbox from core instead of celluloid-io * Remove overhead for IO waiting by calling directly to the reactor 0.13.0 ------- +----- * Feature: Support for DealerSocket and RouterSocket * Support for the #more_parts? method on sockets * Celluloid 0.13 compatibility fixes 0.12.0 ------- +----- * Tracking release for Celluloid 0.12.0 0.10.0 ------- +----- * Factor celluloid-zmq into its own gem * #linger= support diff --git a/Gemfile b/Gemfile index 1e283b8..57c1702 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,7 @@ source 'http://rubygems.org' gem 'coveralls', require: false -gem 'celluloid', github: 'celluloid/celluloid', branch: 'master' +gem 'celluloid', github: 'celluloid/celluloid', branch: '0.17.0-prerelease', submodules: true gem 'transpec', github: 'yujinakayama/transpec', tag: 'v3.1.0' -# Specify your gem's dependencies in celluloid-zmq.gemspec gemspec diff --git a/celluloid-zmq.gemspec b/celluloid-zmq.gemspec index 536da28..163ea46 100644 --- a/celluloid-zmq.gemspec +++ b/celluloid-zmq.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |gem| gem.name = "celluloid-zmq" gem.version = Celluloid::ZMQ::VERSION - gem.add_dependency "celluloid", "~> 0.16" + gem.add_dependency "celluloid", ">= 0.17.0.pre0" gem.add_dependency "ffi" gem.add_dependency "ffi-rzmq" diff --git a/examples/publish_subscribe.rb b/examples/publish_subscribe.rb index e91aa37..aff2846 100644 --- a/examples/publish_subscribe.rb +++ b/examples/publish_subscribe.rb @@ -1,5 +1,7 @@ require 'celluloid/zmq' +Celluloid::ZMQ.init + class PublishSubscribe include Celluloid::ZMQ diff --git a/lib/celluloid/zmq.rb b/lib/celluloid/zmq.rb index 5b49dfb..e6413c6 100644 --- a/lib/celluloid/zmq.rb +++ b/lib/celluloid/zmq.rb @@ -7,6 +7,10 @@ require 'celluloid/zmq/version' require 'celluloid/zmq/waker' +require 'celluloid/zmq/socket/readable' +require 'celluloid/zmq/socket/writable' +require 'celluloid/zmq/socket/types' + module Celluloid # Actors which run alongside 0MQ sockets module ZMQ @@ -67,3 +71,5 @@ def wait_writable(socket) end end + +require 'celluloid/zmq/deprecate' unless $CELLULOID_BACKPORTED == false diff --git a/lib/celluloid/zmq/deprecate.rb b/lib/celluloid/zmq/deprecate.rb new file mode 100644 index 0000000..8be9016 --- /dev/null +++ b/lib/celluloid/zmq/deprecate.rb @@ -0,0 +1,9 @@ +module Celluloid + module ZMQ + ReadableSocket = Socket::Readable + WritableSocket = Socket::Writable + + RepSocket = Socket::Rep + ReqSocket = Socket::Req + end +end diff --git a/lib/celluloid/zmq/mailbox.rb b/lib/celluloid/zmq/mailbox.rb index fdccf45..6f75566 100644 --- a/lib/celluloid/zmq/mailbox.rb +++ b/lib/celluloid/zmq/mailbox.rb @@ -1,7 +1,7 @@ module Celluloid module ZMQ # Replacement mailbox for Celluloid::ZMQ actors - class Mailbox < Celluloid::EventedMailbox + class Mailbox < Celluloid::Mailbox::Evented def initialize super(Reactor) end diff --git a/lib/celluloid/zmq/socket/readable.rb b/lib/celluloid/zmq/socket/readable.rb new file mode 100644 index 0000000..28c0291 --- /dev/null +++ b/lib/celluloid/zmq/socket/readable.rb @@ -0,0 +1,45 @@ +module Celluloid + module ZMQ + class Socket + # Readable 0MQ sockets have a read method + module Readable + extend Forwardable + + # always set LINGER on readable sockets + def bind(addr) + self.linger = @linger + super(addr) + end + + def connect(addr) + self.linger = @linger + super(addr) + end + + # Read a message from the socket + def read(buffer = '') + ZMQ.wait_readable(@socket) if ZMQ.evented? + + unless ::ZMQ::Util.resultcode_ok? @socket.recv_string buffer + raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" + end + buffer + end + + # Multiparts message ? + def_delegator :@socket, :more_parts? + + # Reads a multipart message, stores it into the given buffer and returns + # the buffer. + def read_multipart(buffer = []) + ZMQ.wait_readable(@socket) if ZMQ.evented? + + unless ::ZMQ::Util.resultcode_ok? @socket.recv_strings buffer + raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" + end + buffer + end + end + end + end +end diff --git a/lib/celluloid/zmq/socket/types.rb b/lib/celluloid/zmq/socket/types.rb new file mode 100644 index 0000000..ae83a07 --- /dev/null +++ b/lib/celluloid/zmq/socket/types.rb @@ -0,0 +1,104 @@ +module Celluloid + module ZMQ + class Socket + # ReqSockets are the counterpart of RepSockets (REQ/REP) + class Req < Socket + include Readable + include Writable + + def initialize + super :req + end + end + + # RepSockets are the counterpart of ReqSockets (REQ/REP) + class Rep < Socket + include Readable + include Writable + + def initialize + super :rep + end + end + + # DealerSockets are like ReqSockets but more flexible + class Dealer < Socket + include Readable + include Writable + + def initialize + super :dealer + end + end + + # RouterSockets are like RepSockets but more flexible + class Router < Socket + include Readable + include Writable + + def initialize + super :router + end + end + + # PushSockets are the counterpart of PullSockets (PUSH/PULL) + class Push < Socket + include Writable + + def initialize + super :push + end + end + + # PullSockets are the counterpart of PushSockets (PUSH/PULL) + class Pull < Socket + include Readable + + def initialize + super :pull + end + end + + # PubSockets are the counterpart of SubSockets (PUB/SUB) + class Pub < Socket + include Writable + + def initialize + super :pub + end + end + + # XPubSockets are just like PubSockets but reading from them gives you the + # subscription/unsubscription channels as they're joined/left. + class XPub < Socket + include Writable + include Readable + + def initialize + super :xpub + end + end + + # SubSockets are the counterpart of PubSockets (PUB/SUB) + class Sub < Socket + include Readable + + def initialize + super :sub + end + + def subscribe(topic) + unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::SUBSCRIBE, topic) + raise IOError, "couldn't set subscribe: #{::ZMQ::Util.error_string}" + end + end + + def unsubscribe(topic) + unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::UNSUBSCRIBE, topic) + raise IOError, "couldn't set unsubscribe: #{::ZMQ::Util.error_string}" + end + end + end + end + end +end diff --git a/lib/celluloid/zmq/socket/writable.rb b/lib/celluloid/zmq/socket/writable.rb new file mode 100644 index 0000000..2426eae --- /dev/null +++ b/lib/celluloid/zmq/socket/writable.rb @@ -0,0 +1,19 @@ +module Celluloid + module ZMQ + class Socket + # Writable 0MQ sockets have a send method + module Writable + # Send a message to the socket + def write(*messages) + unless ::ZMQ::Util.resultcode_ok? @socket.send_strings messages.flatten + raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}" + end + + messages + end + alias_method :<<, :write + alias_method :send, :write # deprecated + end + end + end +end diff --git a/lib/celluloid/zmq/sockets.rb b/lib/celluloid/zmq/sockets.rb index bde1123..f1b35fa 100644 --- a/lib/celluloid/zmq/sockets.rb +++ b/lib/celluloid/zmq/sockets.rb @@ -65,158 +65,5 @@ def close # Hide ffi-rzmq internals alias_method :inspect, :to_s end - - # Readable 0MQ sockets have a read method - module ReadableSocket - extend Forwardable - - # always set LINGER on readable sockets - def bind(addr) - self.linger = @linger - super(addr) - end - - def connect(addr) - self.linger = @linger - super(addr) - end - - # Read a message from the socket - def read(buffer = '') - ZMQ.wait_readable(@socket) if ZMQ.evented? - - unless ::ZMQ::Util.resultcode_ok? @socket.recv_string buffer - raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" - end - buffer - end - - # Multiparts message ? - def_delegator :@socket, :more_parts? - - # Reads a multipart message, stores it into the given buffer and returns - # the buffer. - def read_multipart(buffer = []) - ZMQ.wait_readable(@socket) if ZMQ.evented? - - unless ::ZMQ::Util.resultcode_ok? @socket.recv_strings buffer - raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" - end - buffer - end - end - - # Writable 0MQ sockets have a send method - module WritableSocket - # Send a message to the socket - def write(*messages) - unless ::ZMQ::Util.resultcode_ok? @socket.send_strings messages.flatten - raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}" - end - - messages - end - alias_method :<<, :write - alias_method :send, :write # deprecated - end - - # ReqSockets are the counterpart of RepSockets (REQ/REP) - class ReqSocket < Socket - include ReadableSocket - include WritableSocket - - def initialize - super :req - end - end - - # RepSockets are the counterpart of ReqSockets (REQ/REP) - class RepSocket < Socket - include ReadableSocket - include WritableSocket - - def initialize - super :rep - end - end - - # DealerSockets are like ReqSockets but more flexible - class DealerSocket < Socket - include ReadableSocket - include WritableSocket - - def initialize - super :dealer - end - end - - # RouterSockets are like RepSockets but more flexible - class RouterSocket < Socket - include ReadableSocket - include WritableSocket - - def initialize - super :router - end - end - - # PushSockets are the counterpart of PullSockets (PUSH/PULL) - class PushSocket < Socket - include WritableSocket - - def initialize - super :push - end - end - - # PullSockets are the counterpart of PushSockets (PUSH/PULL) - class PullSocket < Socket - include ReadableSocket - - def initialize - super :pull - end - end - - # PubSockets are the counterpart of SubSockets (PUB/SUB) - class PubSocket < Socket - include WritableSocket - - def initialize - super :pub - end - end - - # XPubSockets are just like PubSockets but reading from them gives you the - # subscription/unsubscription channels as they're joined/left. - class XPubSocket < Socket - include WritableSocket - include ReadableSocket - - def initialize - super :xpub - end - end - - # SubSockets are the counterpart of PubSockets (PUB/SUB) - class SubSocket < Socket - include ReadableSocket - - def initialize - super :sub - end - - def subscribe(topic) - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::SUBSCRIBE, topic) - raise IOError, "couldn't set subscribe: #{::ZMQ::Util.error_string}" - end - end - - def unsubscribe(topic) - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::UNSUBSCRIBE, topic) - raise IOError, "couldn't set unsubscribe: #{::ZMQ::Util.error_string}" - end - end - end end end From b7b07c3637bff12acc7b341914d61a78fb0e6d1b Mon Sep 17 00:00:00 2001 From: //de Date: Wed, 13 May 2015 21:59:17 -0700 Subject: [PATCH 08/17] add remaining types to deprecation --- lib/celluloid/zmq/deprecate.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/celluloid/zmq/deprecate.rb b/lib/celluloid/zmq/deprecate.rb index 8be9016..807d94b 100644 --- a/lib/celluloid/zmq/deprecate.rb +++ b/lib/celluloid/zmq/deprecate.rb @@ -2,8 +2,14 @@ module Celluloid module ZMQ ReadableSocket = Socket::Readable WritableSocket = Socket::Writable - RepSocket = Socket::Rep ReqSocket = Socket::Req + DealerSocket = Socket::Dealer + RouterSocket = Socket::Router + PushSocket = Socket::Push + PullSocket = Socket::Pull + PubSocket = Socket::Pub + XPubSocket = Socket::XPub + SubSocket = Socket::Sub end end From 53c45eb9a3201f1806841d9d7c1b3e37809303d4 Mon Sep 17 00:00:00 2001 From: //de Date: Wed, 13 May 2015 22:12:49 -0700 Subject: [PATCH 09/17] fixes to tests to suit updates --- spec/celluloid/zmq/socket_spec.rb | 2 +- spec/celluloid/zmq_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/celluloid/zmq/socket_spec.rb b/spec/celluloid/zmq/socket_spec.rb index 2fd8dbc..f33481c 100644 --- a/spec/celluloid/zmq/socket_spec.rb +++ b/spec/celluloid/zmq/socket_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Celluloid::ZMQ::Socket, actor_system: :global do it "allows setting and getting ZMQ options on the socket" do - socket = Celluloid::ZMQ::RepSocket.new + socket = Celluloid::ZMQ::Socket::Rep.new socket.set(::ZMQ::IDENTITY, "Identity") identity = socket.get(::ZMQ::IDENTITY) diff --git a/spec/celluloid/zmq_spec.rb b/spec/celluloid/zmq_spec.rb index 69e6c67..920eb1a 100644 --- a/spec/celluloid/zmq_spec.rb +++ b/spec/celluloid/zmq_spec.rb @@ -48,7 +48,7 @@ def bind(socket, index=0) end end - describe Celluloid::ZMQ::RepSocket do + describe Celluloid::ZMQ::Socket::Rep do let(:actor) do Class.new do include Celluloid::ZMQ @@ -56,7 +56,7 @@ def bind(socket, index=0) finalizer :close_socket def initialize(index) - @socket = Celluloid::ZMQ::RepSocket.new + @socket = Celluloid::ZMQ::Socket::Rep.new @socket.connect("inproc://celluloid-spec-#{index}") end @@ -94,7 +94,7 @@ def close_socket end end - describe Celluloid::ZMQ::ReqSocket do + describe Celluloid::ZMQ::Socket::Req do let(:actor) do Class.new do include Celluloid::ZMQ @@ -102,7 +102,7 @@ def close_socket finalizer :close_socket def initialize(index) - @socket = Celluloid::ZMQ::ReqSocket.new + @socket = Celluloid::ZMQ::Socket::Req.new @socket.connect("inproc://celluloid-spec-#{index}") end From 948007610c94fca91d9af24b688c708343d2b3ae Mon Sep 17 00:00:00 2001 From: //de Date: Wed, 3 Jun 2015 19:21:47 -0700 Subject: [PATCH 10/17] update Socket:: --- examples/publish_subscribe.rb | 12 ++++++------ lib/celluloid/zmq.rb | 9 ++++++--- lib/celluloid/zmq/current.rb | 2 ++ lib/celluloid/zmq/{sockets.rb => socket.rb} | 0 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 lib/celluloid/zmq/current.rb rename lib/celluloid/zmq/{sockets.rb => socket.rb} (100%) diff --git a/examples/publish_subscribe.rb b/examples/publish_subscribe.rb index aff2846..024871d 100644 --- a/examples/publish_subscribe.rb +++ b/examples/publish_subscribe.rb @@ -1,4 +1,4 @@ -require 'celluloid/zmq' +require 'celluloid/zmq/current' Celluloid::ZMQ.init @@ -8,11 +8,11 @@ class PublishSubscribe def run link = "tcp://127.0.0.1:5555" - s1 = PubSocket.new - s2 = SubSocket.new - s3 = SubSocket.new - s4 = SubSocket.new - s5 = SubSocket.new + s1 = Socket::Pub.new + s2 = Socket::Sub.new + s3 = Socket::Sub.new + s4 = Socket::Sub.new + s5 = Socket::Sub.new s1.linger = 100 s2.subscribe('') # receive all diff --git a/lib/celluloid/zmq.rb b/lib/celluloid/zmq.rb index e6413c6..3e43594 100644 --- a/lib/celluloid/zmq.rb +++ b/lib/celluloid/zmq.rb @@ -1,9 +1,12 @@ require 'ffi-rzmq' -require 'celluloid' +$CELLULOID_ZMQ_BACKPORTED = (ENV["CELLULOID_ZMQ_BACKPORTED"] != "false") unless defined?($CELLULOID_ZMQ_BACKPORTED) + +require ($CELLULOID_ZMQ_BACKPORTED) ? 'celluloid' : 'celluloid/current' + require 'celluloid/zmq/mailbox' require 'celluloid/zmq/reactor' -require 'celluloid/zmq/sockets' +require 'celluloid/zmq/socket' require 'celluloid/zmq/version' require 'celluloid/zmq/waker' @@ -72,4 +75,4 @@ def wait_writable(socket) end end -require 'celluloid/zmq/deprecate' unless $CELLULOID_BACKPORTED == false +require 'celluloid/zmq/deprecate' unless $CELLULOID_BACKPORTED == false || $CELLULOID_ZMQ_BACKPORTED == false diff --git a/lib/celluloid/zmq/current.rb b/lib/celluloid/zmq/current.rb new file mode 100644 index 0000000..0e0dd15 --- /dev/null +++ b/lib/celluloid/zmq/current.rb @@ -0,0 +1,2 @@ +$CELLULOID_ZMQ_BACKPORTED = false +require "celluloid/zmq" diff --git a/lib/celluloid/zmq/sockets.rb b/lib/celluloid/zmq/socket.rb similarity index 100% rename from lib/celluloid/zmq/sockets.rb rename to lib/celluloid/zmq/socket.rb From d3450c62cd7ce2d24a05d63a863704caf6228619 Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 7 Jul 2015 13:35:25 -0700 Subject: [PATCH 11/17] preparing 0.17.0.pre0 --- .gitmodules | 3 +++ CHANGES.md | 4 ++-- celluloid-zmq.gemspec | 7 ++----- culture | 1 + lib/celluloid/zmq/version.rb | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 .gitmodules create mode 160000 culture diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7f72185 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "culture"] + path = culture + url = http://github.com/celluloid/culture.git diff --git a/CHANGES.md b/CHANGES.md index 63c8fb0..1100616 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ -0.16.5 +0.70.0 ----- -* Adapted to be compliant with version 0.17.0-prerelease of Celluloid. +* Adapted to be compliant with version 0.17.0 of Celluloid. 0.16.1 (2015-04-26) ----- diff --git a/celluloid-zmq.gemspec b/celluloid-zmq.gemspec index 163ea46..7230968 100644 --- a/celluloid-zmq.gemspec +++ b/celluloid-zmq.gemspec @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -require File.expand_path('../lib/celluloid/zmq/version', __FILE__) +require File.expand_path("../culture/sync", __FILE__) Gem::Specification.new do |gem| gem.authors = ["Tony Arcieri"] @@ -12,13 +12,10 @@ Gem::Specification.new do |gem| gem.name = "celluloid-zmq" gem.version = Celluloid::ZMQ::VERSION - gem.add_dependency "celluloid", ">= 0.17.0.pre0" + Celluloid::Sync::Gemspec[gem] gem.add_dependency "ffi" gem.add_dependency "ffi-rzmq" - gem.add_development_dependency "rake" - gem.add_development_dependency "rspec", "~> 3.0" - # Files ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten gem.files = (Dir['**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) } diff --git a/culture b/culture new file mode 160000 index 0000000..e1414bf --- /dev/null +++ b/culture @@ -0,0 +1 @@ +Subproject commit e1414bf987ccb4793ac9908683434fc91180a508 diff --git a/lib/celluloid/zmq/version.rb b/lib/celluloid/zmq/version.rb index 61c0c4e..56821a2 100644 --- a/lib/celluloid/zmq/version.rb +++ b/lib/celluloid/zmq/version.rb @@ -1,5 +1,5 @@ module Celluloid module ZMQ - VERSION = "0.16.1" + VERSION = "0.17.0.pre0" end end From 689eb8c5ac4ccc4796360f6a70d2490d44ab6534 Mon Sep 17 00:00:00 2001 From: //de Date: Tue, 7 Jul 2015 13:47:42 -0700 Subject: [PATCH 12/17] update to use Culture::Sync --- Gemfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 57c1702..63ef5ef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,4 @@ -source 'http://rubygems.org' - -gem 'coveralls', require: false -gem 'celluloid', github: 'celluloid/celluloid', branch: '0.17.0-prerelease', submodules: true -gem 'transpec', github: 'yujinakayama/transpec', tag: 'v3.1.0' +require File.expand_path("../culture/sync", __FILE__) +Celluloid::Sync::Gemfile[self] gemspec From 0280da56f642305818366107547f4d213ef50ce6 Mon Sep 17 00:00:00 2001 From: //de Date: Sat, 1 Aug 2015 05:45:05 -0700 Subject: [PATCH 13/17] added more in-depth support for Router sockets --- culture | 2 +- lib/celluloid/zmq/socket.rb | 8 ++++++-- lib/celluloid/zmq/socket/writable.rb | 8 ++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/culture b/culture index e1414bf..7f0689b 160000 --- a/culture +++ b/culture @@ -1 +1 @@ -Subproject commit e1414bf987ccb4793ac9908683434fc91180a508 +Subproject commit 7f0689b2ddcc3e6ba563171d6b3d754d46996644 diff --git a/lib/celluloid/zmq/socket.rb b/lib/celluloid/zmq/socket.rb index f1b35fa..2c166a9 100644 --- a/lib/celluloid/zmq/socket.rb +++ b/lib/celluloid/zmq/socket.rb @@ -26,11 +26,15 @@ def linger=(value) end def identity=(value) - @socket.identity = value + unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::IDENTITY, "#{value}") + raise IOError, "couldn't set identity: #{::ZMQ::Util.error_string}" + end + #de @socket.identity = value end def identity - @socket.identity + #de @socket.identity + get(::ZMQ::IDENTITY) end def set(option, value, length = nil) diff --git a/lib/celluloid/zmq/socket/writable.rb b/lib/celluloid/zmq/socket/writable.rb index 2426eae..e817680 100644 --- a/lib/celluloid/zmq/socket/writable.rb +++ b/lib/celluloid/zmq/socket/writable.rb @@ -13,6 +13,14 @@ def write(*messages) end alias_method :<<, :write alias_method :send, :write # deprecated + + def write_to(address, message) + @socket.send_string "#{address}", ::ZMQ::SNDMORE + @socket.send_string "", ::ZMQ::SNDMORE + @socket.send_string message + message + end + end end end From d8564d46c4b3c1866e15a30492c7f43fb0b61c26 Mon Sep 17 00:00:00 2001 From: //de Date: Thu, 6 Aug 2015 16:32:52 -0700 Subject: [PATCH 14/17] prepare 0.17.0 --- CHANGES.md | 2 ++ lib/celluloid/zmq.rb | 7 ++++++- lib/celluloid/zmq/reactor.rb | 7 ++++--- lib/celluloid/zmq/socket.rb | 14 ++++++++------ lib/celluloid/zmq/socket/readable.rb | 5 +++-- lib/celluloid/zmq/socket/types.rb | 4 ++-- lib/celluloid/zmq/socket/writable.rb | 11 +++++++---- lib/celluloid/zmq/version.rb | 2 +- lib/celluloid/zmq/waker.rb | 6 ++++-- 9 files changed, 37 insertions(+), 21 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1100616..28be134 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ 0.70.0 ----- * Adapted to be compliant with version 0.17.0 of Celluloid. +* Added `write_to` for use with `Router` sockets. +* Added more direct set/get of socket identity. 0.16.1 (2015-04-26) ----- diff --git a/lib/celluloid/zmq.rb b/lib/celluloid/zmq.rb index 3e43594..0707eb8 100644 --- a/lib/celluloid/zmq.rb +++ b/lib/celluloid/zmq.rb @@ -17,7 +17,7 @@ module Celluloid # Actors which run alongside 0MQ sockets module ZMQ - UninitializedError = Class.new StandardError + class UninitializedError << Celluloid::Error; end class << self attr_writer :context @@ -72,6 +72,11 @@ def wait_writable(socket) end module_function :wait_writable + def result_ok?(result) + ::ZMQ::Util.resultcode_ok?(result) + end + module_function :result_ok? + end end diff --git a/lib/celluloid/zmq/reactor.rb b/lib/celluloid/zmq/reactor.rb index 132bfa4..8f5b6b3 100644 --- a/lib/celluloid/zmq/reactor.rb +++ b/lib/celluloid/zmq/reactor.rb @@ -3,10 +3,11 @@ module ZMQ # React to incoming 0MQ and Celluloid events. This is kinda sorta supposed # to resemble the Reactor design pattern. class Reactor - extend Forwardable + extend Forwardable def_delegator :@waker, :signal, :wakeup def_delegator :@waker, :cleanup, :shutdown + def_delegator ZMQ, :result_ok? def initialize @waker = Waker.new @@ -15,7 +16,7 @@ def initialize @writers = {} rc = @poller.register @waker.socket, ::ZMQ::POLLIN - unless ::ZMQ::Util.resultcode_ok? rc + unless result_ok? rc raise "0MQ poll error: #{::ZMQ::Util.error_string}" end end @@ -55,7 +56,7 @@ def run_once(timeout = nil) rc = @poller.poll(timeout) - unless ::ZMQ::Util.resultcode_ok? rc + unless result_ok? rc raise IOError, "0MQ poll error: #{::ZMQ::Util.error_string}" end diff --git a/lib/celluloid/zmq/socket.rb b/lib/celluloid/zmq/socket.rb index 2c166a9..e250e27 100644 --- a/lib/celluloid/zmq/socket.rb +++ b/lib/celluloid/zmq/socket.rb @@ -1,6 +1,8 @@ module Celluloid module ZMQ class Socket + extend Forwardable + def_delegator ZMQ, :result_ok? # Create a new socket def initialize(type) @socket = Celluloid::ZMQ.context.socket ::ZMQ.const_get(type.to_s.upcase) @@ -11,7 +13,7 @@ def initialize(type) # Connect to the given 0MQ address # Address should be in the form: tcp://1.2.3.4:5678/ def connect(addr) - unless ::ZMQ::Util.resultcode_ok? @socket.connect addr + unless result_ok? @socket.connect addr raise IOError, "error connecting to #{addr}: #{::ZMQ::Util.error_string}" end true @@ -20,13 +22,13 @@ def connect(addr) def linger=(value) @linger = value || -1 - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::LINGER, value) + unless result_ok? @socket.setsockopt(::ZMQ::LINGER, value) raise IOError, "couldn't set linger: #{::ZMQ::Util.error_string}" end end def identity=(value) - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::IDENTITY, "#{value}") + unless result_ok? @socket.setsockopt(::ZMQ::IDENTITY, "#{value}") raise IOError, "couldn't set identity: #{::ZMQ::Util.error_string}" end #de @socket.identity = value @@ -38,7 +40,7 @@ def identity end def set(option, value, length = nil) - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(option, value, length) + unless result_ok? @socket.setsockopt(option, value, length) raise IOError, "couldn't set value for option #{option}: #{::ZMQ::Util.error_string}" end end @@ -46,7 +48,7 @@ def set(option, value, length = nil) def get(option) option_value = [] - unless ::ZMQ::Util.resultcode_ok? @socket.getsockopt(option, option_value) + unless result_ok? @socket.getsockopt(option, option_value) raise IOError, "couldn't get value for option #{option}: #{::ZMQ::Util.error_string}" end @@ -56,7 +58,7 @@ def get(option) # Bind to the given 0MQ address # Address should be in the form: tcp://1.2.3.4:5678/ def bind(addr) - unless ::ZMQ::Util.resultcode_ok? @socket.bind(addr) + unless result_ok? @socket.bind(addr) raise IOError, "couldn't bind to #{addr}: #{::ZMQ::Util.error_string}" end end diff --git a/lib/celluloid/zmq/socket/readable.rb b/lib/celluloid/zmq/socket/readable.rb index 28c0291..b42e4eb 100644 --- a/lib/celluloid/zmq/socket/readable.rb +++ b/lib/celluloid/zmq/socket/readable.rb @@ -4,6 +4,7 @@ class Socket # Readable 0MQ sockets have a read method module Readable extend Forwardable + def_delegator ZMQ, :result_ok? # always set LINGER on readable sockets def bind(addr) @@ -20,7 +21,7 @@ def connect(addr) def read(buffer = '') ZMQ.wait_readable(@socket) if ZMQ.evented? - unless ::ZMQ::Util.resultcode_ok? @socket.recv_string buffer + unless result_ok? @socket.recv_string buffer raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" end buffer @@ -34,7 +35,7 @@ def read(buffer = '') def read_multipart(buffer = []) ZMQ.wait_readable(@socket) if ZMQ.evented? - unless ::ZMQ::Util.resultcode_ok? @socket.recv_strings buffer + unless result_ok? @socket.recv_strings buffer raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" end buffer diff --git a/lib/celluloid/zmq/socket/types.rb b/lib/celluloid/zmq/socket/types.rb index ae83a07..6a61b5e 100644 --- a/lib/celluloid/zmq/socket/types.rb +++ b/lib/celluloid/zmq/socket/types.rb @@ -88,13 +88,13 @@ def initialize end def subscribe(topic) - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::SUBSCRIBE, topic) + unless result_ok? @socket.setsockopt(::ZMQ::SUBSCRIBE, topic) raise IOError, "couldn't set subscribe: #{::ZMQ::Util.error_string}" end end def unsubscribe(topic) - unless ::ZMQ::Util.resultcode_ok? @socket.setsockopt(::ZMQ::UNSUBSCRIBE, topic) + unless result_ok? @socket.setsockopt(::ZMQ::UNSUBSCRIBE, topic) raise IOError, "couldn't set unsubscribe: #{::ZMQ::Util.error_string}" end end diff --git a/lib/celluloid/zmq/socket/writable.rb b/lib/celluloid/zmq/socket/writable.rb index e817680..2b98a6b 100644 --- a/lib/celluloid/zmq/socket/writable.rb +++ b/lib/celluloid/zmq/socket/writable.rb @@ -3,9 +3,11 @@ module ZMQ class Socket # Writable 0MQ sockets have a send method module Writable + extend Forwardable + def_delegator ZMQ, :result_ok? # Send a message to the socket def write(*messages) - unless ::ZMQ::Util.resultcode_ok? @socket.send_strings messages.flatten + unless result_ok? @socket.send_strings(messages.flatten) raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}" end @@ -15,9 +17,10 @@ def write(*messages) alias_method :send, :write # deprecated def write_to(address, message) - @socket.send_string "#{address}", ::ZMQ::SNDMORE - @socket.send_string "", ::ZMQ::SNDMORE - @socket.send_string message + error = [IOError, "Failure sending part of message."] + raise *error unless result_ok? @socket.send_string("#{address}", ::ZMQ::SNDMORE) + raise *error unless result_ok? @socket.send_string("", ::ZMQ::SNDMORE) + raise *error unless result_ok? @socket.send_string(message) message end diff --git a/lib/celluloid/zmq/version.rb b/lib/celluloid/zmq/version.rb index 56821a2..f118e47 100644 --- a/lib/celluloid/zmq/version.rb +++ b/lib/celluloid/zmq/version.rb @@ -1,5 +1,5 @@ module Celluloid module ZMQ - VERSION = "0.17.0.pre0" + VERSION = "0.17.0" end end diff --git a/lib/celluloid/zmq/waker.rb b/lib/celluloid/zmq/waker.rb index ed16b39..e1b8591 100644 --- a/lib/celluloid/zmq/waker.rb +++ b/lib/celluloid/zmq/waker.rb @@ -7,6 +7,8 @@ module ZMQ # Works like a ConditionVariable, except it's implemented as a ZMQ socket # so that it can be multiplexed alongside other ZMQ sockets class Waker + extend Forwardable + def_delegator ZMQ, :result_ok? PAYLOAD = "\0" # the payload doesn't matter, it's just a signal def initialize @@ -23,7 +25,7 @@ def initialize # Wakes up the thread that is waiting for this Waker def signal @sender_lock.synchronize do - unless ::ZMQ::Util.resultcode_ok? @sender.send_string PAYLOAD + unless result_ok? @sender.send_string PAYLOAD raise DeadWakerError, "error sending 0MQ message: #{::ZMQ::Util.error_string}" end end @@ -39,7 +41,7 @@ def wait message = '' rc = @receiver.recv_string message - unless ::ZMQ::Util.resultcode_ok? rc and message == PAYLOAD + unless result_ok? rc and message == PAYLOAD raise DeadWakerError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" end end From dce810bfcbc6c87769415535b13cf942a56ad8bb Mon Sep 17 00:00:00 2001 From: //de Date: Thu, 6 Aug 2015 16:45:15 -0700 Subject: [PATCH 15/17] not proper eigenclass syntax --- lib/celluloid/zmq.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/celluloid/zmq.rb b/lib/celluloid/zmq.rb index 0707eb8..2dceb2d 100644 --- a/lib/celluloid/zmq.rb +++ b/lib/celluloid/zmq.rb @@ -17,7 +17,7 @@ module Celluloid # Actors which run alongside 0MQ sockets module ZMQ - class UninitializedError << Celluloid::Error; end + class UninitializedError < Celluloid::Error; end class << self attr_writer :context From bd8b37156ae92bc30be900f188d743988e224226 Mon Sep 17 00:00:00 2001 From: //de Date: Thu, 6 Aug 2015 16:48:25 -0700 Subject: [PATCH 16/17] celluloid/rspec already requires everything needed... individual support files being pulled are no longer needed --- spec/spec_helper.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c9e36c7..242a62a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,11 +22,6 @@ def self.included_module TIMER_QUANTUM = 0.05 end -CelluloidSpecs.require('support/actor_example_class') -CelluloidSpecs.require('support/crash_checking') -CelluloidSpecs.require('support/logging') -CelluloidSpecs.require('support/sleep_and_wait') - logfile = File.open(File.expand_path("../../log/test.log", __FILE__), 'a') Celluloid.logger = Logger.new(logfile) From 9e1b5ede822a96f17b19605365998fd43211c24b Mon Sep 17 00:00:00 2001 From: //de Date: Thu, 6 Aug 2015 16:57:55 -0700 Subject: [PATCH 17/17] grab the more liberal celluloid/culture; rbx-2 mandatory --- .travis.yml | 1 - culture | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4459183..1e9abd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ rvm: matrix: fast_finish: true allow_failures: - - rvm: rbx-2 - rvm: ruby-head - rvm: jruby-head diff --git a/culture b/culture index 7f0689b..5f92523 160000 --- a/culture +++ b/culture @@ -1 +1 @@ -Subproject commit 7f0689b2ddcc3e6ba563171d6b3d754d46996644 +Subproject commit 5f925237663e18fd6931444dc6f8378264a238d6