sys-uname 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.rdoc +7 -1
- data/MANIFEST.rdoc +2 -3
- data/Rakefile +3 -5
- data/lib/sys/uname.rb +1 -1
- data/lib/sys/windows/uname.rb +8 -0
- data/spec/sys_platform_spec.rb +75 -0
- data/spec/sys_uname_spec.rb +445 -0
- data/sys-uname.gemspec +3 -2
- metadata +31 -17
- metadata.gz.sig +4 -3
- data/test/test_sys_platform.rb +0 -80
- data/test/test_sys_uname.rb +0 -464
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77008aa838920e5feb9d539bdf5cdce36adefe1c49807f8f723bc25335f5253d
|
4
|
+
data.tar.gz: 718b3cc915cf7b9e5efb0c5f2fb5d6aaa8238c649396aba6f11b0b32960177a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7668f8dc545b0ab119cd2eda552d8d80e721ca71a7c637126cb9947e51e21f3b4459ecf64f7802dbd264bacd1bbf37ae5abbfc6dc0fbe63d580d7d1121522ec5
|
7
|
+
data.tar.gz: ca70162614537e6bda57d8e1b3c61b2c8897b78ee31df8389df38b69e12b63db69ea8e93ab32e2010ef0522431cbad7800d72fbd8ccdba7e1847698fc16acca4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES.rdoc
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
== 1.
|
1
|
+
== 1.2.0 - 5-Jan-2020
|
2
|
+
* Changed test suite from test-unit to rspec, which was also added as a
|
3
|
+
development dependency.
|
4
|
+
* Several new fields were added to the returned object on Windows. The fields
|
5
|
+
are encryption_level, product_type, suite_mask and system_drive.
|
6
|
+
|
7
|
+
== 1.1.1 - 10-Dec-2019
|
2
8
|
* Renamed various text files to include explicit .rdoc extension so that
|
3
9
|
they show up more nicely on github.
|
4
10
|
|
data/MANIFEST.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@ require 'rake'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/clean'
|
4
4
|
require 'rbconfig'
|
5
|
+
require 'rspec/core/rake_task'
|
5
6
|
|
6
7
|
CLEAN.include("**/*.rbc", "**/*.rbx", "**/*.gem")
|
7
8
|
|
@@ -31,9 +32,6 @@ namespace :gem do
|
|
31
32
|
end
|
32
33
|
|
33
34
|
desc "Run the test suite"
|
34
|
-
|
35
|
-
t.warning = true
|
36
|
-
t.verbose = true
|
37
|
-
end
|
35
|
+
RSpec::Core::RakeTask.new(:spec)
|
38
36
|
|
39
|
-
task :default => :
|
37
|
+
task :default => :spec
|
data/lib/sys/uname.rb
CHANGED
data/lib/sys/windows/uname.rb
CHANGED
@@ -34,6 +34,7 @@ module Sys
|
|
34
34
|
debug
|
35
35
|
description
|
36
36
|
distributed
|
37
|
+
encryption_level
|
37
38
|
foreground_application_boost
|
38
39
|
free_physical_memory
|
39
40
|
free_space_in_paging_files
|
@@ -57,6 +58,7 @@ module Sys
|
|
57
58
|
plus_product_id
|
58
59
|
plus_version_number
|
59
60
|
primary
|
61
|
+
product_type
|
60
62
|
quantum_length
|
61
63
|
quantum_type
|
62
64
|
registered_user
|
@@ -65,8 +67,10 @@ module Sys
|
|
65
67
|
service_pack_minor_version
|
66
68
|
size_stored_in_paging_files
|
67
69
|
status
|
70
|
+
suite_mask
|
68
71
|
system_device
|
69
72
|
system_directory
|
73
|
+
system_drive
|
70
74
|
total_swap_space_size
|
71
75
|
total_virtual_memory_size
|
72
76
|
total_visible_memory_size
|
@@ -443,6 +447,7 @@ module Sys
|
|
443
447
|
os.Debug,
|
444
448
|
os.Description,
|
445
449
|
os.Distributed,
|
450
|
+
os.EncryptionLevel,
|
446
451
|
os.ForegroundApplicationBoost,
|
447
452
|
self.convert(os.FreePhysicalMemory),
|
448
453
|
self.convert(os.FreeSpaceInPagingFiles),
|
@@ -466,6 +471,7 @@ module Sys
|
|
466
471
|
os.PlusProductID,
|
467
472
|
os.PlusVersionNumber,
|
468
473
|
os.Primary,
|
474
|
+
os.ProductType,
|
469
475
|
os.respond_to?(:QuantumLength) ? os.QuantumLength : nil,
|
470
476
|
os.respond_to?(:QuantumType) ? os.QuantumType : nil,
|
471
477
|
os.RegisteredUser,
|
@@ -474,8 +480,10 @@ module Sys
|
|
474
480
|
os.ServicePackMinorVersion,
|
475
481
|
self.convert(os.SizeStoredInPagingFiles),
|
476
482
|
os.Status,
|
483
|
+
os.SuiteMask,
|
477
484
|
os.SystemDevice,
|
478
485
|
os.SystemDirectory,
|
486
|
+
os.SystemDrive,
|
479
487
|
self.convert(os.TotalSwapSpaceSize),
|
480
488
|
self.convert(os.TotalVirtualMemorySize),
|
481
489
|
self.convert(os.TotalVisibleMemorySize),
|
@@ -0,0 +1,75 @@
|
|
1
|
+
##############################################################################
|
2
|
+
# sys_platform_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Sys::Platform class.
|
5
|
+
##############################################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'sys/uname'
|
8
|
+
require 'rbconfig'
|
9
|
+
|
10
|
+
RSpec.describe Sys::Platform do
|
11
|
+
|
12
|
+
before(:context) do
|
13
|
+
@host_os = RbConfig::CONFIG['host_os']
|
14
|
+
@windows = @host_os =~ /mingw|mswin|windows/i ? true : false
|
15
|
+
end
|
16
|
+
|
17
|
+
example "the VERSION constant is set to the expected value" do
|
18
|
+
expect(Sys::Platform::VERSION).to eql('1.2.0')
|
19
|
+
expect(Sys::Platform::VERSION).to be_frozen
|
20
|
+
end
|
21
|
+
|
22
|
+
example "the ARCH constant is defined" do
|
23
|
+
expect(Sys::Platform::ARCH).to be_kind_of(Symbol)
|
24
|
+
end
|
25
|
+
|
26
|
+
example "the OS constant is defined" do
|
27
|
+
expect(Sys::Platform::OS).to be_kind_of(Symbol)
|
28
|
+
end
|
29
|
+
|
30
|
+
example "the IMPL constant is defined" do
|
31
|
+
expect(Sys::Platform::IMPL).to be_kind_of(Symbol)
|
32
|
+
end
|
33
|
+
|
34
|
+
example "the IMPL returns an expected value", :if => @windows do
|
35
|
+
expect(Sys::Platform::IMPL).to include([:mingw, :mswin])
|
36
|
+
end
|
37
|
+
|
38
|
+
example "the mac? method is defined and returns a boolean" do
|
39
|
+
expect(Sys::Platform).to respond_to(:mac?)
|
40
|
+
expect(Sys::Platform.mac?).to eql(true).or eql(false)
|
41
|
+
end
|
42
|
+
|
43
|
+
example "the windows? method is defined and returns a boolean" do
|
44
|
+
expect(Sys::Platform).to respond_to(:windows?)
|
45
|
+
expect(Sys::Platform.windows?).to eql(true).or eql(false)
|
46
|
+
end
|
47
|
+
|
48
|
+
example "the windows? method returns the expected value" do
|
49
|
+
expect(Sys::Platform.windows?).to eql(@windows)
|
50
|
+
end
|
51
|
+
|
52
|
+
example "the unix? method is defined and returns a boolean" do
|
53
|
+
expect(Sys::Platform).to respond_to(:unix?)
|
54
|
+
expect(Sys::Platform.unix?).to eql(true).or eql(false)
|
55
|
+
end
|
56
|
+
|
57
|
+
example "the unix? method returns the expected value" do
|
58
|
+
expect(Sys::Platform.unix?).not_to eql(@windows)
|
59
|
+
end
|
60
|
+
|
61
|
+
example "the solaris? method is defined and returns a boolean" do
|
62
|
+
expect(Sys::Platform).to respond_to(:solaris?)
|
63
|
+
expect(Sys::Platform.solaris?).to eql(true).or eql(false)
|
64
|
+
end
|
65
|
+
|
66
|
+
example "the linux? method is defined and returns a boolean" do
|
67
|
+
expect(Sys::Platform).to respond_to(:linux?)
|
68
|
+
expect(Sys::Platform.linux?).to eql(true).or eql(false)
|
69
|
+
end
|
70
|
+
|
71
|
+
example "the bsd? method is defined and returns a boolean" do
|
72
|
+
expect(Sys::Platform).to respond_to(:bsd?)
|
73
|
+
expect(Sys::Platform.bsd?).to eql(true).or eql(false)
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,445 @@
|
|
1
|
+
##############################################################################
|
2
|
+
# sys_uname_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the sys-uname library. Run 'rake test' to execute tests.
|
5
|
+
##############################################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'sys/uname'
|
8
|
+
require 'rbconfig'
|
9
|
+
|
10
|
+
RSpec.describe Sys::Uname do
|
11
|
+
context "universal singleton methods" do
|
12
|
+
example "version constant is set to expected value" do
|
13
|
+
expect(Sys::Uname::VERSION).to eql('1.2.0')
|
14
|
+
expect(Sys::Uname::VERSION.frozen?).to be(true)
|
15
|
+
end
|
16
|
+
|
17
|
+
example "machine singleton method works as expected" do
|
18
|
+
expect(described_class).to respond_to(:machine)
|
19
|
+
expect{ described_class.machine }.not_to raise_error
|
20
|
+
expect(described_class.machine).to be_kind_of(String)
|
21
|
+
expect(described_class.machine.size).to be > 0
|
22
|
+
end
|
23
|
+
|
24
|
+
example "version singleton method works as expected" do
|
25
|
+
expect(described_class).to respond_to(:version)
|
26
|
+
expect{ described_class.version }.not_to raise_error
|
27
|
+
expect(described_class.version).to be_kind_of(String)
|
28
|
+
expect(described_class.version.size).to be > 0
|
29
|
+
end
|
30
|
+
|
31
|
+
example "nodename singleton method works as expected" do
|
32
|
+
expect(described_class).to respond_to(:nodename)
|
33
|
+
expect{ described_class.nodename }.not_to raise_error
|
34
|
+
expect(described_class.nodename).to be_kind_of(String)
|
35
|
+
expect(described_class.nodename.size).to be > 0
|
36
|
+
end
|
37
|
+
|
38
|
+
example "release singleton method works as expected" do
|
39
|
+
expect(described_class).to respond_to(:release)
|
40
|
+
expect{ described_class.release }.not_to raise_error
|
41
|
+
expect(described_class.release).to be_kind_of(String)
|
42
|
+
expect(described_class.release.size).to be > 0
|
43
|
+
end
|
44
|
+
|
45
|
+
example "sysname singleton method works as expected" do
|
46
|
+
expect(described_class).to respond_to(:sysname)
|
47
|
+
expect{ described_class.sysname }.not_to raise_error
|
48
|
+
expect(described_class.sysname).to be_kind_of(String)
|
49
|
+
expect(described_class.sysname.size).to be > 0
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "singleton methods for Solaris only", :if => RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i do
|
54
|
+
example "architecture singleton method works as expected on solaris" do
|
55
|
+
expect(described_class).to respond_to(:architecture)
|
56
|
+
expect{ described_class.architecture }.not_to raise_error
|
57
|
+
expect(described_class.architecture).to be_kind_of(String)
|
58
|
+
end
|
59
|
+
|
60
|
+
example "platform singleton method works as expected on solaris" do
|
61
|
+
expect(described_class).to respond_to(:platform)
|
62
|
+
expect{ described_class.platform }.not_to raise_error
|
63
|
+
expect(described_class.platform).to be_kind_of(String)
|
64
|
+
end
|
65
|
+
|
66
|
+
example "isa_list singleton method works as expected on solaris" do
|
67
|
+
expect(described_class).to respond_to(:isa_list)
|
68
|
+
expect{ described_class.isa_list }.not_to raise_error
|
69
|
+
expect(described_class.isa_list).to be_kind_of(String)
|
70
|
+
end
|
71
|
+
|
72
|
+
example "hw_provider singleton method works as expected on solaris" do
|
73
|
+
expect(described_class).to respond_to(:hw_provider)
|
74
|
+
expect{ described_class.hw_provider }.not_to raise_error
|
75
|
+
expect(described_class.hw_provider).to be_kind_of(String)
|
76
|
+
end
|
77
|
+
|
78
|
+
example "hw_serial singleton method works as expected on solaris" do
|
79
|
+
expect(described_class).to respond_to(:hw_serial)
|
80
|
+
expect{ described_class.hw_serial }.not_to raise_error
|
81
|
+
expect(described_class.hw_serial).to be_kind_of(Integer)
|
82
|
+
end
|
83
|
+
|
84
|
+
example "srpc_domain singleton method works as expected on solaris" do
|
85
|
+
expect(described_class).to respond_to(:srpc_domain)
|
86
|
+
expect{ described_class.srpc_domain }.not_to raise_error
|
87
|
+
expect(described_class.srpc_domain).to be_kind_of(String)
|
88
|
+
end
|
89
|
+
|
90
|
+
example "dhcp_cache singleton method works as expected on solaris" do
|
91
|
+
expect(described_class).to respond_to(:dhcp_cache)
|
92
|
+
expect{ described_class.dhcp_cache }.not_to raise_error
|
93
|
+
expect(described_class.dhcp_cache).to be_kind_of(String)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "singleton methods for BSD and Darwin only", :if => RbConfig::CONFIG['host_os'] =~ /darwin|bsd/i do
|
98
|
+
example "model singleton method works as expected on BSD and Darwin" do
|
99
|
+
expect(described_class).to respond_to(:model)
|
100
|
+
expect{ described_class.model }.not_to raise_error
|
101
|
+
expect(described_class.model).to be_kind_of(String)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context "singleton methods for HP-UX only", :if => RbConfig::CONFIG['host_os'] =~ /hpux/i do
|
106
|
+
example "id_number singleton method works as expected on HP-UX" do
|
107
|
+
expect(described_class).to respond_to(:id_number)
|
108
|
+
expect{ described_class.id_number }.not_to raise_error
|
109
|
+
expect(described_class.id_number).to be_kind_of(String)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "uname struct" do
|
114
|
+
example "uname struct contains expected members based on platform" do
|
115
|
+
members = %w/sysname nodename machine version release/
|
116
|
+
case RbConfig::CONFIG['host_os']
|
117
|
+
when /linux/i
|
118
|
+
members.push('domainname')
|
119
|
+
when /sunos|solaris/i
|
120
|
+
members.push(
|
121
|
+
'architecture', 'platform', 'hw_serial', 'hw_provider',
|
122
|
+
'srpc_domain', 'isa_list', 'dhcp_cache'
|
123
|
+
)
|
124
|
+
when /powerpc|darwin|bsd/i
|
125
|
+
members.push('model')
|
126
|
+
when /hpux/i
|
127
|
+
members.push('id')
|
128
|
+
when /win32|mingw|cygwin|dos|windows/i
|
129
|
+
members = %w[
|
130
|
+
boot_device build_number build_type caption code_set country_code
|
131
|
+
creation_class_name cscreation_class_name csd_version cs_name
|
132
|
+
current_time_zone debug description distributed encryption_level
|
133
|
+
foreground_application_boost free_physical_memory
|
134
|
+
free_space_in_paging_files free_virtual_memory
|
135
|
+
install_date last_bootup_time local_date_time locale
|
136
|
+
manufacturer max_number_of_processes max_process_memory_size
|
137
|
+
name number_of_licensed_users number_of_processes
|
138
|
+
number_of_users organization os_language os_product_suite
|
139
|
+
os_type other_type_description plus_product_id
|
140
|
+
plus_version_number primary product_type quantum_length quantum_type
|
141
|
+
registered_user serial_number service_pack_major_version
|
142
|
+
service_pack_minor_version size_stored_in_paging_files
|
143
|
+
status suite_mask system_device system_directory system_drive total_swap_space_size
|
144
|
+
total_virtual_memory_size total_visible_memory_size version
|
145
|
+
windows_directory
|
146
|
+
]
|
147
|
+
end
|
148
|
+
|
149
|
+
members.map!{ |e| e.to_sym } if RUBY_VERSION.to_f >= 1.9
|
150
|
+
|
151
|
+
expect{ described_class.uname }.not_to raise_error
|
152
|
+
expect(described_class.uname).to be_kind_of(Struct)
|
153
|
+
expect(described_class.uname.members.sort).to eql(members.sort)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
context "ffi" do
|
158
|
+
example "ffi and internal functions are not public" do
|
159
|
+
methods = described_class.methods(false).map{ |e| e.to_s }
|
160
|
+
expect(methods).not_to include('get_model')
|
161
|
+
expect(methods).not_to include('get_si')
|
162
|
+
expect(methods).not_to include('uname_c')
|
163
|
+
expect(methods).not_to include('sysctl')
|
164
|
+
expect(methods).not_to include('sysinfo')
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "instance methods for MS Windows", :if => File::ALT_SEPARATOR do
|
169
|
+
example "boot_device" do
|
170
|
+
expect{ described_class.uname.boot_device }.not_to raise_error
|
171
|
+
expect(described_class.uname.boot_device).to be_kind_of(String)
|
172
|
+
end
|
173
|
+
|
174
|
+
example "build_number" do
|
175
|
+
expect{ described_class.uname.build_number }.not_to raise_error
|
176
|
+
expect(described_class.uname.build_number).to be_kind_of(String)
|
177
|
+
end
|
178
|
+
|
179
|
+
example "build_type" do
|
180
|
+
expect{ described_class.uname.build_type }.not_to raise_error
|
181
|
+
expect(described_class.uname.build_type).to be_kind_of(String)
|
182
|
+
end
|
183
|
+
|
184
|
+
example "caption" do
|
185
|
+
expect{ described_class.uname.caption }.not_to raise_error
|
186
|
+
expect(described_class.uname.caption).to be_kind_of(String)
|
187
|
+
end
|
188
|
+
|
189
|
+
example "code_set" do
|
190
|
+
expect{ described_class.uname.code_set }.not_to raise_error
|
191
|
+
expect(described_class.uname.code_set).to be_kind_of(String)
|
192
|
+
end
|
193
|
+
|
194
|
+
example "country_code" do
|
195
|
+
expect{ described_class.uname.country_code }.not_to raise_error
|
196
|
+
expect(described_class.uname.country_code).to be_kind_of(String)
|
197
|
+
end
|
198
|
+
|
199
|
+
example "creation_class_name" do
|
200
|
+
expect{ described_class.uname.creation_class_name }.not_to raise_error
|
201
|
+
expect(described_class.uname.creation_class_name).to be_kind_of(String)
|
202
|
+
end
|
203
|
+
|
204
|
+
example "cscreation_class_name" do
|
205
|
+
expect{ described_class.uname.cscreation_class_name }.not_to raise_error
|
206
|
+
expect(described_class.uname.cscreation_class_name).to be_kind_of(String)
|
207
|
+
end
|
208
|
+
|
209
|
+
example "csd_version" do
|
210
|
+
expect{ described_class.uname.csd_version }.not_to raise_error
|
211
|
+
expect(described_class.uname.csd_version).to be_kind_of(String).or be_nil
|
212
|
+
end
|
213
|
+
|
214
|
+
example "cs_name" do
|
215
|
+
expect{ described_class.uname.cs_name }.not_to raise_error
|
216
|
+
expect(described_class.uname.cs_name).to be_kind_of(String)
|
217
|
+
end
|
218
|
+
|
219
|
+
example "current_time_zone" do
|
220
|
+
expect{ described_class.uname.current_time_zone }.not_to raise_error
|
221
|
+
expect(described_class.uname.current_time_zone).to be_kind_of(Integer)
|
222
|
+
end
|
223
|
+
|
224
|
+
example "debug" do
|
225
|
+
expect{ described_class.uname.debug }.not_to raise_error
|
226
|
+
expect(described_class.uname.debug).to be(true).or be(false)
|
227
|
+
end
|
228
|
+
|
229
|
+
example "description" do
|
230
|
+
expect{ described_class.uname.description }.not_to raise_error
|
231
|
+
expect(described_class.uname.description).to be_kind_of(String)
|
232
|
+
end
|
233
|
+
|
234
|
+
example "distributed" do
|
235
|
+
expect{ described_class.uname.distributed }.not_to raise_error
|
236
|
+
expect(described_class.uname.distributed).to be(true).or be(false)
|
237
|
+
end
|
238
|
+
|
239
|
+
example "encryption_level" do
|
240
|
+
expect{ described_class.uname.encryption_level }.not_to raise_error
|
241
|
+
expect(described_class.uname.encryption_level).to be_kind_of(Integer)
|
242
|
+
end
|
243
|
+
|
244
|
+
example "foreground_application_boost" do
|
245
|
+
expect{ described_class.uname.foreground_application_boost }.not_to raise_error
|
246
|
+
expect(described_class.uname.foreground_application_boost).to be_kind_of(Integer)
|
247
|
+
end
|
248
|
+
|
249
|
+
example "free_physical_memory" do
|
250
|
+
expect{ described_class.uname.free_physical_memory }.not_to raise_error
|
251
|
+
expect(described_class.uname.free_physical_memory).to be_kind_of(Integer)
|
252
|
+
end
|
253
|
+
|
254
|
+
example "free_space_in_paging_files" do
|
255
|
+
expect{ described_class.uname.free_space_in_paging_files }.not_to raise_error
|
256
|
+
expect(described_class.uname.free_space_in_paging_files).to be_kind_of(Integer)
|
257
|
+
end
|
258
|
+
|
259
|
+
example "free_virtual_memory" do
|
260
|
+
expect{ described_class.uname.free_virtual_memory}.not_to raise_error
|
261
|
+
expect(described_class.uname.free_virtual_memory).to be_kind_of(Integer)
|
262
|
+
end
|
263
|
+
|
264
|
+
example "install_date" do
|
265
|
+
expect{ described_class.uname.install_date}.not_to raise_error
|
266
|
+
expect(described_class.uname.install_date).to be_kind_of(Time)
|
267
|
+
end
|
268
|
+
|
269
|
+
example "last_bootup_time" do
|
270
|
+
expect{ described_class.uname.last_bootup_time}.not_to raise_error
|
271
|
+
expect(described_class.uname.last_bootup_time).to be_kind_of(Time)
|
272
|
+
end
|
273
|
+
|
274
|
+
example "local_date_time" do
|
275
|
+
expect{ described_class.uname.local_date_time}.not_to raise_error
|
276
|
+
expect(described_class.uname.local_date_time).to be_kind_of(Time)
|
277
|
+
end
|
278
|
+
|
279
|
+
example "locale" do
|
280
|
+
expect{ described_class.uname.locale}.not_to raise_error
|
281
|
+
expect(described_class.uname.locale).to be_kind_of(String)
|
282
|
+
end
|
283
|
+
|
284
|
+
example "manufacturer" do
|
285
|
+
expect{ described_class.uname.manufacturer}.not_to raise_error
|
286
|
+
expect(described_class.uname.manufacturer).to be_kind_of(String)
|
287
|
+
end
|
288
|
+
|
289
|
+
example "max_number_of_processes" do
|
290
|
+
expect{ described_class.uname.max_number_of_processes}.not_to raise_error
|
291
|
+
expect(described_class.uname.max_number_of_processes).to be_kind_of(Integer)
|
292
|
+
end
|
293
|
+
|
294
|
+
example "max_process_memory_size" do
|
295
|
+
expect{ described_class.uname.max_process_memory_size}.not_to raise_error
|
296
|
+
expect(described_class.uname.max_process_memory_size).to be_kind_of(Integer)
|
297
|
+
end
|
298
|
+
|
299
|
+
example "name" do
|
300
|
+
expect{ described_class.uname.name }.not_to raise_error
|
301
|
+
expect(described_class.uname.name).to be_kind_of(String)
|
302
|
+
end
|
303
|
+
|
304
|
+
example "number_of_licensed_users" do
|
305
|
+
expect{ described_class.uname.number_of_licensed_users }.not_to raise_error
|
306
|
+
expect(described_class.uname.number_of_licensed_users).to be_kind_of(Integer).or be_nil
|
307
|
+
end
|
308
|
+
|
309
|
+
example "number_of_processes" do
|
310
|
+
expect{ described_class.uname.number_of_processes }.not_to raise_error
|
311
|
+
expect(described_class.uname.number_of_processes).to be_kind_of(Integer)
|
312
|
+
end
|
313
|
+
|
314
|
+
example "number_of_users" do
|
315
|
+
expect{ described_class.uname.number_of_users }.not_to raise_error
|
316
|
+
expect(described_class.uname.number_of_users).to be_kind_of(Integer)
|
317
|
+
end
|
318
|
+
|
319
|
+
example "organization" do
|
320
|
+
expect{ described_class.uname.organization }.not_to raise_error
|
321
|
+
expect(described_class.uname.organization).to be_kind_of(String)
|
322
|
+
end
|
323
|
+
|
324
|
+
example "os_language" do
|
325
|
+
expect{ described_class.uname.os_language }.not_to raise_error
|
326
|
+
expect(described_class.uname.os_language).to be_kind_of(Integer)
|
327
|
+
end
|
328
|
+
|
329
|
+
example "os_product_suite" do
|
330
|
+
expect{ described_class.uname.os_product_suite }.not_to raise_error
|
331
|
+
expect(described_class.uname.os_product_suite).to be_kind_of(Integer)
|
332
|
+
end
|
333
|
+
|
334
|
+
example "os_type" do
|
335
|
+
expect{ described_class.uname.os_type }.not_to raise_error
|
336
|
+
expect(described_class.uname.os_type).to be_kind_of(Integer)
|
337
|
+
end
|
338
|
+
|
339
|
+
example "other_type_description" do
|
340
|
+
expect{ described_class.uname.other_type_description}.not_to raise_error
|
341
|
+
expect(described_class.uname.other_type_description).to be_kind_of(String).or be_nil
|
342
|
+
end
|
343
|
+
|
344
|
+
example "plus_product_id" do
|
345
|
+
expect{ described_class.uname.plus_product_id }.not_to raise_error
|
346
|
+
expect(described_class.uname.plus_product_id).to be_kind_of(Integer).or be_nil
|
347
|
+
end
|
348
|
+
|
349
|
+
example "plus_version_number" do
|
350
|
+
expect{ described_class.uname.plus_version_number }.not_to raise_error
|
351
|
+
expect(described_class.uname.plus_version_number).to be_kind_of(Integer).or be_nil
|
352
|
+
end
|
353
|
+
|
354
|
+
example "primary" do
|
355
|
+
expect{ described_class.uname.primary }.not_to raise_error
|
356
|
+
expect(described_class.uname.primary).to eql(true).or eql(false)
|
357
|
+
end
|
358
|
+
|
359
|
+
example "product_type" do
|
360
|
+
expect{ described_class.uname.product_type }.not_to raise_error
|
361
|
+
expect(described_class.uname.product_type).to be_kind_of(Integer)
|
362
|
+
end
|
363
|
+
|
364
|
+
example "quantum_length" do
|
365
|
+
expect{ described_class.uname.quantum_length }.not_to raise_error
|
366
|
+
expect(described_class.uname.quantum_length).to be_kind_of(Integer).or be_nil
|
367
|
+
end
|
368
|
+
|
369
|
+
example "quantum_type" do
|
370
|
+
expect{ described_class.uname.quantum_type }.not_to raise_error
|
371
|
+
expect(described_class.uname.quantum_type).to be_kind_of(Integer).or be_nil
|
372
|
+
end
|
373
|
+
|
374
|
+
example "registered_user" do
|
375
|
+
expect{ described_class.uname.registered_user }.not_to raise_error
|
376
|
+
expect(described_class.uname.registered_user).to be_kind_of(String)
|
377
|
+
end
|
378
|
+
|
379
|
+
example "serial_number" do
|
380
|
+
expect{ described_class.uname.serial_number }.not_to raise_error
|
381
|
+
expect(described_class.uname.serial_number).to be_kind_of(String)
|
382
|
+
end
|
383
|
+
|
384
|
+
example "service_pack_major_version" do
|
385
|
+
expect{ described_class.uname.service_pack_major_version }.not_to raise_error
|
386
|
+
expect(described_class.uname.service_pack_major_version).to be_kind_of(Integer)
|
387
|
+
end
|
388
|
+
|
389
|
+
example "service_pack_minor_version" do
|
390
|
+
expect{ described_class.uname.service_pack_minor_version }.not_to raise_error
|
391
|
+
expect(described_class.uname.service_pack_minor_version).to be_kind_of(Integer)
|
392
|
+
end
|
393
|
+
|
394
|
+
example "status" do
|
395
|
+
expect{ described_class.uname.status }.not_to raise_error
|
396
|
+
expect(described_class.uname.status).to be_kind_of(String)
|
397
|
+
end
|
398
|
+
|
399
|
+
example "suite_mask" do
|
400
|
+
expect{ described_class.uname.suite_mask }.not_to raise_error
|
401
|
+
expect(described_class.uname.suite_mask).to be_kind_of(Integer)
|
402
|
+
end
|
403
|
+
|
404
|
+
example "system_device" do
|
405
|
+
expect{ described_class.uname.system_device }.not_to raise_error
|
406
|
+
expect(described_class.uname.system_device).to be_kind_of(String)
|
407
|
+
end
|
408
|
+
|
409
|
+
example "system_directory" do
|
410
|
+
expect{ described_class.uname.system_directory }.not_to raise_error
|
411
|
+
expect(described_class.uname.system_directory).to be_kind_of(String)
|
412
|
+
end
|
413
|
+
|
414
|
+
example "system_drive" do
|
415
|
+
expect{ described_class.uname.system_drive }.not_to raise_error
|
416
|
+
expect(described_class.uname.system_drive).to be_kind_of(String)
|
417
|
+
expect(described_class.uname.system_drive).to eql("C:")
|
418
|
+
end
|
419
|
+
|
420
|
+
example "total_swap_space_size" do
|
421
|
+
expect{ described_class.uname.total_swap_space_size }.not_to raise_error
|
422
|
+
expect(described_class.uname.total_swap_space_size).to be_kind_of(Integer).or be_nil
|
423
|
+
end
|
424
|
+
|
425
|
+
example "total_virtual_memory_size" do
|
426
|
+
expect{ described_class.uname.total_virtual_memory_size }.not_to raise_error
|
427
|
+
expect(described_class.uname.total_virtual_memory_size).to be_kind_of(Integer)
|
428
|
+
end
|
429
|
+
|
430
|
+
example "total_visible_memory_size" do
|
431
|
+
expect{ described_class.uname.total_visible_memory_size }.not_to raise_error
|
432
|
+
expect(described_class.uname.total_visible_memory_size).to be_kind_of(Integer)
|
433
|
+
end
|
434
|
+
|
435
|
+
example "version" do
|
436
|
+
expect{ described_class.uname.version }.not_to raise_error
|
437
|
+
expect(described_class.uname.version).to be_kind_of(String)
|
438
|
+
end
|
439
|
+
|
440
|
+
example "windows_directory" do
|
441
|
+
expect{ described_class.uname.windows_directory }.not_to raise_error
|
442
|
+
expect(described_class.uname.windows_directory).to be_kind_of(String)
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
data/sys-uname.gemspec
CHANGED
@@ -2,19 +2,20 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'sys-uname'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.2.0'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
8
8
|
spec.homepage = 'http://github.com/djberg96/sys-uname'
|
9
9
|
spec.summary = 'An interface for returning uname (platform) information'
|
10
10
|
spec.license = 'Apache-2.0'
|
11
11
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
12
|
-
spec.test_files = Dir['
|
12
|
+
spec.test_files = Dir['spec/*_spec.rb']
|
13
13
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
14
14
|
|
15
15
|
spec.extra_rdoc_files = Dir['*.rdoc']
|
16
16
|
|
17
17
|
spec.add_dependency('ffi', '>= 1.0.0')
|
18
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
18
19
|
|
19
20
|
spec.metadata = {
|
20
21
|
'homepage_uri' => 'https://github.com/djberg96/sys-uname',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-uname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -51,6 +51,20 @@ dependencies:
|
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 1.0.0
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rspec
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.9'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.9'
|
54
68
|
description: |2
|
55
69
|
The sys-uname library provides an interface for gathering information
|
56
70
|
about your current platform. The library is named after the Unix 'uname'
|
@@ -61,33 +75,33 @@ email: djberg96@gmail.com
|
|
61
75
|
executables: []
|
62
76
|
extensions: []
|
63
77
|
extra_rdoc_files:
|
78
|
+
- CHANGES.rdoc
|
64
79
|
- MANIFEST.rdoc
|
65
80
|
- README.rdoc
|
66
|
-
- CHANGES.rdoc
|
67
81
|
files:
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
82
|
+
- spec
|
83
|
+
- spec/sys_uname_spec.rb
|
84
|
+
- spec/sys_platform_spec.rb
|
85
|
+
- Rakefile
|
86
|
+
- certs
|
87
|
+
- certs/djberg96_pub.pem
|
88
|
+
- sys-uname.gemspec
|
71
89
|
- examples
|
72
90
|
- examples/uname_test.rb
|
73
|
-
- Rakefile
|
74
91
|
- lib
|
75
|
-
- lib/sys-uname.rb
|
76
92
|
- lib/sys
|
77
93
|
- lib/sys/platform.rb
|
78
|
-
- lib/sys/windows
|
79
|
-
- lib/sys/windows/uname.rb
|
80
94
|
- lib/sys/unix
|
81
95
|
- lib/sys/unix/uname.rb
|
96
|
+
- lib/sys/windows
|
97
|
+
- lib/sys/windows/uname.rb
|
82
98
|
- lib/sys/uname.rb
|
83
|
-
-
|
84
|
-
-
|
85
|
-
- MANIFEST.rdoc
|
86
|
-
- README.rdoc
|
99
|
+
- lib/sys-uname.rb
|
100
|
+
- CHANGES.rdoc
|
87
101
|
- doc
|
88
102
|
- doc/uname.rdoc
|
89
|
-
-
|
90
|
-
-
|
103
|
+
- MANIFEST.rdoc
|
104
|
+
- README.rdoc
|
91
105
|
homepage: http://github.com/djberg96/sys-uname
|
92
106
|
licenses:
|
93
107
|
- Apache-2.0
|
@@ -118,5 +132,5 @@ signing_key:
|
|
118
132
|
specification_version: 4
|
119
133
|
summary: An interface for returning uname (platform) information
|
120
134
|
test_files:
|
121
|
-
-
|
122
|
-
-
|
135
|
+
- spec/sys_uname_spec.rb
|
136
|
+
- spec/sys_platform_spec.rb
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
�
|
2
|
-
|
3
|
-
c
|
1
|
+
T�@�\�=�t<�Ta�o.�x��
|
2
|
+
�w7BR��>��� v�� �<m�
|
3
|
+
��h���I��m"Ɲȋe���֟mX�K�#���K��}��$�:)�G�\�Dw��h��S�z�o����"ッ�c��"�A�יC�GO������B��������>�K��fa��0y��H�s�T��v?�f���oh�Wd�a�S�óOE@6C1?�8C��Z4�x�&gˬG���'\��
|
4
|
+
js�A���{����p�z��_ Yt���Ĕ�
|
data/test/test_sys_platform.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
##############################################################################
|
2
|
-
# test_sys_platform.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Sys::Platform class.
|
5
|
-
##############################################################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'sys/uname'
|
8
|
-
require 'rbconfig'
|
9
|
-
|
10
|
-
class TC_Sys_Platform < Test::Unit::TestCase
|
11
|
-
def self.startup
|
12
|
-
@@host_os = RbConfig::CONFIG['host_os']
|
13
|
-
@@windows = @@host_os =~ /mingw|mswin|windows/i ? true : false
|
14
|
-
end
|
15
|
-
|
16
|
-
test "the VERSION constant is set to the expected value" do
|
17
|
-
assert_equal('1.1.1', Sys::Platform::VERSION)
|
18
|
-
assert_true(Sys::Platform::VERSION.frozen?)
|
19
|
-
end
|
20
|
-
|
21
|
-
test "the ARCH constant is defined" do
|
22
|
-
assert_kind_of(Symbol, Sys::Platform::ARCH)
|
23
|
-
end
|
24
|
-
|
25
|
-
test "the OS constant is defined" do
|
26
|
-
assert_kind_of(Symbol, Sys::Platform::OS)
|
27
|
-
end
|
28
|
-
|
29
|
-
test "the IMPL constant is defined" do
|
30
|
-
assert_kind_of(Symbol, Sys::Platform::IMPL)
|
31
|
-
end
|
32
|
-
|
33
|
-
test "the IMPL returns an expected value" do
|
34
|
-
omit_unless(@@windows)
|
35
|
-
assert_true([:mingw, :mswin].include?(Sys::Platform::IMPL))
|
36
|
-
end
|
37
|
-
|
38
|
-
test "the mac? method is defined and returns a boolean" do
|
39
|
-
assert_respond_to(Sys::Platform, :mac?)
|
40
|
-
assert_boolean(Sys::Platform.mac?)
|
41
|
-
end
|
42
|
-
|
43
|
-
test "the windows? method is defined and returns a boolean" do
|
44
|
-
assert_respond_to(Sys::Platform, :windows?)
|
45
|
-
assert_boolean(Sys::Platform.windows?)
|
46
|
-
end
|
47
|
-
|
48
|
-
test "the windows? method returns the expected value" do
|
49
|
-
assert_equal(Sys::Platform.windows?, @@windows)
|
50
|
-
end
|
51
|
-
|
52
|
-
test "the unix? method is defined and returns a boolean" do
|
53
|
-
assert_respond_to(Sys::Platform, :unix?)
|
54
|
-
assert_boolean(Sys::Platform.unix?)
|
55
|
-
end
|
56
|
-
|
57
|
-
test "the unix? method returns the expected value" do
|
58
|
-
assert_equal(Sys::Platform.unix?, !@@windows)
|
59
|
-
end
|
60
|
-
|
61
|
-
test "the solaris? method is defined and returns a boolean" do
|
62
|
-
assert_respond_to(Sys::Platform, :solaris?)
|
63
|
-
assert_boolean(Sys::Platform.solaris?)
|
64
|
-
end
|
65
|
-
|
66
|
-
test "the linux? method is defined and returns a boolean" do
|
67
|
-
assert_respond_to(Sys::Platform, :linux?)
|
68
|
-
assert_boolean(Sys::Platform.linux?)
|
69
|
-
end
|
70
|
-
|
71
|
-
test "the bsd? method is defined and returns a boolean" do
|
72
|
-
assert_respond_to(Sys::Platform, :bsd?)
|
73
|
-
assert_boolean(Sys::Platform.bsd?)
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.shutdown
|
77
|
-
@@host_os = nil
|
78
|
-
@@windows = nil
|
79
|
-
end
|
80
|
-
end
|
data/test/test_sys_uname.rb
DELETED
@@ -1,464 +0,0 @@
|
|
1
|
-
##############################################################################
|
2
|
-
# test_sys_uname.rb
|
3
|
-
#
|
4
|
-
# Test suite for the sys-uname library. Run 'rake test' to execute tests.
|
5
|
-
##############################################################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'sys/uname'
|
8
|
-
require 'rbconfig'
|
9
|
-
include Sys
|
10
|
-
|
11
|
-
class TC_Sys_Uname < Test::Unit::TestCase
|
12
|
-
def self.startup
|
13
|
-
@@host_os = RbConfig::CONFIG['host_os']
|
14
|
-
end
|
15
|
-
|
16
|
-
test "version constant is set to expected value" do
|
17
|
-
assert_equal('1.1.1', Uname::VERSION)
|
18
|
-
assert_true(Uname::VERSION.frozen?)
|
19
|
-
end
|
20
|
-
|
21
|
-
test "machine singleton method works as expected" do
|
22
|
-
assert_respond_to(Uname, :machine)
|
23
|
-
assert_nothing_raised{ Uname.machine }
|
24
|
-
assert_kind_of(String, Uname.machine)
|
25
|
-
assert_true(Uname.machine.size > 0)
|
26
|
-
end
|
27
|
-
|
28
|
-
test "version singleton method works as expected" do
|
29
|
-
assert_respond_to(Uname, :version)
|
30
|
-
assert_nothing_raised{ Uname.version }
|
31
|
-
assert_kind_of(String, Uname.version)
|
32
|
-
assert_true(Uname.version.size > 0)
|
33
|
-
end
|
34
|
-
|
35
|
-
test "nodename singleton method works as expected" do
|
36
|
-
assert_respond_to(Uname, :nodename)
|
37
|
-
assert_nothing_raised{ Uname.nodename }
|
38
|
-
assert_kind_of(String, Uname.nodename)
|
39
|
-
assert_true(Uname.nodename.size > 0)
|
40
|
-
end
|
41
|
-
|
42
|
-
test "release singleton method works as expected" do
|
43
|
-
assert_respond_to(Uname, :release)
|
44
|
-
assert_nothing_raised{ Uname.release }
|
45
|
-
assert_kind_of(String, Uname.release)
|
46
|
-
assert_true(Uname.release.size > 0)
|
47
|
-
end
|
48
|
-
|
49
|
-
test "sysname singleton method works as expected" do
|
50
|
-
assert_respond_to(Uname, :sysname)
|
51
|
-
assert_nothing_raised{ Uname.sysname }
|
52
|
-
assert_kind_of(String, Uname.sysname)
|
53
|
-
assert_true(Uname.sysname.size > 0)
|
54
|
-
end
|
55
|
-
|
56
|
-
test "architecture singleton method works as expected on solaris" do
|
57
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
58
|
-
assert_respond_to(Uname, :architecture)
|
59
|
-
assert_nothing_raised{ Uname.architecture }
|
60
|
-
assert_kind_of(String, Uname.architecture)
|
61
|
-
end
|
62
|
-
|
63
|
-
test "platform singleton method works as expected on solaris" do
|
64
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
65
|
-
assert_respond_to(Uname, :platform)
|
66
|
-
assert_nothing_raised{ Uname.platform }
|
67
|
-
assert_kind_of(String, Uname.platform)
|
68
|
-
end
|
69
|
-
|
70
|
-
test "isa_list singleton method works as expected on solaris" do
|
71
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
72
|
-
assert_respond_to(Uname, :isa_list)
|
73
|
-
assert_nothing_raised{ Uname.isa_list }
|
74
|
-
assert_kind_of(String, Uname.isa_list)
|
75
|
-
end
|
76
|
-
|
77
|
-
test "hw_provider singleton method works as expected on solaris" do
|
78
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
79
|
-
assert_respond_to(Uname,:hw_provider)
|
80
|
-
assert_nothing_raised{ Uname.hw_provider }
|
81
|
-
assert_kind_of(String, Uname.hw_provider)
|
82
|
-
end
|
83
|
-
|
84
|
-
test "hw_serial singleton method works as expected on solaris" do
|
85
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
86
|
-
assert_respond_to(Uname, :hw_serial)
|
87
|
-
assert_nothing_raised{ Uname.hw_serial }
|
88
|
-
assert_kind_of(Integer, Uname.hw_serial)
|
89
|
-
end
|
90
|
-
|
91
|
-
test "srpc_domain singleton method works as expected on solaris" do
|
92
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
93
|
-
assert_respond_to(Uname, :srpc_domain)
|
94
|
-
assert_nothing_raised{ Uname.srpc_domain }
|
95
|
-
assert_kind_of(String, Uname.srpc_domain)
|
96
|
-
end
|
97
|
-
|
98
|
-
test "dhcp_cache singleton method works as expected on solaris" do
|
99
|
-
omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only")
|
100
|
-
assert_respond_to(Uname, :dhcp_cache)
|
101
|
-
assert_nothing_raised{ Uname.dhcp_cache }
|
102
|
-
assert_kind_of(String, Uname.dhcp_cache)
|
103
|
-
end
|
104
|
-
|
105
|
-
test "model singleton method works as expected on BSD and Darwin" do
|
106
|
-
omit_unless(@@host_os =~ /darwin|powerpc|bsd|mach/i, "BSD/Darwin only")
|
107
|
-
assert_respond_to(Uname, :model)
|
108
|
-
assert_nothing_raised{ Uname.model }
|
109
|
-
assert_kind_of(String, Uname.model)
|
110
|
-
end
|
111
|
-
|
112
|
-
test "id_number singleton method works as expected on HP-UX" do
|
113
|
-
omit_unless(@@host_os =~ /hpux/i, "HP-UX only")
|
114
|
-
assert_respond_to(Uname, :id_number)
|
115
|
-
assert_nothing_raised{ Uname.id_number }
|
116
|
-
assert_kind_of(String, Uname.id_number)
|
117
|
-
end
|
118
|
-
|
119
|
-
test "uname struct contains expected members based on platform" do
|
120
|
-
members = %w/sysname nodename machine version release/
|
121
|
-
case RbConfig::CONFIG['host_os']
|
122
|
-
when /linux/i
|
123
|
-
members.push('domainname')
|
124
|
-
when /sunos|solaris/i
|
125
|
-
members.push(
|
126
|
-
'architecture', 'platform', 'hw_serial', 'hw_provider',
|
127
|
-
'srpc_domain', 'isa_list', 'dhcp_cache'
|
128
|
-
)
|
129
|
-
when /powerpc|darwin|bsd/i
|
130
|
-
members.push('model')
|
131
|
-
when /hpux/i
|
132
|
-
members.push('id')
|
133
|
-
when /win32|mingw|cygwin|dos|windows/i
|
134
|
-
members = %w[
|
135
|
-
boot_device build_number build_type caption code_set country_code
|
136
|
-
creation_class_name cscreation_class_name csd_version cs_name
|
137
|
-
current_time_zone debug description distributed
|
138
|
-
foreground_application_boost free_physical_memory
|
139
|
-
free_space_in_paging_files free_virtual_memory
|
140
|
-
install_date last_bootup_time local_date_time locale
|
141
|
-
manufacturer max_number_of_processes max_process_memory_size
|
142
|
-
name number_of_licensed_users number_of_processes
|
143
|
-
number_of_users organization os_language os_product_suite
|
144
|
-
os_type other_type_description plus_product_id
|
145
|
-
plus_version_number primary quantum_length quantum_type
|
146
|
-
registered_user serial_number service_pack_major_version
|
147
|
-
service_pack_minor_version size_stored_in_paging_files
|
148
|
-
status system_device system_directory total_swap_space_size
|
149
|
-
total_virtual_memory_size total_visible_memory_size version
|
150
|
-
windows_directory
|
151
|
-
]
|
152
|
-
end
|
153
|
-
|
154
|
-
members.map!{ |e| e.to_sym } if RUBY_VERSION.to_f >= 1.9
|
155
|
-
|
156
|
-
assert_nothing_raised{ Uname.uname }
|
157
|
-
assert_kind_of(Struct, Uname.uname)
|
158
|
-
assert_equal(members.sort, Uname.uname.members.sort)
|
159
|
-
end
|
160
|
-
|
161
|
-
test "ffi and internal functions are not public" do
|
162
|
-
methods = Uname.methods(false).map{ |e| e.to_s }
|
163
|
-
assert_false(methods.include?('get_model'))
|
164
|
-
assert_false(methods.include?('get_si'))
|
165
|
-
assert_false(methods.include?('uname_c'))
|
166
|
-
assert_false(methods.include?('sysctl'))
|
167
|
-
assert_false(methods.include?('sysinfo'))
|
168
|
-
end
|
169
|
-
|
170
|
-
# The following tests are win32 only
|
171
|
-
if File::ALT_SEPARATOR
|
172
|
-
def test_boot_device
|
173
|
-
assert_nothing_raised{ Uname.uname.boot_device }
|
174
|
-
assert_kind_of(String, Uname.uname.boot_device)
|
175
|
-
end
|
176
|
-
|
177
|
-
def test_build_number
|
178
|
-
assert_nothing_raised{ Uname.uname.build_number }
|
179
|
-
assert_kind_of(String, Uname.uname.build_number)
|
180
|
-
end
|
181
|
-
|
182
|
-
def test_build_type
|
183
|
-
assert_nothing_raised{ Uname.uname.build_type }
|
184
|
-
assert_kind_of(String, Uname.uname.build_type)
|
185
|
-
end
|
186
|
-
|
187
|
-
def test_caption
|
188
|
-
assert_nothing_raised{ Uname.uname.caption }
|
189
|
-
assert_kind_of(String, Uname.uname.caption)
|
190
|
-
end
|
191
|
-
|
192
|
-
def test_code_set
|
193
|
-
assert_nothing_raised{ Uname.uname.code_set }
|
194
|
-
assert_kind_of(String, Uname.uname.code_set)
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_country_code
|
198
|
-
assert_nothing_raised{ Uname.uname.country_code }
|
199
|
-
assert_kind_of(String, Uname.uname.country_code)
|
200
|
-
end
|
201
|
-
|
202
|
-
def test_creation_class_name
|
203
|
-
assert_nothing_raised{ Uname.uname.creation_class_name }
|
204
|
-
assert_kind_of(String, Uname.uname.creation_class_name)
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_cscreation_class_name
|
208
|
-
assert_nothing_raised{ Uname.uname.cscreation_class_name }
|
209
|
-
assert_kind_of(String, Uname.uname.cscreation_class_name)
|
210
|
-
end
|
211
|
-
|
212
|
-
def test_csd_version
|
213
|
-
assert_nothing_raised{ Uname.uname.csd_version }
|
214
|
-
assert_kind_of([String, NilClass], Uname.uname.csd_version)
|
215
|
-
end
|
216
|
-
|
217
|
-
def test_cs_name
|
218
|
-
assert_nothing_raised{ Uname.uname.cs_name }
|
219
|
-
assert_kind_of(String, Uname.uname.cs_name)
|
220
|
-
end
|
221
|
-
|
222
|
-
def test_current_time_zone
|
223
|
-
assert_nothing_raised{ Uname.uname.current_time_zone }
|
224
|
-
assert_kind_of(Fixnum, Uname.uname.current_time_zone)
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_debug
|
228
|
-
assert_nothing_raised{ Uname.uname.debug }
|
229
|
-
assert_boolean(Uname.uname.debug)
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_description
|
233
|
-
assert_nothing_raised{ Uname.uname.description }
|
234
|
-
assert_kind_of(String, Uname.uname.description)
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_distributed
|
238
|
-
assert_nothing_raised{ Uname.uname.distributed }
|
239
|
-
assert_boolean(Uname.uname.distributed)
|
240
|
-
end
|
241
|
-
|
242
|
-
# Not yet supported - WinXP or later only
|
243
|
-
#def test_encryption_level
|
244
|
-
# assert_nothing_raised{ Uname.uname.encryption_level }
|
245
|
-
# assert_kind_of(Fixnum,Uname.uname.encryption_level)
|
246
|
-
#end
|
247
|
-
|
248
|
-
def test_foreground_application_boost
|
249
|
-
assert_nothing_raised{ Uname.uname.foreground_application_boost }
|
250
|
-
assert_kind_of(Fixnum, Uname.uname.foreground_application_boost)
|
251
|
-
end
|
252
|
-
|
253
|
-
def test_free_physical_memory
|
254
|
-
assert_nothing_raised{ Uname.uname.free_physical_memory }
|
255
|
-
assert_kind_of(Fixnum, Uname.uname.free_physical_memory)
|
256
|
-
end
|
257
|
-
|
258
|
-
def test_free_space_in_paging_files
|
259
|
-
assert_nothing_raised{ Uname.uname.free_space_in_paging_files }
|
260
|
-
assert_kind_of(Fixnum, Uname.uname.free_space_in_paging_files)
|
261
|
-
end
|
262
|
-
|
263
|
-
def test_free_virtual_memory
|
264
|
-
assert_nothing_raised{ Uname.uname.free_virtual_memory}
|
265
|
-
assert_kind_of(Fixnum, Uname.uname.free_virtual_memory)
|
266
|
-
end
|
267
|
-
|
268
|
-
def test_install_date
|
269
|
-
assert_nothing_raised{ Uname.uname.install_date}
|
270
|
-
assert_kind_of(Time, Uname.uname.install_date)
|
271
|
-
end
|
272
|
-
|
273
|
-
# Not yet supported - WinXP or later only
|
274
|
-
#def test_large_system_cache
|
275
|
-
# assert_nothing_raised{ Uname.uname.large_system_cache}
|
276
|
-
# assert_kind_of(Time,Uname.uname.large_system_cache)
|
277
|
-
#end
|
278
|
-
|
279
|
-
def test_last_bootup_time
|
280
|
-
assert_nothing_raised{ Uname.uname.last_bootup_time}
|
281
|
-
assert_kind_of(Time, Uname.uname.last_bootup_time)
|
282
|
-
end
|
283
|
-
|
284
|
-
def test_local_date_time
|
285
|
-
assert_nothing_raised{ Uname.uname.local_date_time}
|
286
|
-
assert_kind_of(Time, Uname.uname.local_date_time)
|
287
|
-
end
|
288
|
-
|
289
|
-
def test_locale
|
290
|
-
assert_nothing_raised{ Uname.uname.locale}
|
291
|
-
assert_kind_of(String, Uname.uname.locale)
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_manufacturer
|
295
|
-
assert_nothing_raised{ Uname.uname.manufacturer}
|
296
|
-
assert_kind_of(String, Uname.uname.manufacturer)
|
297
|
-
end
|
298
|
-
|
299
|
-
def test_max_number_of_processes
|
300
|
-
assert_nothing_raised{ Uname.uname.max_number_of_processes}
|
301
|
-
assert_kind_of(Fixnum, Uname.uname.max_number_of_processes)
|
302
|
-
end
|
303
|
-
|
304
|
-
def test_max_process_memory_size
|
305
|
-
assert_nothing_raised{ Uname.uname.max_process_memory_size}
|
306
|
-
assert_kind_of(Integer, Uname.uname.max_process_memory_size)
|
307
|
-
end
|
308
|
-
|
309
|
-
def test_name
|
310
|
-
assert_nothing_raised{ Uname.uname.name}
|
311
|
-
assert_kind_of(String, Uname.uname.name)
|
312
|
-
end
|
313
|
-
|
314
|
-
# Fails on Win XP Pro - returns nil - reason unknown
|
315
|
-
#def test_number_of_licensed_users
|
316
|
-
# assert_nothing_raised{ Uname.uname.number_of_licensed_users}
|
317
|
-
# assert_kind_of(Fixnum,Uname.uname.number_of_licensed_users)
|
318
|
-
#end
|
319
|
-
|
320
|
-
def test_number_of_processes
|
321
|
-
assert_nothing_raised{ Uname.uname.number_of_processes}
|
322
|
-
assert_kind_of(Fixnum, Uname.uname.number_of_processes)
|
323
|
-
end
|
324
|
-
|
325
|
-
def test_number_of_users
|
326
|
-
assert_nothing_raised{ Uname.uname.number_of_users}
|
327
|
-
assert_kind_of(Fixnum, Uname.uname.number_of_users)
|
328
|
-
end
|
329
|
-
|
330
|
-
def test_organization
|
331
|
-
assert_nothing_raised{ Uname.uname.organization}
|
332
|
-
assert_kind_of(String, Uname.uname.organization)
|
333
|
-
end
|
334
|
-
|
335
|
-
# Eventually replace Fixnum with a string (?)
|
336
|
-
def test_os_language
|
337
|
-
assert_nothing_raised{ Uname.uname.os_language}
|
338
|
-
assert_kind_of(Fixnum, Uname.uname.os_language)
|
339
|
-
end
|
340
|
-
|
341
|
-
# Fails on Win XP Pro - returns nil - reason unknown
|
342
|
-
#def test_os_product_suite
|
343
|
-
# assert_nothing_raised{ Uname.uname.os_product_suite}
|
344
|
-
# assert_kind_of(Fixnum,Uname.uname.os_product_suite)
|
345
|
-
#end
|
346
|
-
|
347
|
-
def test_os_type
|
348
|
-
assert_nothing_raised{ Uname.uname.os_type}
|
349
|
-
assert_kind_of(Fixnum, Uname.uname.os_type)
|
350
|
-
end
|
351
|
-
|
352
|
-
# Fails?
|
353
|
-
#def test_other_type_restriction
|
354
|
-
# assert_nothing_raised{ Uname.uname.other_type_restriction}
|
355
|
-
# assert_kind_of(Fixnum,Uname.uname.other_type_restriction)
|
356
|
-
#end
|
357
|
-
|
358
|
-
# Might be nil
|
359
|
-
def test_plus_product_id
|
360
|
-
assert_nothing_raised{ Uname.uname.plus_product_id }
|
361
|
-
end
|
362
|
-
|
363
|
-
# Might be nil
|
364
|
-
def test_plus_version_number
|
365
|
-
assert_nothing_raised{ Uname.uname.plus_version_number}
|
366
|
-
end
|
367
|
-
|
368
|
-
def test_primary
|
369
|
-
assert_nothing_raised{ Uname.uname.primary}
|
370
|
-
assert_boolean(Uname.uname.primary)
|
371
|
-
end
|
372
|
-
|
373
|
-
# Not yet supported - WinXP or later only
|
374
|
-
# def test_product_type
|
375
|
-
# assert_nothing_raised{ Uname.uname.product_type}
|
376
|
-
# assert_kind_of(Fixnum,Uname.uname.product_type)
|
377
|
-
# end
|
378
|
-
|
379
|
-
def test_quantum_length
|
380
|
-
assert_nothing_raised{ Uname.uname.quantum_length}
|
381
|
-
assert_kind_of([Fixnum, NilClass], Uname.uname.quantum_length)
|
382
|
-
end
|
383
|
-
|
384
|
-
def test_quantum_type
|
385
|
-
assert_nothing_raised{ Uname.uname.quantum_type}
|
386
|
-
assert_kind_of([Fixnum, NilClass], Uname.uname.quantum_type)
|
387
|
-
end
|
388
|
-
|
389
|
-
def test_registered_user
|
390
|
-
assert_nothing_raised{ Uname.uname.registered_user}
|
391
|
-
assert_kind_of(String, Uname.uname.registered_user)
|
392
|
-
end
|
393
|
-
|
394
|
-
def test_serial_number
|
395
|
-
assert_nothing_raised{ Uname.uname.serial_number}
|
396
|
-
assert_kind_of(String, Uname.uname.serial_number)
|
397
|
-
end
|
398
|
-
|
399
|
-
# This is nil on NT 4
|
400
|
-
def test_service_pack_major_version
|
401
|
-
assert_nothing_raised{ Uname.uname.service_pack_major_version}
|
402
|
-
assert_kind_of(Fixnum, Uname.uname.service_pack_major_version)
|
403
|
-
end
|
404
|
-
|
405
|
-
# This is nil on NT 4
|
406
|
-
def test_service_pack_minor_version
|
407
|
-
assert_nothing_raised{ Uname.uname.service_pack_minor_version}
|
408
|
-
assert_kind_of(Fixnum, Uname.uname.service_pack_minor_version)
|
409
|
-
end
|
410
|
-
|
411
|
-
def test_status
|
412
|
-
assert_nothing_raised{ Uname.uname.status}
|
413
|
-
assert_kind_of(String, Uname.uname.status)
|
414
|
-
end
|
415
|
-
|
416
|
-
# Not yet supported - WinXP or later only
|
417
|
-
#def test_suite_mask
|
418
|
-
# assert_nothing_raised{ Uname.uname.suite_mask}
|
419
|
-
# assert_kind_of(String,Uname.uname.suite_mask)
|
420
|
-
#end
|
421
|
-
|
422
|
-
def test_system_device
|
423
|
-
assert_nothing_raised{ Uname.uname.system_device}
|
424
|
-
assert_kind_of(String, Uname.uname.system_device)
|
425
|
-
end
|
426
|
-
|
427
|
-
def test_system_directory
|
428
|
-
assert_nothing_raised{ Uname.uname.system_directory}
|
429
|
-
assert_kind_of(String, Uname.uname.system_directory)
|
430
|
-
end
|
431
|
-
|
432
|
-
# Not yet supported - WinXP or later only
|
433
|
-
#def test_system_drive
|
434
|
-
# assert_nothing_raised{ Uname.uname.system_drive}
|
435
|
-
# assert_kind_of(String,Uname.uname.system_drive)
|
436
|
-
#end
|
437
|
-
|
438
|
-
# Fails on Win XP Pro - returns nil - reason unknown
|
439
|
-
#def test_total_swap_space_size
|
440
|
-
# assert_nothing_raised{ Uname.uname.total_swap_space_size}
|
441
|
-
# assert_kind_of(Fixnum,Uname.uname.total_swap_space_size)
|
442
|
-
#end
|
443
|
-
|
444
|
-
def test_total_virtual_memory_size
|
445
|
-
assert_nothing_raised{ Uname.uname.total_virtual_memory_size}
|
446
|
-
assert_kind_of(Fixnum, Uname.uname.total_virtual_memory_size)
|
447
|
-
end
|
448
|
-
|
449
|
-
def test_total_visible_memory_size
|
450
|
-
assert_nothing_raised{ Uname.uname.total_visible_memory_size}
|
451
|
-
assert_kind_of(Fixnum, Uname.uname.total_visible_memory_size)
|
452
|
-
end
|
453
|
-
|
454
|
-
def test_version
|
455
|
-
assert_nothing_raised{ Uname.uname.version}
|
456
|
-
assert_kind_of(String, Uname.uname.version)
|
457
|
-
end
|
458
|
-
|
459
|
-
def test_windows_directory
|
460
|
-
assert_nothing_raised{ Uname.uname.windows_directory}
|
461
|
-
assert_kind_of(String, Uname.uname.windows_directory)
|
462
|
-
end
|
463
|
-
end
|
464
|
-
end
|