Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.6
DisplayCopNames: true

Layout/HashAlignment:
Expand All @@ -24,9 +24,6 @@ Style/UnpackFirst:
# Lint
#

Lint/SuppressedException:
Enabled: false

Lint/Loop:
Enabled: false

Expand All @@ -35,6 +32,13 @@ Lint/RaiseException:

Lint/StructNewOverride:
Enabled: false

Lint/SuppressedException:
Enabled: false

Lint/UselessAssignment:
Enabled: false

#
# Metrics
#
Expand All @@ -49,20 +53,23 @@ Metrics/BlockLength:
Metrics/ClassLength:
Max: 128

Metrics/CyclomaticComplexity:
Max: 15

Metrics/MethodLength:
CountComments: false
Max: 50

Metrics/CyclomaticComplexity:
Max: 15

Metrics/PerceivedComplexity:
Max: 15

#
# Style
#

Style/AsciiComments:
Enabled: false

Style/ExponentialNotation:
Enabled: false

Expand Down
4 changes: 2 additions & 2 deletions lib/nio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def self.pure?(env = ENV)
end

# Native Ruby on Windows is not supported:
if (Gem.win_platform? && !defined?(JRUBY_VERSION))
if Gem.win_platform? && !defined?(JRUBY_VERSION)
return true
end

Expand All @@ -38,7 +38,7 @@ def self.pure?(env = ENV)
# return true
# end

return false
false
end
end

Expand Down
12 changes: 7 additions & 5 deletions nio4r.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ Gem::Specification.new do |spec|
spec.version = NIO::VERSION

spec.summary = "New IO for Ruby"
# rubocop:disable Layout/LineLength
spec.authors = ["Tony Arcieri", "Samuel Williams", "Olle Jonsson", "Gregory Longtin", "Tiago Cardoso", "Joao Fernandes", "Thomas Dziedzic", "Boaz Segev", "Logan Bowers", "Pedro Paiva", "Jun Aruga", "Omer Katz", "Upekshe Jayasekera", "Tim Carey-Smith", "Benoit Daloze", "Sergey Avseyev", "Tomoya Ishida", "Usaku Nakamura", "Cédric Boutillier", "Daniel Berger", "Dirkjan Bussink", "Hiroshi Shibata", "Jesús Burgos Maciá", "Luis Lavena", "Pavel Rosický", "Sadayuki Furuhashi", "Stephen von Takach", "Vladimir Kochnev", "Vít Ondruch", "Anatol Pomozov", "Bernd Ahlers", "Charles Oliver Nutter", "Denis Washington", "Elad Eyal", "Jean byroot Boussier", "Jeffrey Martin", "John Thornton", "Jun Jiang", "Lars Kanis", "Marek Kowalcze", "Maxime Demolin", "Orien Madgwick", "Pavel Lobashov", "Per Lundberg", "Phillip Aldridge", "Ravil Bayramgalin", "Shannon Skipper", "Tao Luo", "Thomas Kuntz", "Tsimnuj Hawj", "Zhang Kang"]
# rubocop:enable Layout/LineLength
spec.licenses = ["MIT", "BSD-2-Clause"]

unless defined? JRUBY_VERSION
spec.cert_chain = ['release.cert']
spec.signing_key = File.expand_path('~/.gem/release.pem')
spec.cert_chain = ["release.cert"]
spec.signing_key = File.expand_path("~/.gem/release.pem")
end

spec.homepage = "https://github.com/socketry/nio4r"
Expand All @@ -23,11 +25,11 @@ Gem::Specification.new do |spec|
"documentation_uri" => "https://www.rubydoc.info/gems/nio4r",
"funding_uri" => "https://github.com/sponsors/ioquatix/",
"source_code_uri" => "https://github.com/socketry/nio4r.git",
"wiki_uri" => "https://github.com/socketry/nio4r/wiki",
"wiki_uri" => "https://github.com/socketry/nio4r/wiki"
}

spec.files = Dir.glob(['{ext,lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)
spec.require_paths = ['lib']
spec.files = Dir.glob(["{ext,lib}/**/*", "*.md"], File::FNM_DOTMATCH, base: __dir__)
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.6"

Expand Down
2 changes: 1 addition & 1 deletion rakelib/extension.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if defined? JRUBY_VERSION
require "rake/javaextensiontask"
Rake::JavaExtensionTask.new("nio4r_ext") do |ext|
ext.ext_dir = "ext/nio4r"
ext.release = '8'
ext.release = "8"
end
else
require "rake/extensiontask"
Expand Down
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ writing.

## Supported platforms

- Ruby 2.5
- Ruby 2.6
- Ruby 2.7
- Ruby 3.0
Expand Down
28 changes: 13 additions & 15 deletions spec/nio/selectables/tcp_socket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,23 @@
include_context NIO::Selector

it "selects writable when connected" do
begin
server = TCPServer.new(addr, 0)
server = TCPServer.new(addr, 0)

client = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
monitor = selector.register(client, :w)
client = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
monitor = selector.register(client, :w)

expect do
client.connect_nonblock server.local_address
end.to raise_exception Errno::EINPROGRESS
expect do
client.connect_nonblock server.local_address
end.to raise_exception Errno::EINPROGRESS

ready = selector.select(1)
ready = selector.select(1)

expect(ready).to include monitor
result = client.getsockopt(::Socket::SOL_SOCKET, ::Socket::SO_ERROR)
expect(result.unpack("i").first).to be_zero
ensure
server.close rescue nil
selector.close rescue nil
end
expect(ready).to include monitor
result = client.getsockopt(::Socket::SOL_SOCKET, ::Socket::SO_ERROR)
expect(result.unpack("i").first).to be_zero
ensure
server.close rescue nil
selector.close rescue nil
end
end
end