sys-host 0.5.2-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES ADDED
@@ -0,0 +1,95 @@
1
+ == 0.5.2 - 27-Jun-2006
2
+ * Added the Host.info method for Linux.
3
+
4
+ == 0.5.1 - 3-Mar-2006
5
+ * The Host.info method is now supported on Solaris.
6
+ * Moved project to RubyForge.
7
+ * Replaced INSTALL with README.
8
+ * Made documentation rdoc friendly.
9
+
10
+ == 0.5.0 - 3-Jul-2004
11
+ * Replaced Windows C extension with pure Ruby version, using WMI + OLE.
12
+ * Added an additional class method called 'info' that returns a HostInfo
13
+ struct. Currently on Windows only.
14
+ * Removed the block form of Host.ip_addr. It now simply returns an Array.
15
+ * Renamed and revamped test suite.
16
+ * Moved test.rb to doc/examples
17
+ * Removed the host.html file.
18
+ * Replaced previous exception classes with a single exception class,
19
+ HostError, and moved it under the Sys module namespace.
20
+
21
+ == 0.4.0 - 15-Jun-2003
22
+ * Added MS Windows support
23
+ * Modified extconf.rb file - generic test script now in its own file
24
+ (test/test.rb) and the dynamic rd2 stuff was removed, in addition to proper
25
+ handling for MS Windows
26
+ * rd2, txt and html docs now included by default
27
+ * Removed VERSION() class method (use the constant instead)
28
+ * Added a universal constants.h file to store VERSION info, etc, that
29
+ is common to all source files.
30
+ * Added LICENSE info
31
+
32
+ == 0.3.4 - 3-Apr-2003
33
+ * Fixed a header include issue for solaris systems that don't
34
+ define inet_ntop().
35
+
36
+ == 0.3.3 * 24-Mar-2003
37
+ * If inet_ntop() is not defined, now falls back to inet_ntoa().
38
+
39
+ == 0.3.2 - 14-Mar-2003
40
+ * Added a VERSION constant
41
+ * Modified extconf.rb script, including a bugfix for solaris
42
+ * Added a test suite (for those with testunit installed)
43
+ * Removed the sys-uname requirement
44
+ * Changelog and Manifest are now CHANGES and MANIFEST, respectively
45
+ * Minor internal layout changes
46
+ * rd2 documentation removed from C source files and put into 'doc'
47
+ directory
48
+
49
+ == 0.3.1 - 6-Jan-2003
50
+ * Fix to make code C89 compliant so that older compilers don't choke.
51
+ * Added a VERSION class method
52
+ * Added a copyright notice
53
+ * Moved README into doc/host.txt
54
+ * Minor doc changes
55
+ * Fixed extconf.rb file to include socket lib for Solaris. This was
56
+ in 0.2.0 and was mistakenly left out of 0.3.0.
57
+
58
+ == 0.3.0 - 28-Oct-2002
59
+ * Reentrant (thread-safe) support added for ip_addr() method (for Linux,
60
+ FreeBSD and Solaris currently).
61
+ * The file layout changed so that each platform has its own source file.
62
+ This was done because different platforms have different implementations
63
+ of gethostbyname_r(), if they have them at all. Some platforms (e.g.
64
+ FreeBSD) use a different function altogether.
65
+ * The file generic.c is used to create the source if the platform is not
66
+ currently supported, or if gethostbyname_r() isn't found.
67
+ * The FreeBSD implementation uses getipnodebyname() instead of
68
+ gethostbyname(), if possible. According to the man page, it's thread
69
+ safe.
70
+ * Modifications to the extconf.rb file based on the above changes.
71
+ * Added a default value of 16 for INET_ADDRSTRLEN.
72
+ * Added a README file.
73
+
74
+ == 0.2.0 - 1-Sep-2002
75
+ * Added HostException and HostAddressException classes. These are raised
76
+ in the event the gethostname or gethostbyname call fails, respectively.
77
+ * Removed some unnecessary (and warning-causing) free calls.
78
+ * Added an INSTALL file (installation instructions removed from core doc).
79
+
80
+ == 0.1.2 - 9-Aug-2002
81
+ * Got the BSD support working properly this time. Thanks to Sean
82
+ Chittenden for providing BSD access.
83
+
84
+ == 0.1.1 - 21-Jun-2002
85
+ * Fixed a bug that would cause the ip_addr to segfault on some
86
+ operating systems. Apparently ,trying to free memory on a
87
+ null pointer is a bad thing. Hey, Solaris didn't complain!
88
+ Thanks go to Han Holl for the spot.
89
+ * On *BSD systems the 'netinet/in.h' file is now included (via
90
+ the makefile). Thanks go to Magnus Stahre for the spot and
91
+ the fix.
92
+ * Changed the version number to be more "ruby compliant"
93
+
94
+ == 0.01 * 11-Jun-2002
95
+ * First release!
@@ -0,0 +1,19 @@
1
+ CHANGES
2
+ MANIFEST
3
+ INSTALL
4
+ extconf.rb
5
+ install.rb
6
+
7
+ doc/host.txt
8
+
9
+ doc/examples/test.rb
10
+
11
+ ext/constants.h
12
+ ext/freebsd.c
13
+ ext/generic.c
14
+ ext/linux.c
15
+ ext/sunos.c
16
+
17
+ lib/sys/windows.rb
18
+
19
+ test/tc_host.rb
data/README ADDED
@@ -0,0 +1,14 @@
1
+ = Prerequisites
2
+ Ruby 1.8.0 or later.
3
+ Ruby 1.8.2 or later preferred on Windows.
4
+
5
+ = Installation
6
+ == Windows
7
+ ruby test\tc_host.rb (optional)
8
+ ruby install.rb
9
+
10
+ == Unix
11
+ ruby extconf.rb
12
+ make
13
+ ruby test/tc_host.rb (optional)
14
+ make install
@@ -0,0 +1,88 @@
1
+ == Description
2
+ Provides hostname and ip address information for a given host.
3
+
4
+ == Synopsis
5
+ require 'sys/host'
6
+ include Sys
7
+
8
+ p Host.hostname
9
+ p Host.ip_addr
10
+
11
+ # Some platforms
12
+ Host.info{ |h|
13
+ p h
14
+ }
15
+
16
+ == Constants
17
+ VERSION
18
+ Returns the current version number of this package (as a string)
19
+
20
+ == Class Methods
21
+ Host.hostname
22
+ Returns the hostname of the current host. This may or not return
23
+ the FQDN, depending on your system.
24
+
25
+ Host.ip_addr
26
+ Returns a list of IP addresses for the current host (yes, it is
27
+ possible to have more than one).
28
+
29
+ Host.info(host=localhost)
30
+ Host.info(host=localhost){ |h| ... }
31
+ Yields a HostInfo struct for each network adapter on 'host', or an array
32
+ of HostInfo struct's in non-block form. The exact members of this struct
33
+ vary depending on your platform.
34
+
35
+ == Exception Classes
36
+ HostError < StandardError
37
+ Raised in the event of a failure for any of the class methods provided
38
+ with this package. Generally speaking, it means there was a failure in
39
+ the underlying gethostname() or gethostbyname() calls.
40
+
41
+ == Future Plans
42
+ Add support for IPV6. This will be difficult unless I have access to a
43
+ system on an IPV6 network. Any help on this front appreciated.
44
+
45
+ == Notes
46
+ The Windows version of this package uses OLE + WMI. The Host.info method
47
+ returns considerably more information than the *nix versions of this
48
+ package.
49
+
50
+ == Comments and Questions
51
+ Please direct all comments and/or questions to one of the Forums on the
52
+ project home page at http://www.rubyforge.org/projects/sysutils.
53
+
54
+ == Known Bugs
55
+ None that I'm aware of.
56
+
57
+ Please log any bugs on the project home page at
58
+ http://www.rubyforge.org/projects/sysutils
59
+
60
+ == Acknowledgements
61
+ Thanks go to Mike Hall, Guy Decoux, and Matz for their help with
62
+ C extensions in general.
63
+
64
+ Thanks also go to Richard Stevens for his excellent Unix programming
65
+ books.
66
+
67
+ == License
68
+ Ruby's
69
+
70
+ == Copyright
71
+ Copyright 2002-2006, Daniel J. Berger, djberg96 at gmail dot com
72
+
73
+ All Rights Reserved. This module is free software. It may be used,
74
+ redistributed and/or modified under the same terms as Ruby itself.
75
+
76
+ == Warranty
77
+ This package is provided "as is" and without any express or
78
+ implied warranties, including, without limitation, the implied
79
+ warranties of merchantability and fitness for a particular purpose.
80
+
81
+ == Author
82
+ Daniel J. Berger
83
+ djberg96 at gmail dot com
84
+ imperator on IRC (freenode)
85
+
86
+ == See Also
87
+ gethostbyname, gethostbyname_r, gethostname, hostname (Unix)
88
+ WMI, OLE (Windows)
@@ -0,0 +1,48 @@
1
+ require "mkmf"
2
+ require "ftools"
3
+
4
+ # Remove any symlinks that may already exist
5
+ File.delete('host.c') if File.exists?('host.c')
6
+ File.delete('constants.h') if File.exists?('constants.h')
7
+
8
+ have_func("gethostid")
9
+
10
+ case RUBY_PLATFORM
11
+ when /freebsd/i
12
+ have_func("getipnodebyname")
13
+ File.symlink("ext/freebsd.c", "host.c")
14
+ File.symlink("ext/constants.h", "constants.h")
15
+ when /sunos|solaris/i
16
+ have_library("nsl")
17
+ have_library("socket")
18
+ have_func("gethostbyname_r", "netdb.h")
19
+ have_func("gethostent_r", "netdb.h")
20
+ File.symlink("ext/sunos.c", "host.c")
21
+ File.symlink("ext/constants.h", "constants.h")
22
+ when /linux/i
23
+ have_func("gethostbyname_r", "netdb.h")
24
+ have_func("gethostent_r", "netdb.h")
25
+ File.symlink("ext/linux.c", "host.c")
26
+ File.symlink("ext/constants.h", "constants.h")
27
+ when /win32|windows|dos|mingw|cygwin/i
28
+ STDERR.puts "Run the 'install.rb' script to install on Windows systems"
29
+ else
30
+ File.symlink("ext/generic.c", "host.c")
31
+ File.symlink("ext/constants.h", "constants.h")
32
+ end
33
+
34
+ # Rename the windows.rb file to prevent 'make install' from installing it
35
+ unless RUBY_PLATFORM.match("mswin")
36
+ if File.exists?('lib/sys/windows.rb')
37
+ File.rename('lib/sys/windows.rb', 'lib/sys/windows.orig')
38
+ end
39
+ end
40
+
41
+ have_func("inet_ntop")
42
+
43
+ # Already grabbed this from netdb.h on Solaris
44
+ unless RUBY_PLATFORM =~ /sunos|solaris/i
45
+ have_func("gethostent_r")
46
+ end
47
+
48
+ create_makefile("sys/host")
@@ -0,0 +1,40 @@
1
+ ################################################
2
+ # install.rb - for sys-host
3
+ #
4
+ # For pure Ruby versions only
5
+ ################################################
6
+ require 'rbconfig'
7
+ require 'ftools'
8
+ include Config
9
+ install_dir = CONFIG['sitelibdir'] + '/sys'
10
+
11
+ file = ""
12
+
13
+ case RUBY_PLATFORM
14
+ when /windows|win32|mingw|cygwin|dos/i
15
+ file = "lib/os/windows.rb"
16
+ else
17
+ STDERR.puts "Use 'extconf.rb/make/make site-install' for this platform"
18
+ exit
19
+ end
20
+
21
+ # Create the 'sys' toplevel directory if it doesn't already exist
22
+ begin
23
+ unless File.exist?(install_dir)
24
+ Dir.mkdir(install_dir)
25
+ end
26
+ rescue Errno::EACCES => e
27
+ puts "Unable to create #{install_dir}: #{e}"
28
+ exit
29
+ end
30
+
31
+ # Finally, copy the file to the appropriate directory
32
+ begin
33
+ File.copy(file,"#{install_dir}/host.rb")
34
+ puts "cp #{file} #{install_dir}/host.rb"
35
+ rescue Errno::EACCES => e
36
+ puts "Unable to install cpu.rb to #{install_dir}: #{e}"
37
+ exit
38
+ end
39
+
40
+ puts "Installation successful"
@@ -0,0 +1,244 @@
1
+ require "win32ole"
2
+ require "socket"
3
+ require "parsedate"
4
+
5
+ module Sys
6
+ class HostError < StandardError; end
7
+ class Host
8
+ VERSION = "0.5.2"
9
+ fields = %w/
10
+ arp_always_source_route?
11
+ arp_use_ether_snap?
12
+ caption
13
+ database_path
14
+ dead_gw_detect_enabled?
15
+ default_ip_gateway
16
+ default_tos
17
+ default_ttl
18
+ description
19
+ dhcp_enabled?
20
+ dhcp_lease_expires
21
+ dhcp_lease_obtained
22
+ dhcp_server
23
+ dns_domain
24
+ dns_domain_suffix_search_order
25
+ dns_enabled_for_wins_resolution?
26
+ dns_host_name
27
+ dns_server_search_order
28
+ domain_dns_registration_enabled?
29
+ forward_buffer_memory
30
+ full_dns_registration_enabled?
31
+ gateway_cost_metric
32
+ igmp_level
33
+ index
34
+ ip_address
35
+ ip_connection_metric
36
+ ip_enabled?
37
+ ip_filter_security_enabled?
38
+ ip_port_security_enabled?
39
+ ip_sec_permit_ip_protocols
40
+ ip_sec_permit_tcp_ports
41
+ ip_sec_permit_udp_ports
42
+ ip_subnet
43
+ ip_use_zero_broadcast
44
+ ipx_address
45
+ ipx_enabled?
46
+ ipx_frame_type
47
+ ipx_media_type
48
+ ipx_network_number
49
+ ipx_virtual_net_number
50
+ keep_alive_interval
51
+ keep_alive_time
52
+ mac_address
53
+ mtu
54
+ num_forward_packets
55
+ pmtubh_detect_enabled?
56
+ pmtu_discovery_enabled?
57
+ service_name
58
+ setting_id
59
+ tcpip_netbios_options
60
+ tcp_max_connect_retransmissions
61
+ tcp_max_data_retransmissions
62
+ tcp_num_connections
63
+ tcp_use_rfc1122_urgent_pointer?
64
+ tcp_window_size
65
+ wins_enable_lm_hosts_lookup?
66
+ wins_host_lookup_file
67
+ wins_primary_server
68
+ wins_scope_id
69
+ wins_secondary_server
70
+ /
71
+
72
+ HostInfo = Struct.new("HostInfo",*fields)
73
+
74
+ def self.info(host=Socket.gethostname)
75
+ cs = "winmgmts://#{host}/root/cimv2"
76
+ begin
77
+ wmi = WIN32OLE.connect(cs)
78
+ rescue WIN32OLERuntimeError => e
79
+ raise HostError, e
80
+ else
81
+ query = "
82
+ select * from Win32_NetworkAdapterConfiguration
83
+ where IPEnabled = True
84
+ "
85
+ wmi.ExecQuery(query).each{ |nic|
86
+ dhcp_expires = nic.DHCPLeaseExpires
87
+ dhcp_lease_obtained = nic.DHCPLeaseObtained
88
+
89
+ if dhcp_expires
90
+ parsed = ParseDate.parsedate(dhcp_expires)
91
+ dhcp_expires = Time.mktime(*parsed)
92
+ end
93
+
94
+ if dhcp_lease_obtained
95
+ parsed = ParseDate.parsedate(dhcp_lease_obtained)
96
+ dhcp_lease_obtained = Time.mktime(*parsed)
97
+ end
98
+
99
+ igmp_level = nil
100
+ case nic.IGMPLevel
101
+ when 0
102
+ igmp_level = "None"
103
+ when 1
104
+ igmp_level = "IP"
105
+ when 2
106
+ igmp_level = "IP & IGMP"
107
+ end
108
+
109
+ ipx_frame_type = nil
110
+ case nic.IPXFrameType
111
+ when 0
112
+ ipx_frame_type = "Ethernet II"
113
+ when 1
114
+ ipx_frame_type = "Ethernet 802.3"
115
+ when 2
116
+ ipx_frame_type = "Ethernet 802.2"
117
+ when 3
118
+ ipx_frame_type = "Ethernet SNAP"
119
+ when 255
120
+ ipx_frame_type = "AUTO"
121
+ end
122
+
123
+ ipx_media_type = nil
124
+ case nic.IPXMediaType
125
+ when 0
126
+ ipx_media_type = "Ethernet"
127
+ when 1
128
+ ipx_media_type = "Token Ring"
129
+ when 2
130
+ ipx_media_type = "FDDI"
131
+ when 8
132
+ ipx_media_type = "ARCNET"
133
+ end
134
+
135
+ tcpip_netbios_options = nil
136
+ case nic.TcpipNetbiosOptions
137
+ when 0
138
+ tcpip_netbios_options = "EnableNetbiosViaDhcp"
139
+ when 1
140
+ tcpip_netbios_options = "EnableNetbios"
141
+ when 2
142
+ tcpip_netbios_options = "DisableNetbios"
143
+ end
144
+
145
+ yield HostInfo.new(
146
+ nic.ArpAlwaysSourceRoute,
147
+ nic.ArpUseEtherSNAP,
148
+ nic.Caption,
149
+ nic.DatabasePath,
150
+ nic.DeadGWDetectEnabled,
151
+ nic.DefaultIPGateway,
152
+ nic.DefaultTOS,
153
+ nic.DefaultTTL,
154
+ nic.Description,
155
+ nic.DHCPEnabled,
156
+ dhcp_expires,
157
+ dhcp_lease_obtained,
158
+ nic.DHCPServer,
159
+ nic.DNSDomain,
160
+ nic.DNSDomainSuffixSearchOrder,
161
+ nic.DNSEnabledForWINSResolution,
162
+ nic.DNSHostName,
163
+ nic.DNSServerSearchOrder,
164
+ nic.DomainDNSRegistrationEnabled,
165
+ nic.ForwardBufferMemory,
166
+ nic.FullDNSRegistrationEnabled,
167
+ nic.GatewayCostMetric,
168
+ igmp_level,
169
+ nic.Index,
170
+ nic.IpAddress,
171
+ nic.IPConnectionMetric,
172
+ nic.IPEnabled,
173
+ nic.IPFilterSecurityEnabled,
174
+ nic.IPPortSecurityEnabled,
175
+ nic.IPSecPermitIPProtocols,
176
+ nic.IPSecPermitTCPPorts,
177
+ nic.IPSecPermitUDPPorts,
178
+ nic.IPSubnet,
179
+ nic.IPUseZeroBroadcast,
180
+ nic.IPXAddress,
181
+ nic.IPXEnabled,
182
+ ipx_frame_type,
183
+ ipx_media_type,
184
+ nic.IPXNetworkNumber,
185
+ nic.IPXVirtualNetNumber,
186
+ nic.KeepAliveInterval,
187
+ nic.KeepAliveTime,
188
+ nic.MacAddress,
189
+ nic.MTU,
190
+ nic.NumForwardPackets,
191
+ nic.PMTUBHDetectEnabled,
192
+ nic.PMTUDiscoveryEnabled,
193
+ nic.ServiceName,
194
+ nic.SettingID,
195
+ tcpip_netbios_options,
196
+ nic.TcpMaxConnectRetransmissions,
197
+ nic.TcpMaxDataRetransmissions,
198
+ nic.TcpNumConnections,
199
+ nic.TcpUseRFC1122UrgentPointer,
200
+ nic.TcpWindowSize,
201
+ nic.WINSEnableLMHostsLookup,
202
+ nic.WINSHostLookupFile,
203
+ nic.WINSPrimaryServer,
204
+ nic.WINSScopeID,
205
+ nic.WINSSecondaryServer
206
+ )
207
+ }
208
+ end
209
+ end
210
+
211
+ def self.hostname
212
+ begin
213
+ wmi = WIN32OLE.connect("winmgmts://")
214
+ rescue WIN32OLERuntimeError => e
215
+ raise HostError, e
216
+ else
217
+ query = "
218
+ select * from Win32_NetworkAdapterConfiguration
219
+ where IPEnabled = True
220
+ "
221
+ wmi.ExecQuery(query).each{ |nic|
222
+ return nic.DNSHostName
223
+ }
224
+ end
225
+ end
226
+
227
+ def self.ip_addr
228
+ begin
229
+ wmi = WIN32OLE.connect("winmgmts://")
230
+ rescue WIN32OLERuntimeError => e
231
+ raise HostError, e
232
+ else
233
+ query = "
234
+ select * from Win32_NetworkAdapterConfiguration
235
+ where IPEnabled = True
236
+ "
237
+ wmi.ExecQuery(query).each{ |nic|
238
+ return nic.IPAddress
239
+ }
240
+ end
241
+ end
242
+
243
+ end
244
+ end
@@ -0,0 +1,47 @@
1
+ require "rubygems"
2
+
3
+ spec = Gem::Specification.new do |gem|
4
+ gem.name = "sys-host"
5
+ gem.version = "0.5.2"
6
+ gem.author = "Daniel J. Berger"
7
+ gem.email = "djberg96@gmail.com"
8
+ gem.homepage = "http://www.rubyforge.org/projects/sysutils"
9
+ gem.platform = Gem::Platform::RUBY
10
+ gem.summary = "Provides hostname and ip address info for a given host"
11
+ gem.description = "Provides hostname and ip address info for a given host"
12
+ gem.test_file = "test/tc_host.rb"
13
+ gem.has_rdoc = true
14
+ gem.extra_rdoc_files = ["CHANGES", "README", "MANIFEST"]
15
+ gem.rubyforge_project = "sysutils"
16
+ files = Dir["doc/*"] + Dir["test/*"] + Dir["[A-Z]*"]
17
+ files.delete_if{ |item| item.include?("CVS") }
18
+ gem.files = files
19
+ end
20
+
21
+ if $0 == __FILE__
22
+ if RUBY_PLATFORM.match("mswin")
23
+ File.rename("lib/sys/windows.rb", "lib/sys/host.rb")
24
+ spec.required_ruby_version = '>= 1.8.2'
25
+ spec.files += ["lib/sys/host.rb"]
26
+ spec.platform = Gem::Platform::WIN32
27
+ else
28
+ spec.required_ruby_version = '>= 1.8.0'
29
+ spec.extensions = ["extconf.rb"]
30
+
31
+ case RUBY_PLATFORM
32
+ when /linux/i
33
+ file = 'ext/linux.c'
34
+ when /sunos|solaris/i
35
+ file = 'ext/sunos.c'
36
+ when /freebsd/i
37
+ file = 'ext/freebsd.c'
38
+ else
39
+ file = 'ext/generic.c'
40
+ end
41
+
42
+ spec.files += ['ext/constants.h', file]
43
+ end
44
+
45
+ Gem.manage_gems
46
+ Gem::Builder.new(spec).build
47
+ end
@@ -0,0 +1,63 @@
1
+ #########################################
2
+ # tc_host.rb
3
+ #
4
+ # Test suite for sys-host, all platforms
5
+ #########################################
6
+ base = File.basename(Dir.pwd)
7
+ if base == "test" || base =~ /host.*/
8
+ require "ftools"
9
+ Dir.chdir("..") if base == "test"
10
+ Dir.mkdir("sys") unless File.exists?("sys")
11
+
12
+ if RUBY_PLATFORM.match("mswin")
13
+ File.copy("lib/windows.rb", "sys/host.rb")
14
+ else
15
+ case RUBY_PLATFORM
16
+ when /hpux/i
17
+ File.copy("host.sl","sys")
18
+ when /osx|darwin|mac/i
19
+ File.copy("host.bundle","sys")
20
+ else
21
+ File.copy("host.so","sys")
22
+ end
23
+ end
24
+
25
+ $LOAD_PATH.unshift Dir.pwd
26
+ Dir.chdir("test") rescue nil
27
+ end
28
+
29
+ require "sys/host"
30
+ require "test/unit"
31
+ include Sys
32
+
33
+ class TC_Host < Test::Unit::TestCase
34
+ def test_version
35
+ assert_equal("0.5.2",Host::VERSION)
36
+ end
37
+
38
+ def test_hostname
39
+ assert_respond_to(Host, :hostname)
40
+ assert_nothing_raised{ Host.hostname }
41
+ assert_kind_of(String, Host.hostname)
42
+ assert_equal(`hostname`.chomp, Host.hostname) # sanity check
43
+ end
44
+
45
+ def test_ip_addr
46
+ assert_respond_to(Host, :ip_addr)
47
+ assert_nothing_raised{ Host.ip_addr }
48
+ assert_kind_of(Array, Host.ip_addr)
49
+ end
50
+
51
+ def test_info
52
+ if RUBY_PLATFORM =~ /mswin|solaris|linux/i
53
+ assert_respond_to(Host, :info)
54
+ assert_nothing_raised{ Host.info }
55
+ assert_kind_of(Array, Host.info)
56
+ assert_kind_of(Struct::HostInfo, Host.info.first)
57
+ assert_nil(Host.info{ })
58
+ assert_nothing_raised{ 1000.times{ Host.info } }
59
+ else
60
+ puts "The 'test_info' test was skipped on this platform"
61
+ end
62
+ end
63
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: sys-host
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.5.2
7
+ date: 2006-11-18 00:00:00 -07:00
8
+ summary: Provides hostname and ip address info for a given host
9
+ require_paths:
10
+ - lib
11
+ email: djberg96@gmail.com
12
+ homepage: http://www.rubyforge.org/projects/sysutils
13
+ rubyforge_project: sysutils
14
+ description: Provides hostname and ip address info for a given host
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.2
24
+ version:
25
+ platform: mswin32
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Daniel J. Berger
31
+ files:
32
+ - doc/host.txt
33
+ - test/tc_host.rb
34
+ - CHANGES
35
+ - doc
36
+ - examples
37
+ - ext
38
+ - extconf.rb
39
+ - install.rb
40
+ - lib
41
+ - MANIFEST
42
+ - README
43
+ - sys-host.gemspec
44
+ - test
45
+ - lib/sys/host.rb
46
+ test_files:
47
+ - test/tc_host.rb
48
+ rdoc_options: []
49
+
50
+ extra_rdoc_files:
51
+ - CHANGES
52
+ - README
53
+ - MANIFEST
54
+ executables: []
55
+
56
+ extensions: []
57
+
58
+ requirements: []
59
+
60
+ dependencies: []
61
+