net-ping 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.1.1 - 15-Jun-2006
2
+ * Fixed a bug in PingTCP (bad variable name). Thanks go to Anoop Chandran
3
+ for the spot.
4
+ * Minor variable name refactoring.
5
+ * Minor test updates.
6
+
1
7
  == 1.1.0 - 17-Jul-2005
2
8
  * Fixed a bug in the PingHTTP#ping method where I was accidentally passing
3
9
  the timeout value instead of the port number as the third argument to
data/doc/ping.txt CHANGED
@@ -201,5 +201,5 @@ Ping#warning
201
201
 
202
202
  == Author
203
203
  Daniel J. Berger
204
- djberg96 at yahoo dot com
204
+ djberg96 at gmail dot com
205
205
  imperator on IRC (irc.freenode.net)
data/lib/net/ping.rb CHANGED
@@ -4,7 +4,7 @@ require "timeout"
4
4
  module Net
5
5
  # An abstract base class. Do not instantiate directly.
6
6
  class Ping
7
- VERSION = "1.1.0"
7
+ VERSION = "1.1.1"
8
8
  attr_accessor :host, :port, :timeout
9
9
  attr_reader :exception, :warning
10
10
 
@@ -60,27 +60,27 @@ module Net
60
60
  def ping
61
61
  super
62
62
  success = false
63
- t = nil
63
+ tcp = nil
64
64
  begin
65
65
  Timeout.timeout(@timeout){
66
66
  begin
67
- t = TCPSocket.new(@host,@port)
68
- rescue Errno::ECONNREFUSED => e
67
+ tcp = TCPSocket.new(@host,@port)
68
+ rescue Errno::ECONNREFUSED => err
69
69
  if @@econnrefused == true
70
70
  success = true
71
71
  else
72
- @exception = e
72
+ @exception = err
73
73
  end
74
- rescue Exception => e
75
- @exception = e
74
+ rescue Exception => err
75
+ @exception = err
76
76
  else
77
77
  success = true
78
78
  end
79
79
  }
80
- rescue TimeoutError => t
81
- @exception = t
80
+ rescue Timeout::Error => err
81
+ @exception = err
82
82
  ensure
83
- t.close if t
83
+ tcp.close if tcp
84
84
  end
85
85
  success
86
86
  end
@@ -100,22 +100,22 @@ module Net
100
100
  def ping
101
101
  super
102
102
  success = false
103
- u = UDPSocket.open
103
+ udp = UDPSocket.open
104
104
  a = []
105
105
  begin
106
106
  Timeout.timeout(@timeout){
107
- u.connect(@host,@port)
108
- u.send(@data,0)
109
- a = u.recvfrom(64)
107
+ udp.connect(@host, @port)
108
+ udp.send(@data, 0)
109
+ a = udp.recvfrom(64)
110
110
  }
111
- rescue Exception => e
112
- @exception = e
111
+ rescue Exception => err
112
+ @exception = err
113
113
  else
114
114
  if a[0] == @data
115
115
  success = true
116
116
  end
117
117
  ensure
118
- u.close if u
118
+ udp.close if udp
119
119
  end
120
120
  success
121
121
  end
@@ -215,8 +215,8 @@ module Net
215
215
 
216
216
  begin
217
217
  resp = HTTP.get_response(uri.host, uri.path, @port)
218
- rescue Exception => e
219
- @exception = e
218
+ rescue Exception => err
219
+ @exception = err
220
220
  else
221
221
  case resp
222
222
  when Net::HTTPSuccess, Net::HTTPOK
@@ -23,7 +23,7 @@ class TC_PingExternal < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  def test_version
26
- assert_equal("1.0.1", PingExternal::VERSION, "Bad version constant")
26
+ assert_equal("1.1.1", PingExternal::VERSION, "Bad version constant")
27
27
  end
28
28
 
29
29
  def test_ping
data/test/tc_pinghttp.rb CHANGED
@@ -22,7 +22,7 @@ class TC_PingHTTP < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  def test_version
25
- assert_equal("1.1.0", PingHTTP::VERSION, "Bad version constant")
25
+ assert_equal("1.1.1", PingHTTP::VERSION, "Bad version constant")
26
26
  end
27
27
 
28
28
  def test_ping
data/test/tc_pingtcp.rb CHANGED
@@ -21,7 +21,7 @@ class TC_PingTCP < Test::Unit::TestCase
21
21
  end
22
22
 
23
23
  def test_version
24
- assert_equal("1.0.1", PingTCP::VERSION, "Bad version constant")
24
+ assert_equal("1.1.1", PingTCP::VERSION, "Bad version constant")
25
25
  end
26
26
 
27
27
  def test_ping
@@ -32,8 +32,9 @@ class TC_PingTCP < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def test_ping_ecr_false
35
+ msg = "+this test may fail depending on your network environment+"
35
36
  PingTCP.ecr = false
36
- assert_equal(false, @tcp.ping?)
37
+ assert_equal(false, @tcp.ping?, msg)
37
38
  assert_equal(false, @tcp.exception.nil?, "Bad exception data")
38
39
  end
39
40
 
data/test/tc_pingudp.rb CHANGED
@@ -24,7 +24,7 @@ class TC_PingUDP < Test::Unit::TestCase
24
24
  end
25
25
 
26
26
  def test_version
27
- assert_equal("1.0.1", PingUDP::VERSION, "Bad version constant")
27
+ assert_equal("1.1.1", PingUDP::VERSION, "Bad version constant")
28
28
  end
29
29
 
30
30
  def test_ping
metadata CHANGED
@@ -3,11 +3,11 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: net-ping
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2005-07-18 00:00:00 -06:00
6
+ version: 1.1.1
7
+ date: 2006-06-15 00:00:00 -06:00
8
8
  summary: A ping interface for Ruby
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: djberg96@gmail.com
12
12
  homepage: http://www.rubyforge.org/projects/shards
13
13
  rubyforge_project:
@@ -18,35 +18,39 @@ bindir: bin
18
18
  has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
27
26
  signing_key:
28
27
  cert_chain:
29
28
  authors:
30
- - Daniel J. Berger
29
+ - Daniel J. Berger
31
30
  files:
32
- - lib/net/ping.rb
33
- - README
34
- - CHANGES
35
- - MANIFEST
36
- - test/tc_pingtcp.rb
37
- - test/tc_pingudp.rb
38
- - test/tc_pingexternal.rb
39
- - test/ts_ping.rb
40
- - test/tc_pinghttp.rb
41
- - doc/ping.txt
31
+ - lib/net/ping.rb
32
+ - README
33
+ - CHANGES
34
+ - MANIFEST
35
+ - test/tc_pingtcp.rb
36
+ - test/tc_pingudp.rb
37
+ - test/tc_pingexternal.rb
38
+ - test/ts_ping.rb
39
+ - test/tc_pinghttp.rb
40
+ - doc/ping.txt
42
41
  test_files:
43
- - test/ts_ping.rb
42
+ - test/ts_ping.rb
44
43
  rdoc_options: []
44
+
45
45
  extra_rdoc_files:
46
- - README
47
- - CHANGES
48
- - doc/ping.txt
46
+ - README
47
+ - CHANGES
48
+ - doc/ping.txt
49
49
  executables: []
50
+
50
51
  extensions: []
52
+
51
53
  requirements: []
52
- dependencies: []
54
+
55
+ dependencies: []
56
+