net-ping 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzI5NjJkYzk2MzJmZjlhYzg1NWM1MTU1Y2M2NWIyNDczMDBjZTcwNQ==
5
+ data.tar.gz: !binary |-
6
+ ZWNmMzY1MzJkYTk5MmFmMWI0NDQ3Y2NiNTZhYjkwZTIzYjMxYTVmNw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTBhYTQ3NjgyNWJhZWY0NzdlZThlY2M1YjE0MzIzNjQ0ZTQ2M2Y4OWZhNTY2
10
+ MWMzZmYwMTcxYjJmMDFmNjk3YWI0Mzk0NDlkNmUxOGZhZGFhZmFkMzJhZWNk
11
+ ZDVjNjNiZTE3OTAxZGQ3NDEyNTRlMjFkM2JmOTg2ZTA1ZmNkMWY=
12
+ data.tar.gz: !binary |-
13
+ MjdjMGEzZDM1YzAwMWVmN2M1YWQwYjY3MTMzNjViMGM0Yjc4ZWM4ODk4MzY0
14
+ MDc2MzI1NGI2NzU1ODZiMGExMGE3ZTYwY2RjZjEzYzk0MWE4ZWNkM2FkZDBh
15
+ MDRlMjIzYTA2ZDU4ZGYyMmU4MDM3ZDM3MWNlN2Y1OWJlZjEyMTU=
data/CHANGES CHANGED
@@ -1,6 +1,23 @@
1
+ == 1.6.1 - 17-Jul-2013
2
+ * Automatically set the scheme to "http" if not present when performing
3
+ HTTP pings. See https://bugs.ruby-lang.org/issues/8645 for an issue
4
+ with the uri library that led to this change. Thanks go to Preston Lee
5
+ for the spot.
6
+ * Removed the windows/system_info dependency, since it added other
7
+ dependencies just to check the Windows version. Instead, I added a
8
+ helper file that adds some needed Windows functions using FFI.
9
+ * Added Rake as a development dependency and updated the Gemfile
10
+ source because Bundler. Thanks to Jean-Philippe Doyle for the patches.
11
+ * Added some warning text to the Net::Ping::External tests for users
12
+ who are using OpenDNS. In short, you will probably get test failures
13
+ and surprising true results for bad hosts.
14
+
1
15
  == 1.6.0 - 19-Mar-2013
2
16
  * Split out the ldap portion of the code into its own branch.
3
17
  * Don't require resolv-replace on Ruby 1.9.3 or later.
18
+ * Now gets proxy information from the http_proxy, https_proxy, and
19
+ no_proxy environment variables and uses that when making requests.
20
+ Thanks go to Kevin Olbrich for the patch.
4
21
 
5
22
  == 1.5.3 - 29-Feb-2012
6
23
  * Removed the Windows::Console dependency and replaced it with FFI since there
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source 'http://rubygems.org'
2
2
  gemspec
data/Rakefile CHANGED
@@ -9,7 +9,12 @@ namespace 'gem' do
9
9
  desc 'Create the net-ping gem'
10
10
  task :create => [:clean] do
11
11
  spec = eval(IO.read('net-ping.gemspec'))
12
- Gem::Builder.new(spec).build
12
+ if Gem::VERSION.to_f < 2.0
13
+ Gem::Builder.new(spec).build
14
+ else
15
+ require 'rubygems/package'
16
+ Gem::Package.build(spec)
17
+ end
13
18
  end
14
19
 
15
20
  desc 'Install the net-ping gem'
@@ -0,0 +1,31 @@
1
+ require 'ffi'
2
+
3
+ module Windows
4
+ extend FFI::Library
5
+ ffi_lib :kernel32
6
+
7
+ attach_function :GetVersion, [], :ulong
8
+
9
+ def version
10
+ version = GetVersion()
11
+ major = LOBYTE(LOWORD(version))
12
+ minor = HIBYTE(LOWORD(version))
13
+ eval("Float(#{major}.#{minor})")
14
+ end
15
+
16
+ private
17
+
18
+ def LOWORD(l)
19
+ l & 0xffff
20
+ end
21
+
22
+ def LOBYTE(w)
23
+ w & 0xff
24
+ end
25
+
26
+ def HIBYTE(w)
27
+ w >> 8
28
+ end
29
+
30
+ module_function :version
31
+ end
data/lib/net/ping/http.rb CHANGED
@@ -64,11 +64,16 @@ module Net
64
64
  # response is considered a failed ping.
