ione 1.3.0.pre3 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78ca22da674434afcf1293e1b7d70bb3f13a0080b7c492f5016fb6f4f2428702
4
- data.tar.gz: a50ef526b8a0163a3c2dd116a75d83b48cb6bbb79f80a4cdb0ba9e66c5c2e4b3
3
+ metadata.gz: 1d3625a09d6afac88c95fc514bd5b590432c52118efc767d77a84e7f3d88aabc
4
+ data.tar.gz: b0149919eab594a1265e6c5c898c0157bc1c8d64ed9e1a5076b0c1dd9f939761
5
5
  SHA512:
6
- metadata.gz: 8eb9100fc86fb57bff7a048f2d97411764df9e00fd5ec5afa921470283161a282686b9fdeea6cccd750b3dce5ea7efce666c9f6b98ef65ec3df2a3076e39c73d
7
- data.tar.gz: be2df17439ad63370e7b980ab99e526080e995d65a25c3547fdfbeca34db25548ff6ba9c7b665cb1f7e4d6603d3a33398a16f9628fc5e9ad53f57f3fe9a8c455
6
+ metadata.gz: 29209278fd8baf6984c7f8a21afe137934f8f799dcf493f9aadb410583b7b903989c1f765b28a0139b40809432f37233baed56538be42d4bf0f8ed91ffecabab
7
+ data.tar.gz: aaf087988a1bdebcb358b849a3ba027f6a342de7c7a1320ef07f914f763c682c6a36d22a167d76a24f8143d5ea4a14180136b29f3d998868fe40084f4d8492f6
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # Ione
2
2
 
