nio4r 2.5.2 → 2.5.3

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
  SHA256:
3
- metadata.gz: f22175cceb7b718a2406d97b20a040f6d52890518791c128a5e27d93559ca7e2
4
- data.tar.gz: bf20935122a88cc94ff9989558b019c47c43b48c9e47847725f75469767a0518
3
+ metadata.gz: b2f91e950d2b359914f616398cde41cf003910ee62838e63de394215429083ac
4
+ data.tar.gz: e68a7d42ad6a361c1e72af4118d1220c23bda526b0517d1888869afd3ee8d1a1
5
5
  SHA512:
6
- metadata.gz: ffee3fa5a0fdea7460a7f6b754f4c72a0ccba4607e743508f43db88b2d515fc484bc73904652625721218381b873d29bdbb1a8e98dd1150814111cb0a08768d1
7
- data.tar.gz: 9126b4ac6087248ad726abeced9dc001c7cbc350f42b562981e3b9c660d55c76b2d73cce15f96cb14873321b2802310dcf348caaa805d4ab69c7b8df28f2e6a4
6
+ metadata.gz: d2ca4be61b7262f36189846fbbb50f18b96621de525fdad9b997320d58100b1eb7fe7997429025f183408282535dafea5cea05eb523b417a3aa1a883a20e7772
7
+ data.tar.gz: d603073fe98cdafecac3e380ac5bbf745d8e18066fdc095cb22baa0304768625f89ccdb6ab95bd8d9a8bad0a25fdd93ce9358b958848ac8a4a1b98cae01ed863
@@ -0,0 +1,43 @@
1
+ name: nio4r
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: >-
8
+ ${{matrix.os}}, ${{matrix.ruby}}
9
+ env:
10
+ CI: true
11
+ TESTOPTS: -v
12
+
13
+ runs-on: ${{matrix.os}}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest]
18
+ ruby: [2.4, 2.5, 2.6, 2.7, jruby, truffleruby-head]
19
+ exclude:
20
+ - { os: windows-latest, ruby: jruby }
21
+ - { os: windows-latest, ruby: truffleruby-head }
22
+
23
+ steps:
24
+ - name: repo checkout
25
+ uses: actions/checkout@v2
26
+
27
+ - name: load ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{matrix.ruby}}
31
+
32
+ - name: RubyGems, Bundler Update
33
+ run: gem update --system --no-document --conservative
34
+
35
+ - name: bundle install
36
+ run: bundle install --path .bundle/gems --without development
37
+
38
+ - name: compile
39
+ run: bundle exec rake compile
40
+
41
+ - name: test
42
+ run: bundle exec rake spec
43
+ timeout-minutes: 10
@@ -1,23 +1,40 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ TargetRubyVersion: 2.4
3
3
  DisplayCopNames: true
4
4
 
5
+ Layout/HashAlignment:
6
+ Enabled: false
7
+
8
+ Layout/LineLength:
9
+ Max: 128
10
+
11
+ Layout/SpaceAroundMethodCallOperator:
12
+ Enabled: false
13
+
5
14
  Layout/SpaceInsideBlockBraces:
6
15
  Enabled: false
7
16
 
8
17
  Style/IfUnlessModifier:
9
18
  Enabled: false
10
19
 
20
+ Style/UnpackFirst:
21
+ Enabled: false
22
+
11
23
  #
12
24
  # Lint
13
25
  #
14
26
 
15
- Lint/HandleExceptions:
27
+ Lint/SuppressedException:
16
28
  Enabled: false
17
29
 
18
30
  Lint/Loop:
19
31
  Enabled: false
20
32
 
33
+ Lint/RaiseException:
34
+ Enabled: false
35
+
36
+ Lint/StructNewOverride:
37
+ Enabled: false
21
38
  #
22
39
  # Metrics
23
40
  #
@@ -32,9 +49,6 @@ Metrics/BlockLength:
32
49
  Metrics/ClassLength:
33
50
  Max: 128
34
51
 
35
- Metrics/LineLength:
36
- Max: 128
37
-
38
52
  Metrics/MethodLength:
39
53
  CountComments: false
40
54
  Max: 50
@@ -46,16 +60,12 @@ Metrics/PerceivedComplexity:
46
60
  Max: 15
47
61
 
48
62
  #
49
- # Performance
63
+ # Style
50
64
  #
51
65
 
52
- Performance/RegexpMatch:
66
+ Style/ExponentialNotation:
53
67
  Enabled: false
54
68
 
55
- #
56
- # Style
57
- #
58
-
59
69
  Style/FormatStringToken:
60
70
  Enabled: false
61
71
 
@@ -65,6 +75,15 @@ Style/FrozenStringLiteralComment:
65
75
  Style/GlobalVars:
66
76
  Enabled: false
67
77
 
78
+ Style/HashEachMethods:
79
+ Enabled: false
80
+
81
+ Style/HashTransformKeys:
82
+ Enabled: false
83
+
84
+ Style/HashTransformValues:
85
+ Enabled: false
86
+
68
87
  Style/NumericPredicate:
