win32-pipe 0.2.2 → 0.3.0
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.
- data/CHANGES +51 -46
- data/MANIFEST +17 -15
- data/README +52 -55
- data/Rakefile +68 -48
- data/examples/example_client.rb +29 -29
- data/examples/example_client_async.rb +82 -82
- data/examples/example_server.rb +32 -32
- data/examples/example_server_async.rb +100 -100
- data/lib/win32/pipe.rb +251 -254
- data/lib/win32/pipe/client.rb +65 -65
- data/lib/win32/pipe/server.rb +96 -96
- data/lib/win32/pipe/windows/constants.rb +37 -0
- data/lib/win32/pipe/windows/functions.rb +31 -0
- data/test/test_win32_pipe.rb +162 -126
- data/test/test_win32_pipe_client.rb +62 -60
- data/test/test_win32_pipe_server.rb +34 -34
- data/win32-pipe.gemspec +25 -25
- metadata +22 -10
@@ -1,60 +1,62 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# test_win32_pipe_client.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Pipe::Client class. This test suite should be run
|
5
|
-
# as part of the 'rake test' task.
|
6
|
-
##########################################################################
|
7
|
-
require 'test/unit'
|
8
|
-
require 'win32/pipe'
|
9
|
-
|
10
|
-
class TC_Win32_Pipe_Client < Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
@server = Win32::Pipe::Server.new('test')
|
13
|
-
@pipe = nil
|
14
|
-
@name = 'test'
|
15
|
-
@pmode = Win32::Pipe::PIPE_NOWAIT
|
16
|
-
@omode = Win32::Pipe::DEFAULT_OPEN_MODE
|
17
|
-
end
|
18
|
-
|
19
|
-
test "constructor basic functionality" do
|
20
|
-
assert_respond_to(Win32::Pipe::Client, :new)
|
21
|
-
assert_nothing_raised{ @pipe = Win32::Pipe::Client.new(@name) }
|
22
|
-
end
|
23
|
-
|
24
|
-
test "constructor accepts an optional pipe mode" do
|
25
|
-
assert_nothing_raised{ @pipe = Win32::Pipe::Client.new(@name, @pmode) }
|
26
|
-
end
|
27
|
-
|
28
|
-
test "constructor accepts an optional open mode" do
|
29
|
-
assert_nothing_raised{ @pipe = Win32::Pipe::Client.new(@name, @pmode, @omode) }
|
30
|
-
end
|
31
|
-
|
32
|
-
test "constructor requires a pipe name" do
|
33
|
-
assert_raise(ArgumentError){ Win32::Pipe::Client.new }
|
34
|
-
end
|
35
|
-
|
36
|
-
test "pipe name must be a string" do
|
37
|
-
assert_raise(TypeError){ Win32::Pipe::Client.new(1) }
|
38
|
-
end
|
39
|
-
|
40
|
-
test "an error is raised if the named pipe cannot be found" do
|
41
|
-
assert_raise(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
@
|
58
|
-
@
|
59
|
-
|
60
|
-
|
1
|
+
##########################################################################
|
2
|
+
# test_win32_pipe_client.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Pipe::Client class. This test suite should be run
|
5
|
+
# as part of the 'rake test' task.
|
6
|
+
##########################################################################
|
7
|
+
require 'test/unit'
|
8
|
+
require 'win32/pipe'
|
9
|
+
|
10
|
+
class TC_Win32_Pipe_Client < Test::Unit::TestCase
|
11
|
+
def setup
|
12
|
+
@server = Win32::Pipe::Server.new('test')
|
13
|
+
@pipe = nil
|
14
|
+
@name = 'test'
|
15
|
+
@pmode = Win32::Pipe::PIPE_NOWAIT
|
16
|
+
@omode = Win32::Pipe::DEFAULT_OPEN_MODE
|
17
|
+
end
|
18
|
+
|
19
|
+
test "constructor basic functionality" do
|
20
|
+
assert_respond_to(Win32::Pipe::Client, :new)
|
21
|
+
assert_nothing_raised{ @pipe = Win32::Pipe::Client.new(@name) }
|
22
|
+
end
|
23
|
+
|
24
|
+
test "constructor accepts an optional pipe mode" do
|
25
|
+
assert_nothing_raised{ @pipe = Win32::Pipe::Client.new(@name, @pmode) }
|
26
|
+
end
|
27
|
+
|
28
|
+
test "constructor accepts an optional open mode" do
|
29
|
+
assert_nothing_raised{ @pipe = Win32::Pipe::Client.new(@name, @pmode, @omode) }
|
30
|
+
end
|
31
|
+
|
32
|
+
test "constructor requires a pipe name" do
|
33
|
+
assert_raise(ArgumentError){ Win32::Pipe::Client.new }
|
34
|
+
end
|
35
|
+
|
36
|
+
test "pipe name must be a string" do
|
37
|
+
assert_raise(TypeError){ Win32::Pipe::Client.new(1) }
|
38
|
+
end
|
39
|
+
|
40
|
+
test "an error is raised if the named pipe cannot be found" do
|
41
|
+
assert_raise(SystemCallError, Errno::ENOENT){
|
42
|
+
Win32::Pipe::Client.new('bogus')
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def teardown
|
47
|
+
if @pipe
|
48
|
+
@pipe.disconnect
|
49
|
+
@pipe.close
|
50
|
+
end
|
51
|
+
|
52
|
+
if @server
|
53
|
+
@server.disconnect
|
54
|
+
@server.close
|
55
|
+
end
|
56
|
+
|
57
|
+
@pmode = nil
|
58
|
+
@omode = nil
|
59
|
+
@pipe = nil
|
60
|
+
@server = nil
|
61
|
+
end
|
62
|
+
end
|
@@ -1,34 +1,34 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# test_win32_pipe_server.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Pipe::Server class. This test suite should be run
|
5
|
-
# as part of the 'rake test' task.
|
6
|
-
##########################################################################
|
7
|
-
require 'test/unit'
|
8
|
-
require 'win32/pipe'
|
9
|
-
include Win32
|
10
|
-
|
11
|
-
class TC_Win32_Pipe_Server < Test::Unit::TestCase
|
12
|
-
def setup
|
13
|
-
@pipe = nil
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_constructor_basic
|
17
|
-
assert_respond_to(Pipe::Server, :new)
|
18
|
-
assert_nothing_raised{ @pipe = Pipe::Server.new('foo') }
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_connect
|
22
|
-
assert_nothing_raised{ @pipe = Pipe::Server.new('foo') }
|
23
|
-
assert_respond_to(@pipe, :connect)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_constructor_expected_errors
|
27
|
-
assert_raise(ArgumentError){ Pipe::Server.new }
|
28
|
-
assert_raise(TypeError){ Pipe::Server.new(1) }
|
29
|
-
end
|
30
|
-
|
31
|
-
def teardown
|
32
|
-
@pipe = nil
|
33
|
-
end
|
34
|
-
end
|
1
|
+
##########################################################################
|
2
|
+
# test_win32_pipe_server.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Pipe::Server class. This test suite should be run
|
5
|
+
# as part of the 'rake test' task.
|
6
|
+
##########################################################################
|
7
|
+
require 'test/unit'
|
8
|
+
require 'win32/pipe'
|
9
|
+
include Win32
|
10
|
+
|
11
|
+
class TC_Win32_Pipe_Server < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
@pipe = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_constructor_basic
|
17
|
+
assert_respond_to(Pipe::Server, :new)
|
18
|
+
assert_nothing_raised{ @pipe = Pipe::Server.new('foo') }
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_connect
|
22
|
+
assert_nothing_raised{ @pipe = Pipe::Server.new('foo') }
|
23
|
+
assert_respond_to(@pipe, :connect)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_constructor_expected_errors
|
27
|
+
assert_raise(ArgumentError){ Pipe::Server.new }
|
28
|
+
assert_raise(TypeError){ Pipe::Server.new(1) }
|
29
|
+
end
|
30
|
+
|
31
|
+
def teardown
|
32
|
+
@pipe = nil
|
33
|
+
end
|
34
|
+
end
|
data/win32-pipe.gemspec
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'win32-pipe'
|
5
|
-
spec.version = '0.
|
6
|
-
spec.author = 'Daniel J. Berger'
|
7
|
-
spec.license = 'Artistic 2.0'
|
8
|
-
spec.email = 'djberg96@gmail.com'
|
9
|
-
spec.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
10
|
-
spec.summary = 'An interface for named pipes on MS Windows'
|
11
|
-
spec.test_files = Dir['test/test_*.rb']
|
12
|
-
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
-
|
14
|
-
spec.rubyforge_project = 'win32utils'
|
15
|
-
spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
16
|
-
|
17
|
-
spec.add_dependency('
|
18
|
-
spec.add_development_dependency('test-unit'
|
19
|
-
|
20
|
-
spec.description = <<-EOF
|
21
|
-
The win32-pipe library provides an interface for named pipes on Windows.
|
22
|
-
A named pipe is a named, one-way or duplex pipe for communication
|
23
|
-
between the pipe server and one or more pipe clients.
|
24
|
-
EOF
|
25
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'win32-pipe'
|
5
|
+
spec.version = '0.3.0'
|
6
|
+
spec.author = 'Daniel J. Berger'
|
7
|
+
spec.license = 'Artistic 2.0'
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
9
|
+
spec.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
10
|
+
spec.summary = 'An interface for named pipes on MS Windows'
|
11
|
+
spec.test_files = Dir['test/test_*.rb']
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
+
|
14
|
+
spec.rubyforge_project = 'win32utils'
|
15
|
+
spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
16
|
+
|
17
|
+
spec.add_dependency('ffi')
|
18
|
+
spec.add_development_dependency('test-unit')
|
19
|
+
|
20
|
+
spec.description = <<-EOF
|
21
|
+
The win32-pipe library provides an interface for named pipes on Windows.
|
22
|
+
A named pipe is a named, one-way or duplex pipe for communication
|
23
|
+
between the pipe server and one or more pipe clients.
|
24
|
+
EOF
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-pipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,30 +9,40 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
15
|
+
name: ffi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: test-unit
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
37
|
+
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description: ! " The win32-pipe library provides an interface for named pipes on
|
37
47
|
Windows.\n A named pipe is a named, one-way or duplex pipe for communication\n
|
38
48
|
\ between the pipe server and one or more pipe clients. \n"
|
@@ -51,6 +61,8 @@ files:
|
|
51
61
|
- examples/example_server_async.rb
|
52
62
|
- lib/win32/pipe/client.rb
|
53
63
|
- lib/win32/pipe/server.rb
|
64
|
+
- lib/win32/pipe/windows/constants.rb
|
65
|
+
- lib/win32/pipe/windows/functions.rb
|
54
66
|
- lib/win32/pipe.rb
|
55
67
|
- MANIFEST
|
56
68
|
- Rakefile
|
@@ -80,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
92
|
version: '0'
|
81
93
|
requirements: []
|
82
94
|
rubyforge_project: win32utils
|
83
|
-
rubygems_version: 1.8.
|
95
|
+
rubygems_version: 1.8.24
|
84
96
|
signing_key:
|
85
97
|
specification_version: 3
|
86
98
|
summary: An interface for named pipes on MS Windows
|