ffi-rzmq 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.rbc
2
+ *.swp
3
+ pkg
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.7.1 / 20110130
2
+ * Fixed 1.9.1 Binary Encoding bug when UTF8 set as default (Thanks schmurfy)
3
+ * Improved rubinius compat for specs
4
+ * Improved spec compatibility on linux
1
5
  == 0.7.0 / 20101222
2
6
  * Improved performance of calls to Socket#getsockopt. There are usually
3
7
  a lot of calls passing RCVMORE, so we now cache those buffers instead
data/Rakefile CHANGED
@@ -4,9 +4,6 @@ rescue LoadError
4
4
  abort '### Please install the "bones" gem ###'
5
5
  end
6
6
 
7
- task :default => 'test:run'
8
- task 'gem:release' => 'test:run'
9
-
10
7
  namespace :win do
11
8
 
12
9
  desc 'Build and install gem under Windows. Mr Bones just has to break things using tar.'
@@ -16,8 +13,8 @@ namespace :win do
16
13
  rm_rf PKG_PATH
17
14
  system "gem build #{NAME}.gemspec"
18
15
  mkdir_p PKG_PATH
19
- mv "#{NAME}-0.6.0.gem", PKG_PATH
20
- system "gem install #{PKG_PATH}/#{NAME}-0.6.0.gem"
16
+ mv "#{NAME}-0.7.1.gem", PKG_PATH
17
+ system "gem install #{PKG_PATH}/#{NAME}-0.7.1.gem"
21
18
  end
22
19
  end
23
20
 
