net-ping 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.1.0 - 17-Jul-2005
2
+ * Fixed a bug in the PingHTTP#ping method where I was accidentally passing
3
+ the timeout value instead of the port number as the third argument to
4
+ Net::HTTP.get_response.
5
+ * The PingHTTP.new method now has a default port of 80.
6
+ * Minor doc update for PingHTTP.new.
7
+
1
8
  == 1.0.1 - 22-Jun-2005
2
9
  * Bug fix for the install.rb file. The gem is unaffected.
3
10
 
@@ -90,7 +90,7 @@ PingExternal#ping?
90
90
  ping was successful and true is returned. Otherwise, false is returned.
91
91
 
92
92
  === PingHTTP
93
- PingHTTP.new(uri, port=7, timeout=5)
93
+ PingHTTP.new(uri, port=80, timeout=5)
94
94
  Creates and returns a new PingHTTP object.
95
95
 
96
96
  PingHTTP#ping
@@ -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.0.1"
7
+ VERSION = "1.1.0"
8
8
  attr_accessor :host, :port, :timeout
9
9
  attr_reader :exception, :warning
10
10
 
@@ -30,7 +30,7 @@ module Net
30
30
  class PingTCP < Ping
31
31
  @@econnrefused = false
32
32
 
33
- # Returns true if the ECONNREFUSED error is to be considered a
33
+ # Returns whether or not ECONNREFUSED error is to be considered a
34
34
  # successful ping. The default is false.
35
35
  def self.econnrefused
36
36
  @@econnrefused
@@ -42,7 +42,7 @@ module Net
42
42
  end
43
43
 
44
44
  # Sets whether or not an ECONNREFUSED error should be considered a
45
- # successful ping or not.
45
+ # successful ping.
46
46
  def self.econnrefused=(bool)
47
47
  unless bool.kind_of?(TrueClass) || bool.kind_of?(FalseClass)
48
48
  raise ArgumentError, "argument must be true or false"
@@ -198,15 +198,23 @@ module Net
198
198
  require "net/http"
199
199
  require "uri"
200
200
  include Net
201
+
202
+ # Creates and returns a new PingHTTP object.
203
+ #--
204
+ # Defined separately in order to set the default port to 80.
205
+ def initialize(host, port=80, timeout=5)
206
+ super(host, port, timeout)
207
+ end
201
208
 
202
209
  # Looks for an HTTP response from the URI passed to the constructor.
203
210
  # If the result is HTTPSuccess or HTTPOK, the ping was successful.
204
211
  def ping
205
212
  super
206
213
  success = false
214
+ uri = URI.parse(@host)
207
215
 
208
216
  begin
209
- resp = HTTP.get_response(URI.parse(@host), nil, @timeout)
217
+ resp = HTTP.get_response(uri.host, uri.path, @port)
210
218
  rescue Exception => e
211
219
  @exception = e
212
220
  else
@@ -17,12 +17,12 @@ include Net
17
17
  class TC_PingHTTP < Test::Unit::TestCase
18
18
  def setup
19
19
  @uri = "http://www.pragmaticprogrammer.com/index.html"
20
- @http = PingHTTP.new(@uri)
20
+ @http = PingHTTP.new(@uri)
21
21
  @bad = PingHTTP.new("http://www.blabfoobarurgh.com")
22
22
  end
23
23
 
24
24
  def test_version
25
- assert_equal("1.0.1", PingHTTP::VERSION, "Bad version constant")
25
+ assert_equal("1.1.0", PingHTTP::VERSION, "Bad version constant")
26
26
  end
27
27
 
28
28
  def test_ping
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.10
2
+ 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.0.1
7
- date: 2005-06-22
6
+ version: 1.1.0
7
+ date: 2005-07-18 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,37 +18,35 @@ bindir: bin
18
18
  has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
24
25
  version:
25
26
  platform: ruby
27
+ signing_key:
28
+ cert_chain:
26
29
  authors:
27
- - Daniel J. Berger
30
+ - Daniel J. Berger
28
31
  files:
29
- - lib/net/ping.rb
30
- - CHANGES
31
- - MANIFEST
32
- - README
33
- - test/tc_pingexternal.rb
34
- - test/tc_pinghttp.rb
35
- - test/tc_pingtcp.rb
36
- - test/tc_pingudp.rb
37
- - test/ts_ping.rb
38
- - doc/ping.txt
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
39
42
  test_files:
40
- - test/ts_ping.rb
43
+ - test/ts_ping.rb
41
44
  rdoc_options: []
42
-
43
45
  extra_rdoc_files:
44
- - README
45
- - CHANGES
46
- - doc/ping.txt
46
+ - README
47
+ - CHANGES
48
+ - doc/ping.txt
47
49
  executables: []
48
-
49
50
  extensions: []
50
-
51
51
  requirements: []
52
-
53
- dependencies: []
54
-
52
+ dependencies: []