ruby-net-nntp 0.2.1 → 0.2.2
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/CHANGELOG +22 -1
- data/README +6 -0
- data/lib/net/nntp.rb +9 -1
- data/lib/net/nntp/version.rb +1 -1
- data/test/functional/test_nntp.rb +16 -0
- data/test/mock/mock_socket.rb +9 -2
- metadata +59 -52
data/CHANGELOG
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
|
1
|
+
2008-01-17 15:01 +0100 Anton 'tony' Bangratz <tony@twincode.net> (e2a61a62dc59 [tip])
|
2
|
+
|
3
|
+
* .autotest, README, lib/net/nntp.rb, lib/net/nntp/version.rb, tags,
|
4
|
+
test/functional/test_nntp.rb, test/mock/mock_socket.rb:
|
5
|
+
doc fix, connected? method, code coverage
|
6
|
+
|
7
|
+
* added some documentation, fixed doc error for 'raw'
|
8
|
+
response
|
9
|
+
* added acknowledgments to documentation
|
10
|
+
* added connected? method
|
11
|
+
* added more tests for better coverage
|
12
|
+
|
13
|
+
2007-11-19 12:12 +0100 Anton 'tony' Bangratz <anton.bangratz@gmail.com> (75b6c0f1fefa)
|
14
|
+
|
15
|
+
* lib/net/nntp/article.rb, lib/net/nntp/version.rb, tags,
|
16
|
+
test/unit/test_nntp_article.rb:
|
17
|
+
Bugfix release
|
18
|
+
|
19
|
+
- fixed header parsing, closing #2
|
20
|
+
- fixed body parsing bug, closing #4
|
21
|
+
|
22
|
+
2007-08-22 17:00 +0200 Anton 'tony' Bangratz <anton.bangratz@gmail.com> (1eb71d8b00b4)
|
2
23
|
|
3
24
|
* lib/net/nntp.rb, lib/net/nntp/version.rb,
|
4
25
|
test/functional/test_nntp.rb:
|
data/README
CHANGED
@@ -38,3 +38,9 @@ to avoid conflicts with Object#id.
|
|
38
38
|
|
39
39
|
Additionally, on request, Net::NNTP::Article has been changed from being a mere proxy for Net::NNTP#xover
|
40
40
|
result lines to being able to parse HEAD, BODY and ARTICLE results and return a corresponding instance.
|
41
|
+
|
42
|
+
== Acknowledgments
|
43
|
+
|
44
|
+
Thanks to Ward Bekker and Geff Hanoian for finding and fixing bugs and providing me with useful hints and enhancements.
|
45
|
+
Thanks to J�rgen Strobel for providing support and hosting of the code libraries and bug tracking system. Thanks to Tom
|
46
|
+
Copeland and Rich Kilmer for rubyforge, and big thanks to Matz and everyone of the core team for Ruby.
|
data/lib/net/nntp.rb
CHANGED
@@ -65,6 +65,11 @@ module Net
|
|
65
65
|
@welcome
|
66
66
|
end
|
67
67
|
|
68
|
+
# Checks if socket is still valid and connected
|
69
|
+
def connected?
|
70
|
+
@socket && !@socket.closed?
|
71
|
+
end
|
72
|
+
|
68
73
|
# Sends QUIT command to server and closes the connection (unless force_close is set to false). Returns response.
|
69
74
|
def quit(force_close=true)
|
70
75
|
send_cmd "QUIT"
|
@@ -269,7 +274,7 @@ module Net
|
|
269
274
|
end
|
270
275
|
end
|
271
276
|
|
272
|
-
# Issues 'BODY' command to NNTP server, returning raw response.
|
277
|
+
# Issues 'BODY' command to NNTP server, returning raw response as array of lines.
|
273
278
|
# options:: messageid|id
|
274
279
|
#
|
275
280
|
# Throws CommandFailedError
|
@@ -350,6 +355,9 @@ module Net
|
|
350
355
|
@socket.write(cmd+"\r\n")
|
351
356
|
end
|
352
357
|
|
358
|
+
# Reads response from server socket. On multiline responses according to RFC, the response will be returned as an
|
359
|
+
# array of lines, else as an array including the response on one line. Parameter force_online can be used to
|
360
|
+
# override this behaviour and just read one line from the server.
|
353
361
|
def read_response(force_oneline=false)
|
354
362
|
response = ''
|
355
363
|
str = ''
|
data/lib/net/nntp/version.rb
CHANGED
@@ -37,9 +37,25 @@ module TestNet
|
|
37
37
|
def test_connect
|
38
38
|
assert_nothing_raised do
|
39
39
|
@nntp.connect
|
40
|
+
assert @nntp.connected?
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
44
|
+
def test_close
|
45
|
+
assert_nothing_raised do
|
46
|
+
@nntp.connect
|
47
|
+
assert @nntp.connected?
|
48
|
+
@nntp.close
|
49
|
+
assert !@nntp.connected?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_quit
|
54
|
+
@nntp.connect
|
55
|
+
quit = @nntp.quit.join
|
56
|
+
assert_equal '200', quit[0..2]
|
57
|
+
end
|
58
|
+
|
43
59
|
def test_response_timeout
|
44
60
|
assert_equal 10, @nntp.response_timeout
|
45
61
|
@nntp.response_timeout = 11
|
data/test/mock/mock_socket.rb
CHANGED
@@ -6,11 +6,18 @@ class MockSocket < Test::Unit::MockObject( TCPSocket )
|
|
6
6
|
@authenticated = false
|
7
7
|
@group_selected = nil
|
8
8
|
@last_article = nil
|
9
|
+
@is_closed = false
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
|
+
|
13
|
+
def closed?
|
14
|
+
super
|
15
|
+
@is_closed
|
16
|
+
end
|
17
|
+
|
18
|
+
def close
|
12
19
|
super
|
13
|
-
true
|
20
|
+
@is_closed=true
|
14
21
|
end
|
15
22
|
|
16
23
|
def recv(len)
|
metadata
CHANGED
@@ -1,38 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: ruby-net-nntp
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2007-11-19 00:00:00 +01:00
|
8
|
-
summary: Net::XXX style NNTP Library for easy access.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: anton.bangratz@gmail.com
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
14
|
-
description: ""
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.2.2
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Anton Bangratz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-01-17 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: log4r
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
version:
|
24
|
+
description: ""
|
25
|
+
email: anton.bangratz@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- README
|
32
|
+
- CHANGELOG
|
33
|
+
- MIT-LICENSE
|
31
34
|
files:
|
32
35
|
- lib/net
|
33
36
|
- lib/net/nntp
|
34
|
-
- lib/net/nntp/group.rb
|
35
37
|
- lib/net/nntp/article.rb
|
38
|
+
- lib/net/nntp/group.rb
|
36
39
|
- lib/net/nntp/version.rb
|
37
40
|
- lib/net/nntp.rb
|
38
41
|
- test/functional
|
@@ -40,41 +43,45 @@ files:
|
|
40
43
|
- test/mock
|
41
44
|
- test/mock/mock_socket.rb
|
42
45
|
- test/unit
|
43
|
-
- test/unit/test_nntp_group.rb
|
44
46
|
- test/unit/test_nntp_article.rb
|
47
|
+
- test/unit/test_nntp_group.rb
|
45
48
|
- README
|
46
49
|
- CHANGELOG
|
47
50
|
- MIT-LICENSE
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
- test/mock
|
52
|
-
- test/mock/mock_socket.rb
|
53
|
-
- test/unit
|
54
|
-
- test/unit/test_nntp_group.rb
|
55
|
-
- test/unit/test_nntp_article.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage:
|
53
|
+
post_install_message:
|
56
54
|
rdoc_options:
|
57
55
|
- -S
|
58
56
|
- -N
|
59
57
|
- --main
|
60
58
|
- README
|
61
|
-
|
62
|
-
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
69
73
|
requirements: []
|
70
74
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.0.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: Net::XXX style NNTP Library for easy access.
|
80
|
+
test_files:
|
81
|
+
- test/functional
|
82
|
+
- test/functional/test_nntp.rb
|
83
|
+
- test/mock
|
84
|
+
- test/mock/mock_socket.rb
|
85
|
+
- test/unit
|
86
|
+
- test/unit/test_nntp_article.rb
|
87
|
+
- test/unit/test_nntp_group.rb
|