data/ffi-rzmq.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ffi-rzmq}
5
- s.version = "0.7.0"
5
+ s.version = "0.7.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chuck Remes"]
9
- s.date = %q{2010-12-22}
9
+ s.date = %q{2011-01-30}
10
10
  s.description = %q{This gem wraps the ZeroMQ networking library using the ruby FFI (foreign
11
11
  function interface). It's a pure ruby wrapper so this gem can be loaded
12
12
  and run by any ruby runtime that supports FFI. That's all of them:
@@ -41,7 +41,7 @@ module ZMQ
41
41
  @sockets = []
42
42
  @context = LibZMQ.zmq_init io_threads
43
43
  @pointer = @context
44
- error_check ZMQ_INIT_STR, @context.null? ? 1 : 0
44
+ error_check ZMQ_INIT_STR, (@context.nil? || @context.null?) ? 1 : 0
45
45
 
46
46
  define_finalizer
47
47
  end
@@ -114,7 +114,8 @@ module ZMQ
114
114
  # called multiple times on the same instance.
115
115
  #
116
116
  def copy_in_string string
117
- copy_in_bytes string, string.size if string
117
+ string_size = string.respond_to?(:bytesize) ? string.bytesize : string.size
118
+ copy_in_bytes string, string_size if string
118
119
  end
119
120
 
120
121
  # Makes a copy of +len+ bytes from the ruby string +bytes+. Library
data/spec/message_spec.rb CHANGED
@@ -21,6 +21,14 @@ module ZMQ
21
21
  lambda { message.copy_in_string("new text") }.should raise_error(MessageError)
22
22
  end
23
23
  end
24
+
25
+ context "when copying binary data" do
26
+ it "should find the correct length by ignoring encoding" do
27
+ message = Message.new
28
+ message.copy_in_string("\x83\x6e\x04\x00\x00\x44\xd1\x81")
29
+ message.size.should == 8
30
+ end
31
+ end
24
32
 
25
33
  end # describe Message
26
34
 
data/spec/socket_spec.rb CHANGED
@@ -12,7 +12,7 @@ module ZMQ
12
12
 
13
13
 
14
14
  it "should raise an error for a nil context" do
15
- lambda { Socket.new(FFI::Pointer::NULL, ZMQ::REQ) }.should raise_exception(ZMQ::ContextError)
15
+ lambda { Socket.new(FFI::Pointer.new(0), ZMQ::REQ) }.should raise_exception(ZMQ::ContextError)
16
16
  end
17
17
 
18
18
  [ZMQ::REQ, ZMQ::REP, ZMQ::XREQ, ZMQ::XREP, ZMQ::PUB, ZMQ::SUB, ZMQ::PUSH, ZMQ::PULL, ZMQ::PAIR].each do |socket_type|
@@ -369,9 +369,14 @@ module ZMQ
369
369
  attach_function :getsockopt, [:int, :int, :int, :pointer, :pointer], :int
370
370
  end # module LibC
371
371
 
372
- # these 2 hex constants were taken from OSX; may differ on other platforms
373
- so_rcvbuf = 0x1002
374
- sol_socket = 0xffff
372
+ if RUBY_PLATFORM =~ /linux/ || (RUBY_PLATFORM == 'java' && `uname` =~ /linux/i)
373
+ so_rcvbuf = 8
374
+ sol_socket = 1
375
+ else #OSX
376
+ so_rcvbuf = 0x1002
377
+ sol_socket = 0xffff
378
+ end
379
+
375
380
  socklen_size = FFI::MemoryPointer.new :uint32
376
381
  socklen_size.write_int 8
377
382
  rcvbuf = FFI::MemoryPointer.new :int64
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
metadata CHANGED
@@ -1,37 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-rzmq
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 7
8
- - 0
9
- version: 0.7.0
4
+ prerelease:
5
+ version: 0.7.1
10
6
  platform: ruby
11
7
  authors:
12
- - Chuck Remes
8
+ - Chuck Remes
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-12-22 00:00:00 -06:00
13
+ date: 2011-01-30 00:00:00 -08:00
18
14
  default_executable:
19
15
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: bones
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 5
31
- - 4
32
- version: 3.5.4
33
- type: :development
34
- version_requirements: *id001
16
+ - !ruby/object:Gem::Dependency
17
+ name: bones
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 3.6.2
25
+ type: :development
26
+ version_requirements: *id001
35
27
  description: |-
36
28
  This gem wraps the ZeroMQ networking library using the ruby FFI (foreign
37
29
  function interface). It's a pure ruby wrapper so this gem can be loaded
@@ -50,73 +42,69 @@ executables: []
50
42
  extensions: []
51
43
 
52
44
  extra_rdoc_files:
53
- - History.txt
54
- - README.rdoc
55
- - examples/README.rdoc
56
- - version.txt
45
+ - History.txt
46
+ - README.rdoc
47
+ - examples/README.rdoc
57
48
  files:
58
- - .bnsignore
59
- - History.txt
60
- - README.rdoc
61
- - Rakefile
62
- - examples/README.rdoc
63
- - examples/local_lat.rb
64
- - examples/local_lat_poll.rb
65
- - examples/local_lat_zerocopy.rb
66
- - examples/local_throughput.rb
67
- - examples/publish_subscribe.rb
68
- - examples/remote_lat.rb
69
- - examples/remote_lat_zerocopy.rb
70
- - examples/remote_throughput.rb
71
- - examples/reqrep_poll.rb
72
- - examples/request_response.rb
73
- - ffi-rzmq.gemspec
74
- - lib/ffi-rzmq.rb
75
- - lib/ffi-rzmq/context.rb
76
- - lib/ffi-rzmq/exceptions.rb
77
- - lib/ffi-rzmq/message.rb
78
- - lib/ffi-rzmq/poll.rb
79
- - lib/ffi-rzmq/poll_items.rb
80
- - lib/ffi-rzmq/socket.rb
81
- - lib/ffi-rzmq/wrapper.rb
82
- - lib/ffi-rzmq/zmq.rb
83
- - spec/context_spec.rb
84
- - spec/message_spec.rb
85
- - spec/pushpull_spec.rb
86
- - spec/reqrep_spec.rb
87
- - spec/socket_spec.rb
88
- - spec/spec_helper.rb
89
- - version.txt
49
+ - .bnsignore
50
+ - .gitignore
51
+ - History.txt
52
+ - README.rdoc
53
+ - Rakefile
54
+ - examples/README.rdoc
55
+ - examples/local_lat.rb
56
+ - examples/local_lat_poll.rb
57
+ - examples/local_lat_zerocopy.rb
58
+ - examples/local_throughput.rb
59
+ - examples/publish_subscribe.rb
60
+ - examples/remote_lat.rb
61
+ - examples/remote_lat_zerocopy.rb
62
+ - examples/remote_throughput.rb
63
+ - examples/reqrep_poll.rb
64
+ - examples/request_response.rb
65
+ - ffi-rzmq.gemspec
66
+ - lib/ffi-rzmq.rb
67
+ - lib/ffi-rzmq/context.rb
68
+ - lib/ffi-rzmq/exceptions.rb
69
+ - lib/ffi-rzmq/message.rb
70
+ - lib/ffi-rzmq/poll.rb
71
+ - lib/ffi-rzmq/poll_items.rb
72
+ - lib/ffi-rzmq/socket.rb
73
+ - lib/ffi-rzmq/wrapper.rb
74
+ - lib/ffi-rzmq/zmq.rb
75
+ - spec/context_spec.rb
76
+ - spec/message_spec.rb
77
+ - spec/pushpull_spec.rb
78
+ - spec/reqrep_spec.rb
79
+ - spec/socket_spec.rb
80
+ - spec/spec_helper.rb
81
+ - version.txt
90
82
  has_rdoc: true
91
83
  homepage: http://github.com/chuckremes/ffi-rzmq
92
84
  licenses: []
93
85
 
94
86
  post_install_message:
95
87
  rdoc_options:
96
- - --main
97
- - README.rdoc
88
+ - --main
89
+ - README.rdoc
98
90
  require_paths:
99
- - lib
91
+ - lib
100
92
  required_ruby_version: !ruby/object:Gem::Requirement
101
93
  none: false
102
94
  requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- segments:
106
- - 0
107
- version: "0"
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
108
98
  required_rubygems_version: !ruby/object:Gem::Requirement
109
99
  none: false
110
100
  requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- segments:
114
- - 0
115
- version: "0"
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
116
104
  requirements: []
117
105
 
118
106
  rubyforge_project: ffi-rzmq
119
- rubygems_version: 1.3.7
107
+ rubygems_version: 1.4.2
120
108
  signing_key:
121
109
  specification_version: 3
122
110
  summary: This gem wraps the ZeroMQ networking library using the ruby FFI (foreign function interface).