net-ping 1.2.2-x86-mswin32-60 → 1.2.3-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/MANIFEST +6 -6
- data/README +5 -0
- data/Rakefile +13 -7
- data/lib/net/ping/http.rb +2 -1
- data/lib/net/ping/icmp.rb +3 -3
- data/lib/net/ping/ping.rb +1 -1
- data/net-ping.gemspec +6 -5
- data/test/{ts_ping.rb → test_net_ping.rb} +8 -8
- data/test/{tc_pingexternal.rb → test_net_ping_external.rb} +5 -2
- data/test/{tc_pinghttp.rb → test_net_ping_http.rb} +5 -2
- data/test/{tc_pingicmp.rb → test_net_ping_icmp.rb} +31 -5
- data/test/{tc_pingtcp.rb → test_net_ping_tcp.rb} +5 -2
- data/test/{tc_pingudp.rb → test_net_ping_udp.rb} +5 -2
- metadata +25 -19
- data/net-ping-1.2.2-x86-mswin32-60.gem +0 -0
- data/net-ping.gemspec~ +0 -34
data/CHANGES
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== 1.2.3 - 13-Jan-2008
|
2
|
+
* Fixed a bug in the checksum private method where it would die on odd data
|
3
|
+
sizes. Thanks go to Jake Douglas for the spot.
|
4
|
+
* A Socket.get_sockaddr_in call in the Ping::ICMP class is no longer included
|
5
|
+
as part of the overall ping time. Thanks go again to Jake Douglas for
|
6
|
+
the spot.
|
7
|
+
* Added data_size tests to the Ping::ICMP test suite.
|
8
|
+
* Renamed and updated the test files. The test-unit 2.x gem is now a
|
9
|
+
prerequisite as a result.
|
10
|
+
|
1
11
|
== 1.2.2 - 22-Jan-2008
|
2
12
|
* Bug fix for Ping::External where it was not honoring the timeout value.
|
3
13
|
Thanks go to Chris Morris for the spot and the patch.
|
data/MANIFEST
CHANGED
@@ -13,9 +13,9 @@
|
|
13
13
|
* lib/net/ping/udp.rb
|
14
14
|
* lib/net/ping/http.rb
|
15
15
|
* lib/net/ping/external.rb
|
16
|
-
* test/
|
17
|
-
* test/
|
18
|
-
* test/
|
19
|
-
* test/
|
20
|
-
* test/
|
21
|
-
* test/
|
16
|
+
* test/test_net_ping_external.rb
|
17
|
+
* test/test_net_ping_http.rb
|
18
|
+
* test/test_net_ping_icmp.rb
|
19
|
+
* test/test_net_ping_tcp.rb
|
20
|
+
* test/test_net_ping_udp.rb
|
21
|
+
* test/test_net_ping.rb
|
data/README
CHANGED
@@ -29,3 +29,8 @@
|
|
29
29
|
The former has the advantage of being easier to remember and all inclusive,
|
30
30
|
not to mention backwards compatible. The latter has the advantage of
|
31
31
|
reducing your memory footprint.
|
32
|
+
|
33
|
+
== More documentation
|
34
|
+
If you installed this library via Rubygems, you can view the inline
|
35
|
+
documentation via ri or fire up 'gem server', and point your browser at
|
36
|
+
http://localhost:8808.
|
data/Rakefile
CHANGED
@@ -26,30 +26,36 @@ end
|
|
26
26
|
|
27
27
|
Rake::TestTask.new("test") do |t|
|
28
28
|
t.warning = true
|
29
|
-
t.
|
29
|
+
t.verbose = true
|
30
|
+
t.test_files = FileList['test/test_net_ping.rb']
|
30
31
|
end
|
31
32
|
|
32
33
|
Rake::TestTask.new("test_external") do |t|
|
33
34
|
t.warning = true
|
34
|
-
t.
|
35
|
+
t.verbose = true
|
36
|
+
t.test_files = FileList['test/test_net_ping_external.rb']
|
35
37
|
end
|
36
38
|
|
37
39
|
Rake::TestTask.new("test_http") do |t|
|
38
40
|
t.warning = true
|
39
|
-
t.
|
41
|
+
t.verbose = true
|
42
|
+
t.test_files = FileList['test/test_net_ping_http.rb']
|
40
43
|
end
|
41
44
|
|
42
45
|
Rake::TestTask.new("test_icmp") do |t|
|
43
46
|
t.warning = true
|
44
|
-
t.
|
47
|
+
t.verbose = true
|
48
|
+
t.test_files = FileList['test/test_net_ping_icmp.rb']
|
45
49
|
end
|
46
50
|
|
47
51
|
Rake::TestTask.new("test_tcp") do |t|
|
48
52
|
t.warning = true
|
49
|
-
t.
|
53
|
+
t.verbose = true
|
54
|
+
t.test_files = FileList['test/test_net_ping_tcp.rb']
|
50
55
|
end
|
51
56
|
|
52
57
|
Rake::TestTask.new("test_udp") do |t|
|
53
58
|
t.warning = true
|
54
|
-
t.
|
55
|
-
|
59
|
+
t.verbose = true
|
60
|
+
t.test_files = FileList['test/test_net_ping_udp.rb']
|
61
|
+
end
|
data/lib/net/ping/http.rb
CHANGED
@@ -2,10 +2,11 @@ $LOAD_PATH.unshift File.dirname(__FILE__)
|
|
2
2
|
require 'ping'
|
3
3
|
require 'net/http'
|
4
4
|
require 'uri'
|
5
|
+
require 'rbconfig'
|
5
6
|
|
6
7
|
# Force non-blocking Socket.getaddrinfo on Unix systems. Do not use on
|
7
8
|
# Windows because it causes problems.
|
8
|
-
unless
|
9
|
+
unless Config::CONFIG['host_os'].match('mswin')
|
9
10
|
require 'resolv-replace'
|
10
11
|
end
|
11
12
|
|
data/lib/net/ping/icmp.rb
CHANGED
@@ -82,13 +82,13 @@ module Net
|
|
82
82
|
checksum = checksum(msg)
|
83
83
|
msg = [ICMP_ECHO, ICMP_SUBCODE, checksum, @pid, @seq, @data].pack(pstring)
|
84
84
|
|
85
|
-
start_time = Time.now
|
86
|
-
|
87
85
|
begin
|
88
86
|
saddr = Socket.pack_sockaddr_in(0, host)
|
89
87
|
rescue Exception
|
90
88
|
return bool
|
91
89
|
end
|
90
|
+
|
91
|
+
start_time = Time.now
|
92
92
|
|
93
93
|
socket.send(msg, 0, saddr) # Send the message
|
94
94
|
|
@@ -152,7 +152,7 @@ module Net
|
|
152
152
|
end
|
153
153
|
|
154
154
|
if length % 2 > 0
|
155
|
-
check += msg[length-1, 1].unpack('C') << 8
|
155
|
+
check += msg[length-1, 1].unpack('C').first << 8
|
156
156
|
end
|
157
157
|
|
158
158
|
check = (check >> 16) + (check & 0xffff)
|
data/lib/net/ping/ping.rb
CHANGED
data/net-ping.gemspec
CHANGED
@@ -2,24 +2,25 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
4
|
gem.name = "net-ping"
|
5
|
-
gem.version = "1.2.
|
5
|
+
gem.version = "1.2.3"
|
6
6
|
gem.author = "Daniel J. Berger"
|
7
7
|
gem.email = "djberg96@gmail.com"
|
8
8
|
gem.homepage = "http://www.rubyforge.org/projects/shards"
|
9
9
|
gem.summary = "A ping interface for Ruby."
|
10
|
-
gem.test_file = "test/
|
10
|
+
gem.test_file = "test/test_net_ping.rb"
|
11
11
|
gem.has_rdoc = true
|
12
12
|
gem.rubyforge_project = "shards"
|
13
13
|
gem.files = Dir["lib/net/*"] + Dir['[A-Z]*'] + Dir['test/*']
|
14
14
|
gem.files += Dir["lib/net/ping/*"]
|
15
15
|
gem.files.reject! { |fn| fn.include? "CVS" }
|
16
16
|
gem.extra_rdoc_files = ["README", "CHANGES", "doc/ping.txt"]
|
17
|
+
gem.add_dependency('test-unit', '>= 2.0.2')
|
17
18
|
|
18
19
|
case RUBY_PLATFORM
|
19
20
|
when /mswin/i
|
20
21
|
gem.platform = Gem::Platform::CURRENT
|
21
|
-
gem.add_dependency('
|
22
|
-
gem.add_dependency('
|
22
|
+
gem.add_dependency('windows-pr', '>= 0.9.8') # Net::Ping::External
|
23
|
+
gem.add_dependency('win32-open3', '>= 0.2.7') # Net::Ping::External
|
23
24
|
else
|
24
25
|
gem.platform = Gem::Platform::RUBY
|
25
26
|
end
|
@@ -30,6 +31,6 @@ spec = Gem::Specification.new do |gem|
|
|
30
31
|
end
|
31
32
|
|
32
33
|
if $0 == __FILE__
|
33
|
-
Gem.manage_gems
|
34
|
+
Gem.manage_gems if Gem::RubyGemsVersion.to_f > 1.0
|
34
35
|
Gem::Builder.new(spec).build
|
35
36
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
######################################################################
|
2
|
-
#
|
2
|
+
# test_net_ping.rb
|
3
3
|
#
|
4
4
|
# Test suite for all the Ping subclasses. Note that the PingICMP
|
5
5
|
# class test won't be run unless this is run as a privileged process.
|
6
6
|
######################################################################
|
7
7
|
$LOAD_PATH.unshift(Dir.pwd)
|
8
|
-
$LOAD_PATH.unshift(Dir.pwd
|
9
|
-
$LOAD_PATH.unshift(Dir.pwd
|
8
|
+
$LOAD_PATH.unshift(File.join(Dir.pwd, 'lib'))
|
9
|
+
$LOAD_PATH.unshift(File.join(Dir.pwd, 'test'))
|
10
10
|
|
11
|
-
require "
|
12
|
-
require "
|
13
|
-
require "
|
14
|
-
require "
|
11
|
+
require "test_net_ping_external"
|
12
|
+
require "test_net_ping_http"
|
13
|
+
require "test_net_ping_tcp"
|
14
|
+
require "test_net_ping_udp"
|
15
15
|
|
16
16
|
if Process.euid == 0
|
17
|
-
require "
|
17
|
+
require "test_net_ping_icmp"
|
18
18
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
#########################################################################
|
2
|
-
#
|
2
|
+
# test_net_ping_external.rb
|
3
3
|
#
|
4
4
|
# Test case for the Net::PingExternal class. Run this via the 'test' or
|
5
5
|
# 'test_external' rake task.
|
6
6
|
#########################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
|
7
10
|
require 'test/unit'
|
8
11
|
require 'net/ping/external'
|
9
12
|
include Net
|
@@ -17,7 +20,7 @@ class TC_PingExternal < Test::Unit::TestCase
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def test_version
|
20
|
-
assert_equal('1.2.
|
23
|
+
assert_equal('1.2.3', PingExternal::VERSION)
|
21
24
|
end
|
22
25
|
|
23
26
|
def test_ping
|
@@ -1,9 +1,12 @@
|
|
1
1
|
#################################################################################
|
2
|
-
#
|
2
|
+
# test_net_ping_http.rb
|
3
3
|
#
|
4
4
|
# Test case for the Net::PingHTTP class. This should be run via the 'test' or
|
5
5
|
# 'test_http' test task.
|
6
6
|
#################################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
|
7
10
|
require 'test/unit'
|
8
11
|
require 'net/ping/http'
|
9
12
|
include Net
|
@@ -16,7 +19,7 @@ class TC_PingHTTP < Test::Unit::TestCase
|
|
16
19
|
end
|
17
20
|
|
18
21
|
def test_version
|
19
|
-
assert_equal('1.2.
|
22
|
+
assert_equal('1.2.3', Ping::HTTP::VERSION)
|
20
23
|
end
|
21
24
|
|
22
25
|
def test_ping
|
@@ -1,10 +1,13 @@
|
|
1
1
|
#######################################################################
|
2
|
-
#
|
2
|
+
# test_net_ping_icmp.rb
|
3
3
|
#
|
4
4
|
# Test case for the Net::PingICMP class. You must run this test case
|
5
5
|
# with root privileges on UNIX systems. This should be run via the
|
6
6
|
# 'test' or 'test_icmp' Rake task.
|
7
7
|
#######################################################################
|
8
|
+
require 'rubygems'
|
9
|
+
gem 'test-unit'
|
10
|
+
|
8
11
|
require 'test/unit'
|
9
12
|
require 'net/ping/icmp'
|
10
13
|
include Net
|
@@ -20,7 +23,7 @@ class TC_PingICMP < Test::Unit::TestCase
|
|
20
23
|
end
|
21
24
|
|
22
25
|
def test_version
|
23
|
-
assert_equal('1.2.
|
26
|
+
assert_equal('1.2.3', PingICMP::VERSION)
|
24
27
|
end
|
25
28
|
|
26
29
|
def test_ping
|
@@ -29,13 +32,21 @@ class TC_PingICMP < Test::Unit::TestCase
|
|
29
32
|
assert_nothing_raised{ @icmp.ping(@host) }
|
30
33
|
end
|
31
34
|
|
32
|
-
def
|
35
|
+
def test_ping_aliases_basic
|
33
36
|
assert_respond_to(@icmp, :ping?)
|
34
37
|
assert_respond_to(@icmp, :pingecho)
|
35
38
|
assert_nothing_raised{ @icmp.ping? }
|
36
39
|
assert_nothing_raised{ @icmp.ping?(@host) }
|
37
|
-
|
38
|
-
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_ping_returns_boolean
|
43
|
+
assert_boolean(@icmp.pingecho)
|
44
|
+
assert_boolean(@icmp.pingecho(@host))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_ping_expected_failure
|
48
|
+
assert_false(Ping::ICMP.new('bogus').ping?)
|
49
|
+
assert_false(Ping::ICMP.new('http://www.asdfhjklasdfhlkj.com').ping?)
|
39
50
|
end
|
40
51
|
|
41
52
|
def test_bind
|
@@ -77,6 +88,21 @@ class TC_PingICMP < Test::Unit::TestCase
|
|
77
88
|
assert_respond_to(@icmp, :warning)
|
78
89
|
end
|
79
90
|
|
91
|
+
def test_data_size_get
|
92
|
+
assert_respond_to(@icmp, :data_size)
|
93
|
+
assert_equal(56, @icmp.data_size)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_data_size_set
|
97
|
+
assert_respond_to(@icmp, :data_size=)
|
98
|
+
assert_nothing_raised{ @icmp.data_size = 22 }
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_odd_data_size_ok
|
102
|
+
assert_nothing_raised{ @icmp.data_size = 57 }
|
103
|
+
assert_boolean(@icmp.ping)
|
104
|
+
end
|
105
|
+
|
80
106
|
def teardown
|
81
107
|
@host = nil
|
82
108
|
@icmp = nil
|
@@ -1,9 +1,12 @@
|
|
1
1
|
#####################################################################
|
2
|
-
#
|
2
|
+
# test_net_ping_tcp.rb
|
3
3
|
#
|
4
4
|
# Test case for the Net::PingTCP class. This test should be run via
|
5
5
|
# the 'test' or 'test_tcp' Rake task.
|
6
6
|
#####################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
|
7
10
|
require 'test/unit'
|
8
11
|
require 'net/ping/tcp'
|
9
12
|
include Net
|
@@ -15,7 +18,7 @@ class TC_PingTCP < Test::Unit::TestCase
|
|
15
18
|
end
|
16
19
|
|
17
20
|
def test_version
|
18
|
-
assert_equal('1.2.
|
21
|
+
assert_equal('1.2.3', PingTCP::VERSION)
|
19
22
|
end
|
20
23
|
|
21
24
|
def test_ping
|
@@ -1,5 +1,5 @@
|
|
1
1
|
################################################################
|
2
|
-
#
|
2
|
+
# test_net_ping_udp.rb
|
3
3
|
#
|
4
4
|
# Test case for the Net::Ping::UDP class. This should be run
|
5
5
|
# via the 'test' or 'test_udp' Rake task.
|
@@ -7,6 +7,9 @@
|
|
7
7
|
# If someone could provide me a host where a udp ping actually
|
8
8
|
# works (with a service check), I would appreciate it. :)
|
9
9
|
################################################################
|
10
|
+
require 'rubygems'
|
11
|
+
gem 'test-unit'
|
12
|
+
|
10
13
|
require 'test/unit'
|
11
14
|
require 'net/ping/udp'
|
12
15
|
include Net
|
@@ -19,7 +22,7 @@ class TC_PingUDP < Test::Unit::TestCase
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def test_version
|
22
|
-
assert_equal('1.2.
|
25
|
+
assert_equal('1.2.3', Ping::UDP::VERSION)
|
23
26
|
end
|
24
27
|
|
25
28
|
def test_ping
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,26 +9,38 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: test-unit
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.2
|
23
|
+
version: 2.0.2
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: windows-pr
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.8
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: win32-open3
|
37
|
+
type: :runtime
|
26
38
|
version_requirement:
|
27
39
|
version_requirements: !ruby/object:Gem::Requirement
|
28
40
|
requirements:
|
29
41
|
- - ">="
|
30
42
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.7
|
43
|
+
version: 0.2.7
|
32
44
|
version:
|
33
45
|
description: A ping interface for Ruby. Includes TCP, HTTP, ICMP, UDP, and External ping interfaces.
|
34
46
|
email: djberg96@gmail.com
|
@@ -41,29 +53,23 @@ extra_rdoc_files:
|
|
41
53
|
- CHANGES
|
42
54
|
- doc/ping.txt
|
43
55
|
files:
|
44
|
-
- lib/net/CVS
|
45
56
|
- lib/net/ping
|
46
57
|
- lib/net/ping.rb
|
47
58
|
- CHANGES
|
48
|
-
- CVS
|
49
59
|
- doc
|
50
60
|
- examples
|
51
61
|
- lib
|
52
62
|
- MANIFEST
|
53
|
-
- net-ping-1.2.2-x86-mswin32-60.gem
|
54
63
|
- net-ping.gemspec
|
55
|
-
- net-ping.gemspec~
|
56
64
|
- Rakefile
|
57
65
|
- README
|
58
66
|
- test
|
59
|
-
- test/
|
60
|
-
- test/
|
61
|
-
- test/
|
62
|
-
- test/
|
63
|
-
- test/
|
64
|
-
- test/
|
65
|
-
- test/ts_ping.rb
|
66
|
-
- lib/net/ping/CVS
|
67
|
+
- test/test_net_ping.rb
|
68
|
+
- test/test_net_ping_external.rb
|
69
|
+
- test/test_net_ping_http.rb
|
70
|
+
- test/test_net_ping_icmp.rb
|
71
|
+
- test/test_net_ping_tcp.rb
|
72
|
+
- test/test_net_ping_udp.rb
|
67
73
|
- lib/net/ping/external.rb
|
68
74
|
- lib/net/ping/http.rb
|
69
75
|
- lib/net/ping/icmp.rb
|
@@ -93,9 +99,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
99
|
requirements: []
|
94
100
|
|
95
101
|
rubyforge_project: shards
|
96
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 1.3.1
|
97
103
|
signing_key:
|
98
104
|
specification_version: 2
|
99
105
|
summary: A ping interface for Ruby.
|
100
106
|
test_files:
|
101
|
-
- test/
|
107
|
+
- test/test_net_ping.rb
|
File without changes
|
data/net-ping.gemspec~
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
|
3
|
-
spec = Gem::Specification.new do |gem|
|
4
|
-
gem.name = "net-ping"
|
5
|
-
gem.version = "1.2.2"
|
6
|
-
gem.author = "Daniel J. Berger"
|
7
|
-
gem.email = "djberg96@gmail.com"
|
8
|
-
gem.homepage = "http://www.rubyforge.org/projects/shards"
|
9
|
-
gem.summary = "A ping interface for Ruby."
|
10
|
-
gem.test_file = "test/ts_ping.rb"
|
11
|
-
gem.has_rdoc = true
|
12
|
-
gem.files = Dir["lib/net/*"] + Dir['[A-Z]*'] + Dir['test/*']
|
13
|
-
gem.files += Dir["lib/net/ping/*"]
|
14
|
-
gem.files.reject! { |fn| fn.include? "CVS" }
|
15
|
-
gem.extra_rdoc_files = ["README", "CHANGES", "doc/ping.txt"]
|
16
|
-
|
17
|
-
case RUBY_PLATFORM
|
18
|
-
when /mswin/i
|
19
|
-
gem.platform = Gem::Platform::CURRENT
|
20
|
-
gem.add_dependency('win32-open3', '>= 0.2.5') # Ping::External
|
21
|
-
gem.add_dependency('windows-pr', '>= 0.7.4') # Ping::External
|
22
|
-
else
|
23
|
-
gem.platform = Gem::Platform::RUBY
|
24
|
-
end
|
25
|
-
|
26
|
-
description = "A ping interface for Ruby. Includes TCP, HTTP, ICMP, UDP, "
|
27
|
-
description << "and External ping interfaces."
|
28
|
-
gem.description = description
|
29
|
-
end
|
30
|
-
|
31
|
-
if $0 == __FILE__
|
32
|
-
Gem.manage_gems
|
33
|
-
Gem::Builder.new(spec).build
|
34
|
-
end
|