nio4r 2.4.0 → 2.5.4

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.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path("../lib/nio/version", __FILE__)
3
+ require File.expand_path("lib/nio/version", __dir__)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.authors = ["Tony Arcieri"]
@@ -20,7 +20,15 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
  spec.version = NIO::VERSION
22
22
 
23
- spec.required_ruby_version = ">= 2.3"
23
+ spec.metadata = {
24
+ "bug_tracker_uri" => "https://github.com/socketry/nio4r/issues",
25
+ "changelog_uri" => "https://github.com/socketry/nio4r/blob/master/CHANGES.md",
26
+ "documentation_uri" => "https://www.rubydoc.info/gems/nio4r/#{spec.version}",
27
+ "source_code_uri" => "https://github.com/socketry/nio4r/tree/v#{spec.version}",
28
+ "wiki_uri" => "https://github.com/socketry/nio4r/wiki"
29
+ }
30
+
31
+ spec.required_ruby_version = ">= 2.4"
24
32
 
25
33
  if defined? JRUBY_VERSION
26
34
  spec.files << "lib/nio4r_ext.jar"
@@ -352,4 +352,3 @@ RSpec.describe NIO::ByteBuffer do
352
352
  end
353
353
  end
354
354
  end
355
- # rubocop:enable Metrics/BlockLength
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "spec_helper"
4
- require "openssl"
5
4
 
6
5
  RSpec.describe OpenSSL::SSL::SSLSocket do
6
+
7
+ require "openssl"
8
+
7
9
  before(:all) do
8
10
  @tls = []
9
11
  end
@@ -33,8 +33,8 @@ RSpec.describe UDPSocket, if: !defined?(JRUBY_VERSION) do
33
33
  peer.send("X" * 1024, 0)
34
34
  cntr += 1
35
35
  t = select [], [peer], [], 0
36
- rescue Errno::ECONNREFUSED => ex
37
- skip "Couldn't make writable UDPSocket subject: #{ex.class}: #{ex}"
36
+ rescue Errno::ECONNREFUSED => e
37
+ skip "Couldn't make writable UDPSocket subject: #{e.class}: #{e}"
38
38
  end while t && t[1].include?(peer) && cntr < 5
39
39
 
40
40
  peer
@@ -16,10 +16,12 @@ RSpec.describe NIO::Selector do
16
16
  end
17
17
 
18
18
  context "#initialize" do
19
- it "allows explicitly specifying a backend" do
19
+ it "allows explicitly specifying a backend" do |example|
20
20
  backend = described_class.backends.first
21
21
  selector = described_class.new(backend)
22
22
  expect(selector.backend).to eq backend
23
+
24
+ example.reporter.message "Supported backends: #{described_class.backends}"
23
25
  end
24
26
 
25
27
  it "raises ArgumentError if given an invalid backend" do
@@ -32,8 +34,10 @@ RSpec.describe NIO::Selector do
32
34
  end
33
35
 
34
36
  context "backend" do
35
- it "knows its backend" do
37
+ it "knows its backend" do |example|
36
38
  expect(subject.backend).to be_a Symbol
39
+
40
+ example.reporter.message "Current backend: #{subject.backend}"
37
41
  end
38
42
  end
39
43
 
@@ -67,6 +71,15 @@ RSpec.describe NIO::Selector do
67
71
  expect(monitor).to be_closed
68
72
  end
69
73
 
74
+ it "allows deregistering closed IO objects" do
75
+ subject.register(reader, :r)
76
+ reader.close
77
+
78
+ expect do
79
+ subject.deregister(reader)
80
+ end.not_to raise_error
81
+ end
82
+
70
83
  it "reports if it is empty" do
71
84
  expect(subject).to be_empty
72
85
  subject.register(reader, :r)
@@ -91,14 +104,20 @@ RSpec.describe NIO::Selector do
91
104
 
92
105
  context "timeouts" do
93
106
  let(:select_precision) {0.2}
107
+ let(:timeout) {2.0}
94
108
  let(:payload) {"hi there"}
95
109
 
96
- it "waits for a timeout when selecting" do
110
+ it "waits for timeout when selecting from empty selector" do
111
+ started_at = Time.now
112
+ expect(subject.select(timeout)).to be_nil
113
+ expect(Time.now - started_at).to be_within(select_precision).of(timeout)
114
+ end
115
+
116
+ it "waits for a timeout when selecting with reader" do
97
117
  monitor = subject.register(reader, :r)
98
118
 
99
119
  writer << payload
100
120
 
101
- timeout = 0.5
102
121
  started_at = Time.now
103
122
  expect(subject.select(timeout)).to include monitor
104
123
  expect(Time.now - started_at).to be_within(select_precision).of(0)
@@ -215,4 +234,3 @@ RSpec.describe NIO::Selector do
215
234
  expect(subject).to be_closed
216
235
  end
217
236
  end
218
- # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nio4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-07 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -47,17 +47,14 @@ extensions:
47
47
  - ext/nio4r/extconf.rb
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - ".github/workflows/workflow.yml"
50
51
  - ".gitignore"
51
52
  - ".rspec"
52
53
  - ".rubocop.yml"
53
- - ".travis.yml"
54
54
  - CHANGES.md
55
55
  - Gemfile