69
88
  Enabled: false
70
89
 
data/CHANGES.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 2.5.3 (2020-09-07)
2
+
3
+ * [#241](https://github.com/socketry/nio4r/issues/241)
4
+ Possible bug with Ruby >= 2.7.0 and `GC.compact`.
5
+ ([@boazsegev])
6
+
7
+ ## 2.5.2 (2019-09-24)
8
+
9
+ * [#220](https://github.com/socketry/nio4r/issues/220)
10
+ Update to libev-4.27 & fix assorted warnings.
11
+ ([@ioquatix])
12
+
13
+ * [#225](https://github.com/socketry/nio4r/issues/225)
14
+ Avoid need for linux headers.
15
+ ([@ioquatix])
16
+
1
17
  ## 2.4.0 (2019-07-07)
2
18
 
3
19
  * [#211](https://github.com/socketry/nio4r/pull/211)
@@ -9,7 +25,7 @@
9
25
 
10
26
  * Assorted fixes for TruffleRuby & JRuby.
11
27
  ([@eregon], [@olleolleolle])
12
-
28
+ Possible bug with Ruby >= 2.7.0 and `GC.compact`
13
29
  * Update libev to v4.25.
14
30
  ([@ioquatix])
15
31
 
@@ -242,3 +258,4 @@
242
258
  [@ioquatix]: https://github.com/ioquatix
243
259
  [@eregon]: https://github.com/eregon
244
260
  [@olleolleolle]: https://github.com/olleolleolle
261
+ [@boazsegev]: https://github.com/boazsegev
data/Gemfile CHANGED
@@ -15,5 +15,5 @@ group :development, :test do
15
15
  gem "coveralls", require: false
16
16
  gem "rake-compiler", require: false
17
17
  gem "rspec", "~> 3.7", require: false
18
- gem "rubocop", "0.52.1", require: false
18
+ gem "rubocop", "0.82.0", require: false
19
19
  end
data/README.md CHANGED
@@ -47,6 +47,7 @@ writing.
47
47
  * Ruby 2.4
48
48
  * Ruby 2.5
49
49
  * Ruby 2.6
50
+ * Ruby 2.7
50
51
  * [JRuby](https://github.com/jruby/jruby)
51
52
  * [TruffleRuby](https://github.com/oracle/truffleruby)
52
53
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- $LOAD_PATH.push File.expand_path("../../lib", __FILE__)
4
+ $LOAD_PATH.push File.expand_path("../lib", __dir__)
5
5
  require "nio"
6
6
  require "socket"
7
7
 
@@ -19,7 +19,7 @@ class EchoServer
19
19
 
20
20
  def run
21
21
  loop do
22
- @selector.select { |monitor| monitor.value.call(monitor) }
22
+ @selector.select { |monitor| monitor.value.call }
23
23
  end
24
24
  end
25
25
 
@@ -4,6 +4,7 @@ require "rubygems"
4
4
 
5
5
  # Write a dummy Makefile on Windows because we use the pure Ruby implementation there
6
6
  if Gem.win_platform?
7
+ require "devkit" if RUBY_PLATFORM.include?("mingw")
7
8
  File.write("Makefile", "all install::\n")
8
9
  File.write("nio4r_ext.so", "")
9
10
  exit
@@ -66,6 +66,7 @@ static VALUE NIO_Monitor_allocate(VALUE klass)
66
66
 
67
67
  static void NIO_Monitor_mark(struct NIO_Monitor *monitor)
68
68
  {
69
+ return rb_gc_mark(monitor->self);
69
70
  }
70
71
 
71
72
  static void NIO_Monitor_free(struct NIO_Monitor *monitor)
@@ -24,6 +24,7 @@ module NIO
24
24
  # @return [NIO::ByteBuffer]
25
25
  def initialize(capacity)
26
26
  raise TypeError, "no implicit conversion of #{capacity.class} to Integer" unless capacity.is_a?(Integer)
27
+
27
28
  @capacity = capacity
28
29
  clear
29
30
  end
@@ -119,9 +120,11 @@ module NIO
119
120
  # @return [self]
120
121
  def put(str)
121
122
  raise TypeError, "expected String, got #{str.class}" unless str.respond_to?(:to_str)
123
+
122
124
  str = str.to_str
123
125
 
124
126
  raise OverflowError, "buffer is full" if str.length > @limit - @position
127
+
125
128
  @buffer[@position...str.length] = str
126
129
  @position += str.length
127
130
  self
@@ -188,6 +191,7 @@ module NIO
188
191
  # @raise [NIO::ByteBuffer::MarkUnsetError] mark has not been set (call `#mark` first)
189
192
  def reset
190
193
  raise MarkUnsetError, "mark has not been set" unless @mark
194
+
191
195
  @position = @mark
192
196
  self
193
197
  end
@@ -8,7 +8,7 @@ module NIO
8
8
 
9
9
  # :nodoc:
10
10
  def initialize(io, interests, selector)
11
- unless io.is_a? OpenSSL::SSL::SSLSocket
11
+ unless defined?(::OpenSSL) && io.is_a?(::OpenSSL::SSL::SSLSocket)
12
12
  unless io.is_a?(IO)
13
13
  if IO.respond_to? :try_convert
14
14
  io = IO.try_convert(io)
@@ -44,7 +44,7 @@ module NIO
44
44
  # * :w - is the IO writeable?
45
45
  # * :rw - is the IO either readable or writeable?
46
46
  def register(io, interest)
47
- unless io.is_a? OpenSSL::SSL::SSLSocket
47
+ unless defined?(::OpenSSL) && io.is_a?(::OpenSSL::SSL::SSLSocket)
48
48
  io = IO.try_convert(io)
49
49
  end
50
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NIO
4
- VERSION = "2.5.2"
4
+ VERSION = "2.5.3"
5
5
  end
@@ -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"]
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  "wiki_uri" => "https://github.com/socketry/nio4r/wiki"
29
29
  }
30
30
 
31
- spec.required_ruby_version = ">= 2.3"
31
+ spec.required_ruby_version = ">= 2.4"
32
32
 
33
33
  if defined? JRUBY_VERSION
34
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
@@ -234,4 +234,3 @@ RSpec.describe NIO::Selector do
234
234
  expect(subject).to be_closed
235
235
  end
236
236
  end
237
- # 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.5.2
4
+ version: 2.5.3
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-09-24 00:00:00.000000000 Z
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -47,16 +47,15 @@ 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
56
  - Guardfile
57
57
  - README.md
58
58
  - Rakefile
59
- - appveyor.yml
60
59
  - examples/echo_server.rb
61
60
  - ext/libev/Changes
62
61
  - ext/libev/LICENSE
@@ -109,10 +108,10 @@ licenses:
109
108
  metadata:
110
109
  bug_tracker_uri: https://github.com/socketry/nio4r/issues
111
110
  changelog_uri: https://github.com/socketry/nio4r/blob/master/CHANGES.md
112
- documentation_uri: https://www.rubydoc.info/gems/nio4r/2.5.2
113
- source_code_uri: https://github.com/socketry/nio4r/tree/v2.5.2
111
+ documentation_uri: https://www.rubydoc.info/gems/nio4r/2.5.3
112
+ source_code_uri: https://github.com/socketry/nio4r/tree/v2.5.3
114
113
  wiki_uri: https://github.com/socketry/nio4r/wiki
115
- post_install_message:
114
+ post_install_message:
116
115
  rdoc_options: []
117
116
  require_paths:
118
117
  - lib
@@ -120,15 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
119
  requirements:
121
120
  - - ">="
122
121
  - !ruby/object:Gem::Version
123
- version: '2.3'
122
+ version: '2.4'
124
123
  required_rubygems_version: !ruby/object:Gem::Requirement
125
124
  requirements:
126
125
  - - ">="
127
126
  - !ruby/object:Gem::Version
128
127
  version: '0'
129
128
  requirements: []
130
- rubygems_version: 3.0.4
131
- signing_key:
129
+ rubygems_version: 3.1.2
130
+ signing_key:
132
131
  specification_version: 4
133
132
  summary: New IO for Ruby
134
133
  test_files:
@@ -1,44 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- dist: xenial
4
- env: OS="xenial 16.04"
5
- bundler_args: --without development
6
-
7
- after_script:
8
- - ruby -ropenssl -e "puts ENV['OS'], RUBY_DESCRIPTION, OpenSSL::OPENSSL_LIBRARY_VERSION"
9
-
10
- matrix:
11
- fast_finish: true
12
- include:
13
- - rvm: 2.3
14
- - rvm: 2.4
15
- - rvm: 2.5
16
- - rvm: 2.6
17
- env: NIO4R_PURE=true
18
- - rvm: 2.6
19
- - rvm: 2.3
20
- dist: trusty
21
- env: OS="trusty 14.04"
22
- - rvm: 2.6.3
23
- dist: bionic
24
- env: OS="bionic 18.04"
25
- - rvm: 2.6
26
- os: osx
27
- env: OS="osx"
28
- - rvm: 2.4.6
29
- os: osx
30
- osx_image: xcode10.2
31
- env: OS="osx xcode 10.2"
32
- - rvm: truffleruby
33
- - rvm: truffleruby
34
- env: NIO4R_PURE=true
35
- - rvm: jruby
36
- env: JRUBY_OPTS="--debug -X+O --dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
37
- - rvm: jruby-head
38
- env: JRUBY_OPTS="--debug -X+O --dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
39
- - rvm: ruby-head
40
- allow_failures:
41
- - rvm: ruby-head
42
- - rvm: truffleruby
43
- - rvm: jruby-head
44
- - rvm: jruby
@@ -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