nio4r 1.1.0-java → 1.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- describe TCPSocket do
3
+ RSpec.describe TCPSocket do
4
4
  port_offset = 0
5
- let(:tcp_port) { 12345 + (port_offset += 1) }
5
+ let(:tcp_port) { 12_345 + (port_offset += 1) }
6
6
 
7
7
  let :readable_subject do
8
8
  server = TCPServer.new("localhost", tcp_port)
@@ -37,7 +37,7 @@ describe TCPSocket do
37
37
  begin
38
38
  sock.write_nonblock "X" * 1024
39
39
  _, writers = select [], [sock], [], 0
40
- end while writers and writers.include? sock
40
+ end while writers && writers.include?(sock)
41
41
 
42
42
  # I think the kernel might manage to drain its buffer a bit even after
43
43
  # the socket first goes unwritable. Attempt to sleep past this and then
@@ -71,18 +71,18 @@ describe TCPSocket do
71
71
  context :connect do
72
72
  it "selects writable when connected" do
73
73
  selector = NIO::Selector.new
74
- server = TCPServer.new('127.0.0.1', tcp_port)
74
+ server = TCPServer.new("127.0.0.1", tcp_port)
75
75
 
76
76
  client = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
77
77
  monitor = selector.register(client, :w)
78
78
 
79
79
  expect do
80
- client.connect_nonblock Socket.sockaddr_in(tcp_port, '127.0.0.1')
80
+ client.connect_nonblock Socket.sockaddr_in(tcp_port, "127.0.0.1")
81
81
  end.to raise_exception Errno::EINPROGRESS
82
82
 
83
83
  expect(selector.select(0)).to include monitor
84
84
  result = client.getsockopt(::Socket::SOL_SOCKET, ::Socket::SO_ERROR)
85
- expect(result.unpack('i').first).to be_zero
85
+ expect(result.unpack("i").first).to be_zero
86
86
  end
87
87
  end
88
88
  end
@@ -1,21 +1,21 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- describe UDPSocket do
4
- let(:udp_port) { 23456 }
3
+ RSpec.describe UDPSocket do
4
+ let(:udp_port) { 23_456 }
5
5
 
6
6
  let :readable_subject do
7
7
  sock = UDPSocket.new
8
- sock.bind('localhost', udp_port)
8
+ sock.bind("localhost", udp_port)
9
9
 
10
10
  peer = UDPSocket.new
11
- peer.send("hi there", 0, 'localhost', udp_port)
11
+ peer.send("hi there", 0, "localhost", udp_port)
12
12
 
13
13
  sock
14
14
  end
15
15
 
16
16
  let :unreadable_subject do
17
17
  sock = UDPSocket.new
18
- sock.bind('localhost', udp_port + 1)
18
+ sock.bind("localhost", udp_port + 1)
19
19
  sock
20
20
  end
21
21
 
@@ -1,11 +1,11 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  # Timeouts should be at least this precise (in seconds) to pass the tests
4
4
  # Typical precision should be better than this, but if it's worse it will fail
5
5
  # the tests
6
6
  TIMEOUT_PRECISION = 0.1
7
7
 
8
- describe NIO::Selector do
8
+ RSpec.describe NIO::Selector do
9
9
  let(:pair) { IO.pipe }
10
10
  let(:reader) { pair.first }
11
11
  let(:writer) { pair.last }
@@ -117,7 +117,7 @@ describe NIO::Selector do
117
117
  context "select" do
118
118
  it "selects IO objects" do
119
119
  writer << "ohai"
120
- unready, _ = IO.pipe
120
+ unready = IO.pipe.first
121
121
 
122
122
  reader_monitor = subject.register(reader, :r)
123
123
  unready_monitor = subject.register(unready, :r)
@@ -147,7 +147,7 @@ describe NIO::Selector do
147
147
  readable2, writer = IO.pipe
148
148
  writer << "ohai"
149
149
 
150
- unreadable, _ = IO.pipe
150
+ unreadable = IO.pipe.first
151
151
 
152
152
  monitor1 = subject.register(readable1, :r)
153
153
  monitor2 = subject.register(readable2, :r)
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,9 @@
1
- require 'coveralls'
1
+ require "coveralls"
2
2
  Coveralls.wear!
3
3
 
4
- require 'rubygems'
5
- require 'bundler/setup'
6
- require 'nio'
7
- require 'support/selectable_examples'
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+ require "nio"
7
+ require "support/selectable_examples"
8
+
9
+ RSpec.configure(&:disable_monkey_patching!)
@@ -1,4 +1,4 @@
1
- shared_context "an NIO selectable" do
1
+ RSpec.shared_context "an NIO selectable" do
2
2
  let(:selector) { NIO::Selector.new }