3
- [![Build Status](https://travis-ci.org/iconara/ione.png?branch=master)](https://travis-ci.org/iconara/ione)
4
- [![Coverage Status](https://coveralls.io/repos/iconara/ione/badge.png)](https://coveralls.io/r/iconara/ione)
5
- [![Blog](http://b.repl.ca/v1/blog-ione-ff69b4.png)](http://architecturalatrocities.com/tagged/ione)
6
-
7
3
  _If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can find the readme for a specific version either through [rubydoc.info](http://rubydoc.info/find/gems?q=ione) or via the release tags ([here is an example](https://github.com/iconara/ione/tree/v1.2.0))._
8
4
 
9
5
  Ione is a framework for reactive programming in Ruby. It is based on the reactive core of [cql-rb](http://github.com/iconara/cql-rb), the Ruby driver for Cassandra.
@@ -36,6 +32,25 @@ The [examples](https://github.com/iconara/ione/tree/master/examples) directory h
36
32
 
37
33
  [See CONTRIBUTING.md](CONTRIBUTING.md)
38
34
 
35
+ ## Running Tests
36
+
37
+ ```bash
38
+ bundle install
39
+ rspec
40
+ ```
41
+
42
+ Note: You may need to add your hostname to your hosts file for the http_client_spec to pass.
43
+
44
+ In Linux/OSX you can run hostname to get it.
45
+ ```bash
46
+ hostname
47
+ ```
48
+
49
+ Then edit `/etc/hosts` and add
50
+ ```bash
51
+ 127.0.0.1 YourHostName
52
+ ```
53
+
39
54
  # Copyright
40
55
 
41
56
  Copyright 2013–2014 Theo Hultberg/Iconara and contributors.
@@ -18,7 +18,7 @@ module Ione
18
18
  # @since v1.0.0
19
19
  class ByteBuffer
20
20
  def initialize(initial_bytes=nil)
21
- @read_buffer = ''
21
+ @read_buffer = +''
22
22
  @offset = 0
23
23
  @length = 0
24
24
  if initial_bytes && !initial_bytes.empty?
@@ -26,7 +26,7 @@ module Ione
26
26
  @write_buffer.force_encoding(::Encoding::BINARY)
27
27
  @length = @write_buffer.bytesize
28
28
  else
29
- @write_buffer = ''
29
+ @write_buffer = +''
30
30
  end
31
31
  end
32
32
 
@@ -323,12 +323,12 @@ module Ione
323
323
  def swap_buffers
324
324
  @offset -= @read_buffer.bytesize
325
325
  @read_buffer = @write_buffer
326
- @write_buffer = ''
326
+ @write_buffer = +''
327
327
  end
328
328
 
329
329
  def merge_read_buffer
330
330
  @read_buffer = @read_buffer[@offset, @read_buffer.length - @offset] << @write_buffer
331
- @write_buffer = ''
331
+ @write_buffer = +''
332
332
  @offset = 0
333
333
  end
334
334
  end
@@ -42,7 +42,7 @@ module Ione
42
42
  # # register a listener method for new data, this must be done in the
43
43
  # # in the constructor, and only one listener can be registered
44
44
  # @connection.on_data(&method(:process_data))
45
- # @buffer = ''
45
+ # @buffer = +''
46
46
  # end
47
47
  #
48
48
  # def process_data(new_data)
data/lib/ione/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Ione
4
- VERSION = '1.3.0.pre3'.freeze
4
+ VERSION = '1.3.0'.freeze
5
5
  end
@@ -74,7 +74,7 @@ module Ione
74
74
  it 'handles appending with multibyte strings' do
75
75
  buffer.append('hello')
76
76
  buffer.append('würld')
77
- buffer.to_s.should eq('hellowürld'.force_encoding(::Encoding::BINARY))
77
+ buffer.to_s.should eq(String.new('hellowürld', encoding: ::Encoding::BINARY))
78
78
  end
79
79
 
80
80
  it 'handles appending with another byte buffer' do
@@ -198,8 +198,8 @@ module Ione
198
198
  future.on_complete { c1 = true }
199
199
  future.on_complete { c2 = true }
200
200
  promise.fulfill('bar')
201
- c1.should be_true
202
- c2.should be_true
201
+ c1.should be_truthy
202
+ c2.should be_truthy
203
203
  end
204
204
 
205
205
  it 'passes the future as the first parameter to the block' do
@@ -292,8 +292,8 @@ module Ione
292
292
  p2.future.on_complete(&lambda { |v, e=nil| called2 = true })
293
293
  p1.fulfill('bar')
294
294
  p2.fail(StandardError.new('bork'))
295
- called1.should be_false
296
- called2.should be_false
295
+ called1.should be_falsey
296
+ called2.should be_falsey
297
297
  end
298
298
 
299
299
  it 'notifies all listeners when the promise fails' do
@@ -301,8 +301,8 @@ module Ione
301
301
  future.on_complete { c1 = true }
302
302
  future.on_complete { c2 = true }
303
303
  future.fail(error)
304
- c1.should be_true
305
- c2.should be_true
304
+ c1.should be_truthy
305
+ c2.should be_truthy
306
306
  end
307
307
 
308
308
  it 'passes the error as the second parameter to the block when it expects two arguments' do
@@ -560,7 +560,7 @@ module Ione
560
560
  f = p.future.map { |v| v * 2 }
561
561
  f.on_failure { failed = true }
562
562
  p.fail(StandardError.new('Blurgh'))
563
- failed.should be_true
563
+ failed.should be_truthy
564
564
  end
565
565
 
566
566
  it 'fails when the block raises an error' do
@@ -1126,7 +1126,7 @@ module Ione
1126
1126
  futures = promises.map(&:future)
1127
1127
  f = Future.all(futures)
1128
1128
  promises.each(&:fulfill)
1129
- f.value.should have(3).items
1129
+ f.value.length.should eq(3)
1130
1130
  end
1131
1131
 
1132
1132
  it 'accepts an enumerable of futures' do
@@ -1134,7 +1134,7 @@ module Ione
1134
1134
  futures = promises.map(&:future).to_enum
1135
1135
  f = Future.all(futures)
1136
1136
  promises.each(&:fulfill)
1137
- f.value.should have(3).items
1137
+ f.value.length.should eq(3)
1138
1138
  end
1139
1139
 
1140
1140
  it 'accepts an enumerable of one future' do
@@ -1142,7 +1142,7 @@ module Ione
1142
1142
  futures = promises.map(&:future).to_enum
1143
1143
  f = Future.all(futures)
1144
1144
  promises.each(&:fulfill)
1145
- f.value.should have(1).item
1145
+ f.value.length.should eq(1)
1146
1146
  end
1147
1147
 
1148
1148
  it 'accepts anything that implements #on_complete as futures' do
@@ -173,7 +173,7 @@ module Ione
173
173
  it 'creates a new connection handler and registers it with the reactor' do
174
174
  acceptor.bind
175
175
  acceptor.read
176
- accepted_handlers.should have(1).item
176
+ accepted_handlers.length.should eq(1)
177
177
  accepted_handlers.first.host.should eq('example.com')
178
178
  accepted_handlers.first.port.should eq(3333)
179
179
  end
@@ -208,7 +208,7 @@ module Ione
208
208
  acceptor.on_accept { |c| called = true }
209
209
  acceptor.bind
210
210
  acceptor.read
211
- called.should be_true
211
+ called.should be_truthy
212
212
  end
213
213
  end
214
214
 
@@ -8,7 +8,7 @@ shared_examples_for 'a connection' do |options|
8
8
  end
9
9
 
10
10
  it 'returns true' do
11
- handler.close.should be_true
11
+ handler.close.should be_truthy
12
12
  end
13
13
 
14
14
  it 'does nothing when called again' do
@@ -31,7 +31,7 @@ shared_examples_for 'a connection' do |options|
31
31
  called = false
32
32
  handler.on_closed { called = true }
33
33
  handler.close
34
- called.should be_true, 'expected the close listener to have been called'
34
+ called.should be_truthy, 'expected the close listener to have been called'
35
35
  end
36
36
 
37
37
  it 'does nothing when closed a second time' do
@@ -45,7 +45,7 @@ shared_examples_for 'a connection' do |options|
45
45
 
46
46
  it 'returns false if it did nothing' do
47
47
  handler.close
48
- handler.close.should be_false
48
+ handler.close.should be_falsey
49
49
  end
50
50
 
51
51
  it 'is not writable when closed' do
@@ -203,7 +203,7 @@ shared_examples_for 'a connection' do |options|
203
203
  handler.close
204
204
  handler.write { called = true }
205
205
  handler.flush
206
- called.should be_false
206
+ called.should be_falsey
207
207
  end
208
208
 
209
209
  it 'does not unblock the reactor' do
@@ -227,7 +227,7 @@ shared_examples_for 'a connection' do |options|
227
227
  handler.drain
228
228
  handler.write { called = true }
229
229
  handler.flush
230
- called.should be_false
230
+ called.should be_falsey
231
231
  end
232
232
 
233
233
  it 'does not unblock the reactor' do
@@ -242,12 +242,12 @@ shared_examples_for 'a connection' do |options|
242
242
  if options.nil? || options.fetch(:skip_read, false) == false
243
243
  describe '#read/#on_data' do
244
244
  it 'reads a chunk from the socket' do
245
- socket.should_receive(:read_nonblock).with(instance_of(Fixnum)).and_return('foo bar')
245
+ socket.should_receive(:read_nonblock).with(instance_of(Integer)).and_return('foo bar')
246
246
  handler.read
247
247
  end
248
248
 
249
249
  it 'calls the data listener with the new data' do
250
- socket.should_receive(:read_nonblock).with(instance_of(Fixnum)).and_return('foo bar')
250
+ socket.should_receive(:read_nonblock).with(instance_of(Integer)).and_return('foo bar')
251
251
  data = nil
252
252
  handler.on_data { |d| data = d }
253
253
  handler.read
@@ -196,7 +196,7 @@ module Ione
196
196
  called = false
197
197
  handler.on_closed { called = true }
198
198
  handler.connect
199
- called.should be_true, 'expected the close listener to have been called'
199
+ called.should be_truthy, 'expected the close listener to have been called'
200
200
  end
201
201
 
202
202
  it 'passes the error to the close listener' do
@@ -226,7 +226,7 @@ module Ione
226
226
  called = false
227
227
  handler.on_closed { called = true }
228
228
  handler.connect
229
- called.should be_true, 'expected the close listener to have been called'
229
+ called.should be_truthy, 'expected the close listener to have been called'
230
230
  end
231
231
 
232
232
  it 'passes the error to the close listener' do
@@ -69,7 +69,7 @@ module Ione
69
69
  reactor.start.value
70
70
  await { called }
71
71
  reactor.stop.value
72
- called.should be_true, 'expected the selector to have been called'
72
+ called.should be_truthy, 'expected the selector to have been called'
73
73
  end
74
74
 
75
75
  context 'when stopping' do
@@ -118,8 +118,8 @@ module Ione
118
118
  restarted_future.value
119
119
  await { crashed && restarted }
120
120
  begin
121
- crashed.should be_true
122
- restarted.should be_true
121
+ crashed.should be_truthy
122
+ restarted.should be_truthy
123
123
  ensure
124
124
  reactor.stop
125
125
  barrier.push(nil) while reactor.running?
@@ -372,7 +372,7 @@ module Ione
372
372
  reactor.on_error { called = true }
373
373
  reactor.start
374
374
  await { called }
375
- called.should be_true, 'expected all close listeners to have been called'
375
+ called.should be_truthy, 'expected all close listeners to have been called'
376
376
  end
377
377
 
378
378
  it 'calls all listeners when the reactor crashes after being restarted' do
@@ -472,7 +472,7 @@ module Ione
472
472
  ssl_context = double(:ssl_context)
473
473
  reactor.start.value
474
474
  f = reactor.connect(host, port, ssl: ssl_context)
475
- expect { f.value }.to raise_error
475
+ expect { f.value }.to raise_error(Ione::Io::ConnectionClosedError)
476
476
  end
477
477
  end
478
478
 
@@ -79,7 +79,7 @@ module Ione
79
79
  it 'is registered it with the reactor' do
80
80
  acceptor.bind
81
81
  acceptor.read
82
- accepted_handlers.should have(1).item
82
+ accepted_handlers.length.should eq(1)
83
83
  accepted_handlers.first.host.should eq('example.com')
84
84
  accepted_handlers.first.port.should eq(3333)
85
85
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ Warning[:deprecated] = true # Enable ruby deprecation warnings
4
+
3
5
  ENV['SERVER_HOST'] ||= '127.0.0.1'.freeze
4
6
 
5
7
  require 'bundler/setup'
@@ -26,6 +28,12 @@ end
26
28
 
27
29
  RSpec.configure do |config|
28
30
  config.warnings = true
31
+ config.expect_with :rspec do |expectations|
32
+ expectations.syntax = [:should, :expect]
33
+ end
34
+ config.mock_with :rspec do |mocks|
35
+ mocks.syntax = [:should, :expect]
36
+ end
29
37
  end
30
38
 
31
39
  require 'ione'
@@ -10,7 +10,7 @@ class FakeServer
10
10
  @connects = 0
11
11
  @disconnects = 0
12
12
  @connections = []
13
- @received_bytes = ''
13
+ @received_bytes = +''
14
14
  @running = false
15
15
  end
16
16
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ione
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.pre3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Theo Hultberg
8
- autorequire:
7
+ - Theo Hultberg Tolv
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-07-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Reactive programming framework for Ruby, painless evented IO, futures
14
13
  and an efficient byte buffer
@@ -55,7 +54,6 @@ homepage: http://github.com/iconara/ione
55
54
  licenses:
56
55
  - Apache-2.0
57
56
  metadata: {}
58
- post_install_message:
59
57
  rdoc_options: []
60
58
  require_paths:
61
59
  - lib
@@ -63,32 +61,31 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
61
  requirements:
64
62
  - - ">="
65
63
  - !ruby/object:Gem::Version
66
- version: 1.9.3
64
+ version: 3.1.0
67
65
  required_rubygems_version: !ruby/object:Gem::Requirement
68
66
  requirements:
69
- - - ">"
67
+ - - ">="
70
68
  - !ruby/object:Gem::Version
71
- version: 1.3.1
69
+ version: '0'
72
70
  requirements: []
73
- rubygems_version: 3.0.3
74
- signing_key:
71
+ rubygems_version: 4.0.8
75
72
  specification_version: 4
76
73
  summary: Reactive programming framework for Ruby
77
74
  test_files:
78
- - spec/spec_helper.rb
79
- - spec/ione/io/ssl_acceptor_spec.rb
80
- - spec/ione/io/server_connection_spec.rb
81
- - spec/ione/io/ssl_server_connection_spec.rb
75
+ - spec/integration/io_spec.rb
76
+ - spec/integration/ssl_spec.rb
77
+ - spec/ione/byte_buffer_spec.rb
78
+ - spec/ione/future_spec.rb
79
+ - spec/ione/heap_spec.rb
82
80
  - spec/ione/io/acceptor_spec.rb
81
+ - spec/ione/io/connection_common.rb
83
82
  - spec/ione/io/connection_spec.rb
84
- - spec/ione/io/ssl_connection_spec.rb
85
83
  - spec/ione/io/io_reactor_spec.rb
86
- - spec/ione/io/connection_common.rb
87
- - spec/ione/heap_spec.rb
88
- - spec/ione/byte_buffer_spec.rb
89
- - spec/ione/future_spec.rb
90
- - spec/integration/ssl_spec.rb
91
- - spec/integration/io_spec.rb
92
- - spec/support/server_helper.rb
84
+ - spec/ione/io/server_connection_spec.rb
85
+ - spec/ione/io/ssl_acceptor_spec.rb
86
+ - spec/ione/io/ssl_connection_spec.rb
87
+ - spec/ione/io/ssl_server_connection_spec.rb
88
+ - spec/spec_helper.rb
93
89
  - spec/support/await_helper.rb
94
90
  - spec/support/fake_server.rb
91
+ - spec/support/server_helper.rb