net-ping 1.7.8 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/lib/net/ping/external.rb +2 -4
- data/lib/net/ping/http.rb +0 -2
- data/lib/net/ping/icmp.rb +0 -5
- data/lib/net/ping/ping.rb +6 -2
- data/lib/net/ping/tcp.rb +3 -6
- data/lib/net/ping/udp.rb +0 -2
- data/net-ping.gemspec +4 -4
- data/test/test_net_ping_http.rb +4 -4
- data/test/test_net_ping_icmp.rb +7 -9
- data/test/test_net_ping_udp.rb +2 -4
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e2c148e3e4f0ac06b324b666351eb4f485e44c
|
4
|
+
data.tar.gz: b19d20fd8a675c101df2b4bffa9664800e60a7bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 226c87f3679a0e5b22a164acc01f552c43734c215a675f54cf36754149ce400c8e23fc44559cf0f902c967850ab602ed1d0ee29f43727cc0f158cddedb9f804a
|
7
|
+
data.tar.gz: 236d2377a2419d400f78260337c0e892fa7a42d4599a9d5ca3c9534a9cec0ae45865c39bc6c184667e068edff2c3274ebbbd639b8c465b241abe9b4cb57df6a9
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
net-ping (1.7.
|
4
|
+
net-ping (1.7.7)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
fakeweb (1.3.0)
|
10
|
-
power_assert (0.
|
11
|
-
rake (
|
12
|
-
test-unit (3.1
|
10
|
+
power_assert (0.3.0)
|
11
|
+
rake (11.2.2)
|
12
|
+
test-unit (3.2.1)
|
13
13
|
power_assert
|
14
14
|
|
15
15
|
PLATFORMS
|
@@ -22,4 +22,4 @@ DEPENDENCIES
|
|
22
22
|
test-unit
|
23
23
|
|
24
24
|
BUNDLED WITH
|
25
|
-
1.
|
25
|
+
1.11.2
|
data/lib/net/ping/external.rb
CHANGED
@@ -53,7 +53,6 @@ module Net
|
|
53
53
|
|
54
54
|
Open3.popen3(*pcmd) do |stdin, stdout, stderr, thread|
|
55
55
|
stdin.close
|
56
|
-
@end_time = Time.now
|
57
56
|
err = stderr.gets # Can't chomp yet, might be nil
|
58
57
|
|
59
58
|
case thread.value.exitstatus
|
@@ -91,7 +90,7 @@ module Net
|
|
91
90
|
end
|
92
91
|
|
93
92
|
# There is no duration if the ping failed
|
94
|
-
@duration =
|
93
|
+
@duration = Time.now - start_time if bool
|
95
94
|
|
96
95
|
bool
|
97
96
|
end
|
@@ -134,7 +133,6 @@ module Net
|
|
134
133
|
|
135
134
|
Open3.popen3(*pcmd) do |stdin, stdout, stderr, thread|
|
136
135
|
stdin.close
|
137
|
-
@end_time = Time.now
|
138
136
|
err = stderr.gets # Can't chomp yet, might be nil
|
139
137
|
|
140
138
|
case thread.value.exitstatus
|
@@ -172,7 +170,7 @@ module Net
|
|
172
170
|
end
|
173
171
|
|
174
172
|
# There is no duration if the ping failed
|
175
|
-
@duration =
|
173
|
+
@duration = Time.now - start_time if bool
|
176
174
|
|
177
175
|
bool
|
178
176
|
end
|
data/lib/net/ping/http.rb
CHANGED
data/lib/net/ping/icmp.rb
CHANGED
@@ -147,13 +147,8 @@ module Net
|
|
147
147
|
|
148
148
|
# There is no duration if the ping failed
|
149
149
|
@duration = Time.now - start_time if bool
|
150
|
-
|
151
|
-
return bool
|
152
150
|
end
|
153
151
|
|
154
|
-
alias ping? ping
|
155
|
-
alias pingecho ping
|
156
|
-
|
157
152
|
private
|
158
153
|
|
159
154
|
# Perform a checksum on the message. This is the sum of all the short
|
data/lib/net/ping/ping.rb
CHANGED
data/lib/net/ping/tcp.rb
CHANGED
@@ -38,7 +38,6 @@ module Net
|
|
38
38
|
super(host)
|
39
39
|
|
40
40
|
bool = false
|
41
|
-
start_time = Time.now
|
42
41
|
|
43
42
|
# Failure here most likely means bad host, so just bail.
|
44
43
|
begin
|
@@ -55,6 +54,8 @@ module Net
|
|
55
54
|
# This may not be entirely necessary
|
56
55
|
sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
57
56
|
|
57
|
+
start_time = Time.now
|
58
|
+
|
58
59
|
begin
|
59
60
|
# Where addr[0][3] is an IP address
|
60
61
|
sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))
|
@@ -95,13 +96,9 @@ module Net
|
|
95
96
|
|
96
97
|
# There is no duration if the ping failed
|
97
98
|
@duration = Time.now - start_time if bool
|
98
|
-
|
99
|
-
bool
|
100
99
|
end
|
101
100
|
|
102
|
-
|
103
|
-
alias pingecho ping
|
104
|
-
|
101
|
+
|
105
102
|
# Class method aliases. DEPRECATED.
|
106
103
|
class << self
|
107
104
|
alias econnrefused service_check
|
data/lib/net/ping/udp.rb
CHANGED
data/net-ping.gemspec
CHANGED
@@ -3,7 +3,7 @@ require 'rbconfig'
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'net-ping'
|
6
|
-
spec.version = '
|
6
|
+
spec.version = '2.0.1'
|
7
7
|
spec.license = 'Artistic 2.0'
|
8
8
|
spec.author = 'Chris Chernesky'
|
9
9
|
spec.email = 'chris.netping@tinderglow.com'
|
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# The TCP Ping class requires this for non-blocking sockets.
|
18
18
|
spec.required_ruby_version = ">= 1.9.3"
|
19
19
|
|
20
|
-
spec.add_development_dependency('test-unit')
|
21
|
-
spec.add_development_dependency('fakeweb')
|
22
|
-
spec.add_development_dependency('rake')
|
20
|
+
spec.add_development_dependency('test-unit', '~> 0')
|
21
|
+
spec.add_development_dependency('fakeweb', '~> 0')
|
22
|
+
spec.add_development_dependency('rake', '~> 0')
|
23
23
|
|
24
24
|
if File::ALT_SEPARATOR
|
25
25
|
require 'rbconfig'
|
data/test/test_net_ping_http.rb
CHANGED
@@ -71,12 +71,12 @@ class TC_Net_Ping_HTTP < Test::Unit::TestCase
|
|
71
71
|
assert_boolean(@bad.ping?)
|
72
72
|
end
|
73
73
|
|
74
|
-
test
|
75
|
-
|
74
|
+
test "ping? is inherited" do
|
75
|
+
assert_respond_to(@http, :ping?)
|
76
76
|
end
|
77
77
|
|
78
|
-
test
|
79
|
-
|
78
|
+
test "pingecho is inherited" do
|
79
|
+
assert_respond_to(@http, :pingecho)
|
80
80
|
end
|
81
81
|
|
82
82
|
test 'ping should succeed for a valid website' do
|
data/test/test_net_ping_icmp.rb
CHANGED
@@ -43,16 +43,16 @@ class TC_PingICMP < Test::Unit::TestCase
|
|
43
43
|
assert_nothing_raised{ @icmp.ping(@host) }
|
44
44
|
end
|
45
45
|
|
46
|
-
test "icmp ping returns a
|
46
|
+
test "icmp ping returns a float" do
|
47
47
|
omit_if(@@jruby)
|
48
|
-
|
49
|
-
|
48
|
+
assert_kind_of(Float, @icmp.ping)
|
49
|
+
assert_kind_of(Float, @icmp.ping(@host))
|
50
50
|
end
|
51
51
|
|
52
52
|
test "icmp ping of local host is successful" do
|
53
53
|
omit_if(@@jruby)
|
54
54
|
assert_true(Net::Ping::ICMP.new(@host).ping?)
|
55
|
-
assert_true(Net::Ping::ICMP.new('
|
55
|
+
assert_true(Net::Ping::ICMP.new('127.0.0.1').ping?)
|
56
56
|
end
|
57
57
|
|
58
58
|
test "threaded icmp ping returns expected results" do
|
@@ -78,14 +78,12 @@ class TC_PingICMP < Test::Unit::TestCase
|
|
78
78
|
threads.each{ |t| t.join }
|
79
79
|
end
|
80
80
|
|
81
|
-
test "ping? is
|
81
|
+
test "ping? is inherited" do
|
82
82
|
assert_respond_to(@icmp, :ping?)
|
83
|
-
assert_alias_method(@icmp, :ping?, :ping)
|
84
83
|
end
|
85
84
|
|
86
|
-
test "pingecho is
|
85
|
+
test "pingecho is inherited" do
|
87
86
|
assert_respond_to(@icmp, :pingecho)
|
88
|
-
assert_alias_method(@icmp, :pingecho, :ping)
|
89
87
|
end
|
90
88
|
|
91
89
|
test "icmp ping fails if host is invalid" do
|
@@ -171,7 +169,7 @@ class TC_PingICMP < Test::Unit::TestCase
|
|
171
169
|
test "setting an odd data_size is valid" do
|
172
170
|
omit_if(@@jruby)
|
173
171
|
assert_nothing_raised{ @icmp.data_size = 57 }
|
174
|
-
|
172
|
+
assert_kind_of(Float, @icmp.ping)
|
175
173
|
end
|
176
174
|
|
177
175
|
def teardown
|
data/test/test_net_ping_udp.rb
CHANGED
@@ -26,14 +26,12 @@ class TC_Net_Ping_UDP < Test::Unit::TestCase
|
|
26
26
|
assert_nothing_raised{ @udp.ping(@host) }
|
27
27
|
end
|
28
28
|
|
29
|
-
test "ping? is
|
29
|
+
test "ping? is inherited" do
|
30
30
|
assert_respond_to(@udp, :ping?)
|
31
|
-
assert_alias_method(@udp, :ping?, :ping)
|
32
31
|
end
|
33
32
|
|
34
|
-
test "pingecho is
|
33
|
+
test "pingecho is inherited" do
|
35
34
|
assert_respond_to(@udp, :pingecho)
|
36
|
-
assert_alias_method(@udp, :pingecho, :ping)
|
37
35
|
end
|
38
36
|
|
39
37
|
test "a successful udp ping returns true" do
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Chernesky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fakeweb
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: |2
|
@@ -111,9 +111,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.4.5.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: A ping interface for Ruby.
|
118
118
|
test_files:
|
119
119
|
- test/test_net_ping.rb
|
120
|
+
has_rdoc:
|