3
3
 
4
4
  it "selects readable objects" do
@@ -26,25 +26,25 @@ shared_context "an NIO selectable" do
26
26
  end
27
27
  end
28
28
 
29
- shared_context "an NIO selectable stream" do
29
+ RSpec.shared_context "an NIO selectable stream" do
30
30
  let(:selector) { NIO::Selector.new }
31
31
  let(:stream) { pair.first }
32
32
  let(:peer) { pair.last }
33
33
 
34
34
  it "selects readable when the other end closes" do
35
35
  # hax: this test is broken for OpenSSL sockets
36
- skip 'broken for SSL ;_;' if peer.is_a? OpenSSL::SSL::SSLSocket
36
+ skip "broken for SSL ;_;" if peer.is_a? OpenSSL::SSL::SSLSocket
37
37
 
38
38
  monitor = selector.register(stream, :r)
39
39
  expect(selector.select(0)).to be_nil
40
40
 
41
41
  peer.close
42
- #Wait and give the TCP session time to close
42
+ # Wait and give the TCP session time to close
43
43
  expect(selector.select(0.1)).to include monitor
44
44
  end
45
45
  end
46
46
 
47
- shared_context "an NIO bidirectional stream" do
47
+ RSpec.shared_context "an NIO bidirectional stream" do
48
48
  let(:selector) { NIO::Selector.new }
49
49
  let(:stream) { pair.first }
50
50
  let(:peer) { pair.last }
data/tasks/extension.rake CHANGED
@@ -1,11 +1,11 @@
1
1
  if defined? JRUBY_VERSION
2
- require 'rake/javaextensiontask'
3
- Rake::JavaExtensionTask.new('nio4r_ext') do |ext|
4
- ext.ext_dir = 'ext/nio4r'
2
+ require "rake/javaextensiontask"
3
+ Rake::JavaExtensionTask.new("nio4r_ext") do |ext|
4
+ ext.ext_dir = "ext/nio4r"
5
5
  end
6
6
  else
7
- require 'rake/extensiontask'
8
- Rake::ExtensionTask.new('nio4r_ext') do |ext|
9
- ext.ext_dir = 'ext/nio4r'
7
+ require "rake/extensiontask"
8
+ Rake::ExtensionTask.new("nio4r_ext") do |ext|
9
+ ext.ext_dir = "ext/nio4r"
10
10
  end
11
- end
11
+ end
data/tasks/rspec.rake CHANGED
@@ -1,7 +1,7 @@
1
- require 'rspec/core/rake_task'
1
+ require "rspec/core/rake_task"
2
2
 
3
3
  RSpec::Core::RakeTask.new
4
4
 
5
5
  RSpec::Core::RakeTask.new(:rcov) do |task|
6
- task.rcov = true
6
+ task.rcov = true
7
7
  end
@@ -0,0 +1,3 @@
1
+ require "rubocop/rake_task"
2
+
3
+ RuboCop::RakeTask.new
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-11 00:00:00.000000000 Z
11
+ date: 2015-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -44,12 +44,26 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0
47
+ version: '3.0'
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - ~>
51
51
  - !ruby/object:Gem::Version
52
- version: 3.0.0
52
+ version: '3.0'
53
+ prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
53
67
  prerelease: false
54
68
  type: :development
55
69
  description: New IO for Ruby
@@ -61,6 +75,8 @@ extra_rdoc_files: []
61
75
  files:
62
76
  - .gitignore
63
77
  - .rspec
78
+ - .rubocop.yml
79
+ - .rubocop_todo.yml
64
80
  - .travis.yml
65
81
  - CHANGES.md
66
82
  - Gemfile
@@ -94,6 +110,7 @@ files:
94
110
  - lib/nio/monitor.rb
95
111
  - lib/nio/selector.rb
96
112
  - lib/nio/version.rb
113
+ - lib/nio4r_ext.jar
97
114
  - logo.png
98
115
  - nio4r.gemspec
99
116
  - spec/nio/acceptables_spec.rb
@@ -107,7 +124,7 @@ files:
107
124
  - spec/support/selectable_examples.rb
108
125
  - tasks/extension.rake
109
126
  - tasks/rspec.rake
110
- - lib/nio4r_ext.jar
127
+ - tasks/rubocop.rake
111
128
  homepage: https://github.com/celluloid/nio4r
112
129
  licenses:
113
130
  - MIT
@@ -128,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
145
  version: '0'
129
146
  requirements: []
130
147
  rubyforge_project:
131
- rubygems_version: 2.1.9
148
+ rubygems_version: 2.4.5
132
149
  signing_key:
133
150
  specification_version: 4
134
151
  summary: NIO provides a high performance selector API for monitoring IO objects