56
- - Guardfile
57
- - LICENSE.txt
58
56
  - README.md
59
57
  - Rakefile
60
- - appveyor.yml
61
58
  - examples/echo_server.rb
62
59
  - ext/libev/Changes
63
60
  - ext/libev/LICENSE
@@ -66,12 +63,14 @@ files:
66
63
  - ext/libev/ev.h
67
64
  - ext/libev/ev_epoll.c
68
65
  - ext/libev/ev_kqueue.c
66
+ - ext/libev/ev_linuxaio.c
69
67
  - ext/libev/ev_poll.c
70
68
  - ext/libev/ev_port.c
71
69
  - ext/libev/ev_select.c
72
70
  - ext/libev/ev_vars.h
73
71
  - ext/libev/ev_win32.c
74
72
  - ext/libev/ev_wrap.h
73
+ - ext/nio4r/.clang-format
75
74
  - ext/nio4r/bytebuffer.c
76
75
  - ext/nio4r/extconf.rb
77
76
  - ext/nio4r/libev.h
@@ -106,8 +105,13 @@ files:
106
105
  homepage: https://github.com/socketry/nio4r
107
106
  licenses:
108
107
  - MIT
109
- metadata: {}
110
- post_install_message:
108
+ metadata:
109
+ bug_tracker_uri: https://github.com/socketry/nio4r/issues
110
+ changelog_uri: https://github.com/socketry/nio4r/blob/master/CHANGES.md
111
+ documentation_uri: https://www.rubydoc.info/gems/nio4r/2.5.4
112
+ source_code_uri: https://github.com/socketry/nio4r/tree/v2.5.4
113
+ wiki_uri: https://github.com/socketry/nio4r/wiki
114
+ post_install_message:
111
115
  rdoc_options: []
112
116
  require_paths:
113
117
  - lib
@@ -115,15 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
119
  requirements:
116
120
  - - ">="
117
121
  - !ruby/object:Gem::Version
118
- version: '2.3'
122
+ version: '2.4'
119
123
  required_rubygems_version: !ruby/object:Gem::Requirement
120
124
  requirements:
121
125
  - - ">="
122
126
  - !ruby/object:Gem::Version
123
127
  version: '0'
124
128
  requirements: []
125
- rubygems_version: 3.0.3
126
- signing_key:
129
+ rubygems_version: 3.1.2
130
+ signing_key:
127
131
  specification_version: 4
128
132
  summary: New IO for Ruby
129
133
  test_files:
@@ -1,29 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- dist: xenial
4
- bundler_args: --without development
5
-
6
- matrix:
7
- fast_finish: true
8
- include:
9
- - rvm: 2.3
10
- - rvm: 2.4
11
- - rvm: 2.5
12
- - rvm: 2.6
13
- env: NIO4R_PURE=true
14
- - rvm: 2.6
15
- - rvm: 2.6
16
- os: osx
17
- - rvm: truffleruby
18
- - rvm: truffleruby
19
- env: NIO4R_PURE=true
20
- - rvm: jruby
21
- env: JRUBY_OPTS="--debug -X+O --dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
22
- - rvm: jruby-head
23
- env: JRUBY_OPTS="--debug -X+O --dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
24
- - rvm: ruby-head
25
- allow_failures:
26
- - rvm: ruby-head
27
- - rvm: truffleruby
28
- - rvm: jruby-head
29
- - rvm: jruby
data/Guardfile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- directories %w[lib spec]
4
- clearing :on
5
-
6
- guard :rspec, cmd: "bundle exec rspec" do
7
- watch(%r{^spec/.+_spec\.rb$})
8
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
9
- watch("spec/spec_helper.rb") { "spec" }
10
- end
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011-2018 Tony Arcieri
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,40 +0,0 @@
1
- build: off
2
- deploy: off
3
-
4
- environment:
5
- PATH: C:\Ruby%RUBY_VERSION%\bin;%PATH%
6
- APPVEYOR_SAVE_CACHE_ON_ERROR: True
7
- matrix:
8
- - RUBY_VERSION: _trunk
9
- - RUBY_VERSION: 26-x64
10
- - RUBY_VERSION: 25-x64
11
- - RUBY_VERSION: 24-x64
12
- - RUBY_VERSION: 23-x64
13
- - RUBY_VERSION: 23
14
-
15
- init:
16
- - ps: |
17
- if ($env:RUBY_VERSION -eq '_trunk') {
18
- $trunk_uri = 'https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z'
19
- (New-Object Net.WebClient).DownloadFile($trunk_uri, 'C:\ruby_trunk.7z')
20
- 7z.exe x C:\ruby_trunk.7z -oC:\Ruby_trunk
21
- }
22
-
23
- install:
24
- - SET RAKEOPT=-rdevkit
25
- - gem update --system --conservative --no-document
26
- - ruby -v
27
- - gem -v
28
- - bundle -v
29
- - bundle install --path vendor\bundle --without development
30
-
31
- test_script:
32
- - bundle exec rake spec
33
-
34
- matrix:
35
- allow_failures:
36
- - RUBY_VERSION: _trunk
37
-
38
- cache:
39
- # If one of the files after the right arrow changes, cache will be invalidated
40
- - vendor\bundle -> appveyor.yml, Gemfile, nio4r.gemspec