65
65
  #
66
66
  # If no file or path is specified in the URI, then '/' is assumed.
67
+ # If no scheme is present in the URI, then 'http' is assumed.
67
68
  #
68
69
  def ping(host = @host)
69
70
  super(host)
70
71
  bool = false
71
- uri = URI.parse(host)
72
+
73
+ # See https://bugs.ruby-lang.org/issues/8645
74
+ host = "http://#{host}" unless host.include?("http")
75
+
76
+ uri = URI.parse(host)
72
77
 
73
78
  start_time = Time.now
74
79
 
data/lib/net/ping/icmp.rb CHANGED
@@ -2,8 +2,7 @@ require File.join(File.dirname(__FILE__), 'ping')
2
2
 
3
3
  if File::ALT_SEPARATOR
4
4
  require 'win32/security'
5
- require 'windows/system_info'
6
- include Windows::SystemInfo
5
+ require File.join(File.dirname(__FILE__), 'helper')
7
6
  end
8
7
 
9
8
  # The Net module serves as a namespace only.
@@ -32,7 +31,7 @@ module Net
32
31
  def initialize(host=nil, port=nil, timeout=5)
33
32
  raise 'requires root privileges' if Process.euid > 0
34
33
 
35
- if File::ALT_SEPARATOR && windows_version >= 6
34
+ if File::ALT_SEPARATOR && Windows.version >= 6
36
35
  unless Win32::Security.elevated_security?
37
36
  raise 'requires elevated security'
38
37
  end
data/lib/net/ping/ping.rb CHANGED
@@ -10,7 +10,7 @@ module Net
10
10
  #
11
11
  class Ping
12
12
  # The version of the net-ping library.
13
- VERSION = '1.6.0'
13
+ VERSION = '1.6.1'
14
14
 
15
15
  # The host to ping. In the case of Ping::HTTP, this is the URI.
16
16
  attr_accessor :host
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 = '1.6.0'
6
+ spec.version = '1.6.1'
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.author = 'Daniel J. Berger'
9
9
  spec.email = 'djberg96@gmail.com'
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency('test-unit', '>= 2.5.0')
21
21
  spec.add_development_dependency('fakeweb', '>= 1.3.0')
22
+ spec.add_development_dependency('rake')
22
23
 
23
24
  if File::ALT_SEPARATOR && RUBY_PLATFORM != 'java'
24
25
  spec.platform = Gem::Platform::CURRENT
@@ -28,7 +28,7 @@ end
28
28
 
29
29
  class TC_Net_Ping < Test::Unit::TestCase
30
30
  def test_net_ping_version
31
- assert_equal('1.6.0', Net::Ping::VERSION)
31
+ assert_equal('1.6.1', Net::Ping::VERSION)
32
32
  end
33
33
  end
34
34
 
@@ -3,6 +3,10 @@
3
3
  #
4
4
  # Test case for the Net::PingExternal class. Run this via the 'test' or
5
5
  # 'test:external' rake task.
6
+ #
7
+ # WARNING: I've noticed that test failures will occur if you're using
8
+ # OpenDNS. This is apparently caused by them messing with upstream
9
+ # replies for advertising purposes.
6
10
  #########################################################################
7
11
  require 'test-unit'
8
12
  require 'net/ping/external'
@@ -11,9 +11,9 @@ include Net
11
11
 
12
12
  class TC_Ping_WMI < Test::Unit::TestCase
13
13
  def self.startup
14
- @@windows = Config::CONFIG['host_os'] =~ /mswin|win32|dos|cygwin|mingw/i
14
+ @@windows = File::ALT_SEPARATOR
15
15
  end
16
-
16
+
17
17
  def setup
18
18
  @host = "www.ruby-lang.org"
19
19
  @wmi = Ping::WMI.new(@host) if @@windows
@@ -52,11 +52,11 @@ class TC_Ping_WMI < Test::Unit::TestCase
52
52
  assert_boolean(@wmi.ping?)
53
53
  assert_boolean(@wmi.ping?(@host))
54
54
  end
55
-
55
+
56
56
  def test_ping_expected_failure
57
57
  omit_unless(@@windows, 'skipped on Unix platforms')
