nio4r 2.5.2 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.4"
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.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-09-24 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,16 +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
56
  - README.md
58
57
  - Rakefile
59
- - appveyor.yml
60
58
  - examples/echo_server.rb
61
59
  - ext/libev/Changes
62
60
  - ext/libev/LICENSE
@@ -72,6 +70,7 @@ files:
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
@@ -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.4
112
+ source_code_uri: https://github.com/socketry/nio4r/tree/v2.5.4
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
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,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