nio4r 2.5.9 → 2.7.3

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,61 +0,0 @@
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:
18
- - ubuntu-22.04
19
- - macos-11
20
- - windows-2022
21
- ruby:
22
- - "2.4"
23
- - "2.5"
24
- - "2.6"
25
- - "2.7"
26
- - "3.0"
27
- - "3.1"
28
- - "3.2"
29
- - "head"
30
- - "jruby"
31
- - "truffleruby"
32
- include:
33
- - {os: ubuntu-20.04, ruby: "3.2"}
34
- - {os: windows-2019, ruby: "3.2"}
35
- - {os: windows-2022, ruby: ucrt}
36
- exclude:
37
- - {os: windows-2022, ruby: head}
38
- - {os: windows-2022, ruby: jruby}
39
- - {os: windows-2022, ruby: truffleruby}
40
-
41
- steps:
42
- - uses: actions/checkout@v3
43
-
44
- - name: set JAVA_HOME
45
- if: |
46
- startsWith(matrix.ruby, 'jruby')
47
- shell: bash
48
- run: |
49
- echo JAVA_HOME=$JAVA_HOME_11_X64 >> $GITHUB_ENV
50
-
51
- - uses: ruby/setup-ruby@v1
52
- with:
53
- ruby-version: ${{matrix.ruby}}
54
- bundler-cache: true
55
-
56
- - name: Compile
57
- run: bundle exec rake compile
58
-
59
- - name: Test
60
- run: bundle exec rake spec
61
- timeout-minutes: 10
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- lib/nio4r_ext.*
19
- ext/**/*.o
20
- ext/**/nio4r_ext.*
21
- .rspec_status
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --color
2
- --format documentation
3
- --order random
4
- --warnings
data/.rubocop.yml DELETED
@@ -1,100 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.4
3
- DisplayCopNames: true
4
-
5
- Layout/HashAlignment:
6
- Enabled: false
7
-
8
- Layout/LineLength:
9
- Max: 128
10
-
11
- Layout/SpaceAroundMethodCallOperator:
12
- Enabled: false
13
-
14
- Layout/SpaceInsideBlockBraces:
15
- Enabled: false
16
-
17
- Style/IfUnlessModifier:
18
- Enabled: false
19
-
20
- Style/UnpackFirst:
21
- Enabled: false
22
-
23
- #
24
- # Lint
25
- #
26
-
27
- Lint/SuppressedException:
28
- Enabled: false
29
-
30
- Lint/Loop:
31
- Enabled: false
32
-
33
- Lint/RaiseException:
34
- Enabled: false
35
-
36
- Lint/StructNewOverride:
37
- Enabled: false
38
- #
39
- # Metrics
40
- #
41
-
42
- Metrics/AbcSize:
43
- Max: 35
44
-
45
- Metrics/BlockLength:
46
- Max: 128
47
- Enabled: false
48
-
49
- Metrics/ClassLength:
50
- Max: 128
51
-
52
- Metrics/MethodLength:
53
- CountComments: false
54
- Max: 50
55
-
56
- Metrics/CyclomaticComplexity:
57
- Max: 15
58
-
59
- Metrics/PerceivedComplexity:
60
- Max: 15
61
-
62
- #
63
- # Style
64
- #
65
-
66
- Style/ExponentialNotation:
67
- Enabled: false
68
-
69
- Style/FormatStringToken:
70
- Enabled: false
71
-
72
- Style/FrozenStringLiteralComment:
73
- Enabled: true
74
-
75
- Style/GlobalVars:
76
- Enabled: false
77
-
78
- Style/HashEachMethods:
79
- Enabled: false
80
-
81
- Style/HashTransformKeys:
82
- Enabled: false
83
-
84
- Style/HashTransformValues:
85
- Enabled: false
86
-
87
- Style/NumericPredicate:
88
- Enabled: false
89
-
90
- Style/RescueModifier:
91
- Enabled: false
92
-
93
- Style/SafeNavigation:
94
- Enabled: false
95
-
96
- Style/StringLiterals:
97
- EnforcedStyle: double_quotes
98
-
99
- Style/TrivialAccessors:
100
- Enabled: false
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec
6
-
7
- gem "jruby-openssl" if defined? JRUBY_VERSION
8
-
9
- group :development do
10
- gem "pry", require: false
11
- end
12
-
13
- group :development, :test do
14
- gem "rake-compiler", "~> 1.1.9", require: false
15
- gem "rspec", "~> 3.7", require: false
16
- gem "rubocop", "0.82.0", require: false
17
- end
data/README.md DELETED
@@ -1,99 +0,0 @@
1
- # ![nio4r](https://raw.github.com/socketry/nio4r/master/logo.png)
2
-
3
- [![Gem Version](https://badge.fury.io/rb/nio4r.svg)](http://rubygems.org/gems/nio4r)
4
- [![Build Status](https://github.com/socketry/nio4r/workflows/nio4r/badge.svg?branch=master&event=push)](https://github.com/socketry/nio4r/actions?query=workflow:nio4r)
5
- [![Code Climate](https://codeclimate.com/github/socketry/nio4r.svg)](https://codeclimate.com/github/socketry/nio4r)
6
- [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/nio4r/2.2.0)
7
-
8
- **New I/O for Ruby (nio4r)**: cross-platform asynchronous I/O primitives for
9
- scalable network clients and servers. Modeled after the Java NIO API, but
10
- simplified for ease-of-use.
11
-
12
- **nio4r** provides an abstract, cross-platform stateful I/O selector API for Ruby.
13
- I/O selectors are the heart of "reactor"-based event loops, and monitor
14
- multiple I/O objects for various types of readiness, e.g. ready for reading or
15
- writing.
16
-
17
- ## Projects using nio4r
18
-
19
- * [ActionCable]: Rails 5 WebSocket protocol, uses nio4r for a WebSocket server
20
- * [Celluloid]: Actor-based concurrency framework, uses nio4r for async I/O
21
- * [Async]: Asynchronous I/O framework for Ruby
22
- * [Puma]: Ruby/Rack web server built for concurrency
23
-
24
- [ActionCable]: https://rubygems.org/gems/actioncable
25
- [Celluloid]: https://github.com/celluloid/celluloid-io
26
- [Async]: https://github.com/socketry/async
27
- [Puma]: https://github.com/puma/puma
28
-
29
- ## Goals
30
-
31
- * Expose high-level interfaces for stateful IO selectors
32
- * Keep the API small to maximize both portability and performance across many
33
- different OSes and Ruby VMs
34
- * Provide inherently thread-safe facilities for working with IO objects
35
-
36
- ## Supported platforms
37
-
38
- * Ruby 2.4
39
- * Ruby 2.5
40
- * Ruby 2.6
41
- * Ruby 2.7
42
- * Ruby 3.0
43
- * [JRuby](https://github.com/jruby/jruby)
44
- * [TruffleRuby](https://github.com/oracle/truffleruby)
45
-
46
- ## Supported backends
47
-
48
- * **libev**: MRI C extension targeting multiple native IO selector APIs (e.g epoll, kqueue)
49
- * **Java NIO**: JRuby extension which wraps the Java NIO subsystem
50
- * **Pure Ruby**: `Kernel.select`-based backend that should work on any Ruby interpreter
51
-
52
- ## Documentation
53
-
54
- [Please see the nio4r wiki](https://github.com/socketry/nio4r/wiki)
55
- for more detailed documentation and usage notes:
56
-
57
- * [Getting Started]: Introduction to nio4r's components
58
- * [Selectors]: monitor multiple `IO` objects for readiness events
59
- * [Monitors]: control interests and inspect readiness for specific `IO` objects
60
- * [Byte Buffers]: fixed-size native buffers for high-performance I/O
61
-
62
- [Getting Started]: https://github.com/socketry/nio4r/wiki/Getting-Started
63
- [Selectors]: https://github.com/socketry/nio4r/wiki/Selectors
64
- [Monitors]: https://github.com/socketry/nio4r/wiki/Monitors
65
- [Byte Buffers]: https://github.com/socketry/nio4r/wiki/Byte-Buffers
66
-
67
- See also:
68
-
69
- * [YARD API documentation](http://www.rubydoc.info/gems/nio4r/frames)
70
-
71
- ## Non-goals
72
-
73
- **nio4r** is not a full-featured event framework like [EventMachine] or [Cool.io].
74
- Instead, nio4r is the sort of thing you might write a library like that on
75
- top of. nio4r provides a minimal API such that individual Ruby implementers
76
- may choose to produce optimized versions for their platform, without having
77
- to maintain a large codebase.
78
-
79
- [EventMachine]: https://github.com/eventmachine/eventmachine
80
- [Cool.io]: https://coolio.github.io/
81
-
82
- ## Releases
83
-
84
- ### CRuby
85
-
86
- ```
87
- rake clean
88
- rake release
89
- ```
90
-
91
- ### JRuby
92
-
93
- You might need to delete `Gemfile.lock` before trying to `bundle install`.
94
-
95
- ```
96
- rake clean
97
- rake compile
98
- rake release
99
- ```
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rake/clean"
5
-
6
- task default: %w[compile spec rubocop]
7
-
8
- CLEAN.include "**/*.o", "**/*.so", "**/*.bundle", "**/*.jar", "pkg", "tmp"
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- $LOAD_PATH.push File.expand_path("../lib", __dir__)
5
- require "nio"
6
- require "socket"
7
-
8
- # Echo server example written with nio4r
9
- class EchoServer
10
- def initialize(host, port)
11
- @selector = NIO::Selector.new
12
-
13
- puts "Listening on #{host}:#{port}"
14
- @server = TCPServer.new(host, port)
15
-
16
- monitor = @selector.register(@server, :r)
17
- monitor.value = proc { accept }
18
- end
19
-
20
- def run
21
- loop do
22
- @selector.select { |monitor| monitor.value.call }
23
- end
24
- end
25
-
26
- def accept
27
- socket = @server.accept
28
- _, port, host = socket.peeraddr
29
- puts "*** #{host}:#{port} connected"
30
-
31
- monitor = @selector.register(socket, :r)
32
- monitor.value = proc { read(socket) }
33
- end
34
-
35
- def read(socket)
36
- data = socket.read_nonblock(4096)
37
- socket.write_nonblock(data)
38
- rescue EOFError
39
- _, port, host = socket.peeraddr
40
- puts "*** #{host}:#{port} disconnected"
41
-
42
- @selector.deregister(socket)
43
- socket.close
44
- end
45
- end
46
-
47
- EchoServer.new("localhost", 1234).run if $PROGRAM_NAME == __FILE__
data/logo.png DELETED
Binary file
data/nio4r.gemspec DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path("lib/nio/version", __dir__)
4
-
5
- Gem::Specification.new do |spec|
6
- spec.authors = ["Tony Arcieri"]
7
- spec.email = ["bascule@gmail.com"]
8
- spec.homepage = "https://github.com/socketry/nio4r"
9
- spec.license = "MIT"
10
- spec.summary = "New IO for Ruby"
11
- spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
12
- Cross-platform asynchronous I/O primitives for scalable network clients
13
- and servers. Inspired by the Java NIO API, but simplified for ease-of-use.
14
- DESCRIPTION
15
-
16
- spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
17
- spec.files = `git ls-files`.split("\n")
18
- spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- spec.name = "nio4r"
20
- spec.require_paths = ["lib"]
21
- spec.version = NIO::VERSION
22
-
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"
32
-
33
- if defined? JRUBY_VERSION
34
- spec.files << "lib/nio4r_ext.jar"
35
- spec.platform = "java"
36
- else
37
- spec.extensions = ["ext/nio4r/extconf.rb"]
38
- end
39
-
40
- spec.add_development_dependency "bundler"
41
- spec.add_development_dependency "rake"
42
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if defined? JRUBY_VERSION
4
- require "rake/javaextensiontask"
5
- Rake::JavaExtensionTask.new("nio4r_ext") do |ext|
6
- ext.ext_dir = "ext/nio4r"
7
- ext.release = '8'
8
- end
9
- else
10
- require "rake/extensiontask"
11
- Rake::ExtensionTask.new("nio4r_ext") do |ext|
12
- ext.ext_dir = "ext/nio4r"
13
- end
14
- end
data/rakelib/rspec.rake DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rspec/core/rake_task"
4
-
5
- RSpec::Core::RakeTask.new
6
-
7
- RSpec::Core::RakeTask.new(:rcov) do |task|
8
- task.rcov = true
9
- end
data/rakelib/rubocop.rake DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop/rake_task"
4
-
5
- RuboCop::RakeTask.new
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- RSpec.describe "NIO acceptables" do
6
- shared_context "an NIO acceptable" do
7
- let(:selector) { NIO::Selector.new }
8
-
9
- it "selects for read readiness" do
10
- waiting_monitor = selector.register(unacceptable_subject, :r)
11
- ready_monitor = selector.register(acceptable_subject, :r)
12
-
13
- ready_monitors = selector.select
14
- expect(ready_monitors).to include ready_monitor
15
- expect(ready_monitors).not_to include waiting_monitor
16
- end
17
- end
18
-
19
- describe TCPServer do
20
- let :acceptable_subject do
21
- server = TCPServer.new("127.0.0.1", 0)
22
- TCPSocket.open("127.0.0.1", server.local_address.ip_port)
23
- server
24
- end
25
-
26
- let :unacceptable_subject do
27
- TCPServer.new("127.0.0.1", 0)
28
- end
29
-
30
- it_behaves_like "an NIO acceptable"
31
- end
32
- end