58
58
  assert_false(Ping::WMI.new('bogus').ping?)
59
- assert_false(Ping::WMI.new('http://www.asdfhjklasdfhlkj.com').ping?)
59
+ assert_false(Ping::WMI.new('http://www.asdfhjklasdfhlkj.com').ping?)
60
60
  end
61
61
 
62
62
  def test_exception
@@ -74,7 +74,7 @@ class TC_Ping_WMI < Test::Unit::TestCase
74
74
  @host = nil
75
75
  @wmi = nil
76
76
  end
77
-
77
+
78
78
  def self.shutdown
79
79
  @@windows = nil
80
80
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
5
- prerelease:
4
+ version: 1.6.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel J. Berger
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-19 00:00:00.000000000 Z
11
+ date: 2013-07-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: ffi
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: test-unit
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: fakeweb
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,11 +48,24 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
62
69
  description: ! " The net-ping library provides a ping interface for Ruby. It includes\n
63
70
  \ separate TCP, HTTP, LDAP, ICMP, UDP, WMI (for Windows) and external ping\n classes.\n"
64
71
  email: djberg96@gmail.com
@@ -69,56 +76,56 @@ extra_rdoc_files:
69
76
  - CHANGES
70
77
  - doc/ping.txt
71
78
  files:
79
+ - CHANGES
72
80
  - doc/ping.txt
73
- - test/test_net_ping_tcp.rb
74
- - test/test_net_ping_http.rb
75
- - test/test_net_ping_udp.rb
76
- - test/test_net_ping_external.rb
77
- - test/test_net_ping_icmp.rb
78
- - test/test_net_ping.rb
79
- - test/test_net_ping_wmi.rb
81
+ - examples/example_pingexternal.rb
82
+ - examples/example_pinghttp.rb
83
+ - examples/example_pingtcp.rb
84
+ - examples/example_pingudp.rb
80
85
  - Gemfile
81
- - Rakefile
82
- - net-ping.gemspec
83
- - MANIFEST
84
- - CHANGES
85
- - lib/net/ping.rb
86
- - lib/net/ping/tcp.rb
87
- - lib/net/ping/icmp.rb
88
- - lib/net/ping/ping.rb
89
- - lib/net/ping/wmi.rb
90
86
  - lib/net/ping/external.rb
87
+ - lib/net/ping/helper.rb
91
88
  - lib/net/ping/http.rb
89
+ - lib/net/ping/icmp.rb
90
+ - lib/net/ping/ping.rb
91
+ - lib/net/ping/tcp.rb
92
92
  - lib/net/ping/udp.rb
93
+ - lib/net/ping/wmi.rb
94
+ - lib/net/ping.rb
95
+ - MANIFEST
96
+ - net-ping.gemspec
97
+ - Rakefile
93
98
  - README
94
- - examples/example_pingtcp.rb
95
- - examples/example_pingexternal.rb
96
- - examples/example_pingudp.rb
97
- - examples/example_pinghttp.rb
99
+ - test/test_net_ping.rb
100
+ - test/test_net_ping_external.rb
101
+ - test/test_net_ping_http.rb
102
+ - test/test_net_ping_icmp.rb
103
+ - test/test_net_ping_tcp.rb
104
+ - test/test_net_ping_udp.rb
105
+ - test/test_net_ping_wmi.rb
98
106
  homepage: https://github.com/djberg96/net-ping
99
107
  licenses:
100
108
  - Artistic 2.0
109
+ metadata: {}
101
110
  post_install_message:
102
111
  rdoc_options: []
103
112
  require_paths:
104
113
  - lib
105
114
  required_ruby_version: !ruby/object:Gem::Requirement
106
- none: false
107
115
  requirements:
108
116
  - - ! '>='
109
117
  - !ruby/object:Gem::Version
110
118
  version: '0'
111
119
  required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
120
  requirements:
114
121
  - - ! '>='
115
122
  - !ruby/object:Gem::Version
116
123
  version: '0'
117
124
  requirements: []
118
125
  rubyforge_project: shards
119
- rubygems_version: 1.8.23
126
+ rubygems_version: 2.0.3
120
127
  signing_key:
121
- specification_version: 3
128
+ specification_version: 4
122
129
  summary: A ping interface for Ruby.
123
130
  test_files:
124
131
  - test/test_net_ping.rb