sys-uname 0.7.3 → 0.7.4
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.
- data/CHANGES +4 -0
- data/MANIFEST +5 -5
- data/README +23 -11
- data/doc/uname.txt +58 -58
- data/ext/extconf.rb +28 -0
- data/{lib/os/unix.c → ext/uname.c} +1 -1
- data/test/tc_uname.rb +33 -39
- metadata +6 -5
- data/extconf.rb +0 -28
data/CHANGES
CHANGED
data/MANIFEST
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
extconf.rb
|
2
1
|
install.rb
|
3
2
|
MANIFEST
|
4
3
|
CHANGES
|
5
4
|
README
|
6
5
|
sys-uname.gemspec
|
7
6
|
|
8
|
-
doc/uname.rd
|
9
7
|
doc/uname.txt
|
10
8
|
|
11
9
|
examples/uname_test.rb
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
ext/extconf.rb
|
12
|
+
ext/uname.c
|
15
13
|
|
16
|
-
|
14
|
+
lib/sys/uname.rb
|
15
|
+
|
16
|
+
test/tc_uname.rb
|
data/README
CHANGED
@@ -1,30 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
= Prerequisites
|
2
|
+
=== Unix
|
3
|
+
Ruby 1.8.0 or later.
|
4
|
+
=== MS Windows
|
5
|
+
Ruby 1.8.2 or later. Earlier versions segfault due to OLE bugs.
|
6
|
+
Active WMI service (normally on by default).
|
4
7
|
|
5
|
-
|
8
|
+
= Installation
|
9
|
+
=== Unix
|
6
10
|
ruby extconf.rb
|
7
11
|
make
|
8
12
|
ruby test/tc_uname.rb (optional)
|
9
13
|
make site-install
|
10
|
-
|
11
|
-
== Installation: Win32
|
14
|
+
=== MS Windows
|
12
15
|
ruby test\tc_uname.rb (optional)
|
13
16
|
ruby install.rb
|
14
|
-
|
15
|
-
|
17
|
+
|
18
|
+
= Synopsis
|
19
|
+
require 'sys/uname'
|
20
|
+
include Sys
|
21
|
+
|
22
|
+
p Uname.uname
|
23
|
+
|
24
|
+
= Solaris Notes
|
16
25
|
Folks building this package on SunOS get two extra methods: architecture()
|
17
26
|
and platform()
|
18
27
|
|
19
|
-
|
28
|
+
= OS X Notes
|
20
29
|
OS X users get the extra method "model()".
|
21
30
|
|
22
|
-
|
31
|
+
= HP-UX Notes
|
23
32
|
HP-UX users get the extra method "id()". This is actually a String, not
|
24
33
|
a Fixnum, because that's how it's defined in the utsname struct.
|
25
34
|
|
26
|
-
|
35
|
+
= MS Windows Notes
|
27
36
|
The C version for Windows has been completely scrapped in favor of an OLE
|
28
37
|
plus WMI approach. It is pure Ruby. Please see the MSDN documentation for
|
29
38
|
the Win32_OperatingSystem class for a complete list of what each of the
|
30
39
|
UnameStruct members mean.
|
40
|
+
|
41
|
+
= Documentation
|
42
|
+
For more details, see the 'uname.txt' file under the 'doc' directory.
|
data/doc/uname.txt
CHANGED
@@ -1,122 +1,122 @@
|
|
1
1
|
== Description
|
2
|
-
|
2
|
+
A Ruby interface to the 'uname' command.
|
3
3
|
|
4
4
|
== Synopsis
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
require 'sys/uname'
|
6
|
+
include Sys
|
7
|
+
|
8
|
+
puts Uname.nodename
|
9
|
+
puts Uname.version
|
10
|
+
puts Uname.sysname
|
11
|
+
puts Uname.machine
|
12
|
+
puts Uname.release
|
13
13
|
|
14
|
-
|
14
|
+
p Uname.uname
|
15
15
|
|
16
16
|
== Constants
|
17
17
|
VERSION
|
18
|
-
|
18
|
+
The current version number of sys-uname.
|
19
19
|
|
20
20
|
== Class Methods
|
21
21
|
Uname.sysname
|
22
|
-
|
22
|
+
Returns the operating system name. e.g. "SunOS"
|
23
23
|
|
24
24
|
Uname.nodename
|
25
|
-
|
26
|
-
|
25
|
+
Returns the nodename. This is usually, but not necessarily, the
|
26
|
+
same as the system's hostname.
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
You cannot currently set the nodename (root or otherwise). This may
|
29
|
+
be added in a future release.
|
30
30
|
|
31
31
|
Uname.machine
|
32
|
-
|
32
|
+
Returns the machine hardware type. e.g. "i686"
|
33
33
|
|
34
34
|
Uname.version
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
Returns the operating system version. e.g. "5.8". In the case of MS
|
36
|
+
Windows, it returns the version plus patch information, separated by
|
37
|
+
a hyphen, e.g. "2915-Service Pack 2".
|
38
38
|
|
39
39
|
Uname.release
|
40
|
-
|
40
|
+
Returns the operating system release. e.g. "2.2.16-3"
|
41
41
|
|
42
42
|
Uname.uname
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
Returns a struct of type UnameStruct that contains sysname, nodename,
|
44
|
+
machine, version, and release. On Solaris, it will also include
|
45
|
+
architecture and platform. On HP-UX, it will also include id.
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
MS Windows - there are many more, and different, fields in the struct.
|
48
|
+
Please see the MSDN documenation for a complete explanation of what
|
49
|
+
each of these members mean.
|
50
50
|
|
51
51
|
== Solaris Only
|
52
52
|
Uname.architecture
|
53
|
-
|
53
|
+
Returns the instruction set architecture. e.g. "sparc"
|
54
54
|
|
55
55
|
Uname.platform
|
56
|
-
|
56
|
+
Returns the platform identifier. e.g. "SUNW,Sun-Blade-100"
|
57
57
|
|
58
58
|
Uname.isa_list
|
59
|
-
|
60
|
-
|
59
|
+
Returns a space separated string containing a list of all variant
|
60
|
+
instruction set architectures executable on the current system.
|
61
61
|
|
62
|
-
|
62
|
+
They are listed in order of performance, from best to worst.
|
63
63
|
|
64
64
|
Uname.hw_provider
|
65
|
-
|
65
|
+
Returns the name of the hardware manufacturer.
|
66
66
|
|
67
67
|
Uname.hw_serial_number
|
68
|
-
|
69
|
-
|
68
|
+
Returns the ASCII representation of the hardware-specific serial number
|
69
|
+
of the machine that executes the function.
|
70
70
|
|
71
71
|
Uname.srpc_domain
|
72
|
-
|
72
|
+
Returns the name of the Secure Remote Procedure Call domain, if any.
|
73
73
|
|
74
74
|
Uname.dhcp_cache
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
Returns a hexidecimal encoding, in String form, of the name of the
|
76
|
+
interface configured by boot(1M) followed by the DHCPACK reply from
|
77
|
+
the server.
|
78
78
|
|
79
79
|
== OS X Only
|
80
80
|
Uname.model
|
81
|
-
|
81
|
+
Returns the model type, e.g. "PowerBook5,1"
|
82
82
|
|
83
83
|
== HP-UX Only
|
84
84
|
Uname.id
|
85
|
-
|
85
|
+
Returns the id number, e.g. 234233587. This is a String, not a Fixnum.
|
86
86
|
|
87
87
|
== Notes
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
Not all of the information that you might be used to seeing with
|
89
|
+
a 'uname -a' is available. This may be added in future releases,
|
90
|
+
but since different implementations provide different information
|
91
|
+
(via different header files) it will be a bit of a pain.
|
92
92
|
|
93
|
-
|
93
|
+
Windows users - please see the MSDN documentation for the
|
94
94
|
Win32_OperatingSystem class for a complete list of what each of the
|
95
95
|
UnameStruct members mean.
|
96
96
|
|
97
97
|
== Known Bugs
|
98
|
-
|
99
|
-
|
98
|
+
None that I'm aware of. Please log any bugs on the project page at
|
99
|
+
http://www.rubyforge.org/projects/sysutils.
|
100
100
|
|
101
101
|
== Future Plans
|
102
102
|
Add additional info for Linux, Solaris, BSD.
|
103
103
|
|
104
104
|
== License
|
105
|
-
|
105
|
+
Ruby's
|
106
106
|
|
107
107
|
== Copyright
|
108
|
-
|
109
|
-
|
108
|
+
(C) 2002-2006 Daniel J. Berger
|
109
|
+
All Rights Reserved
|
110
110
|
|
111
111
|
== Warranty
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
This package is provided "as is" and without any express or
|
113
|
+
implied warranties, including, without limitation, the implied
|
114
|
+
warranties of merchantability and fitness for a particular purpose.
|
115
115
|
|
116
116
|
== Author
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
Daniel Berger
|
118
|
+
djberg96 at gmail dot com
|
119
|
+
imperator on IRC (Freenode)
|
120
120
|
|
121
121
|
== See Also
|
122
|
-
|
122
|
+
uname(1) for unix, or WMI for MS Windows.
|
data/ext/extconf.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
##########################
|
2
|
+
# extconf.rb - sys-uname
|
3
|
+
##########################
|
4
|
+
require 'mkmf'
|
5
|
+
|
6
|
+
if PLATFORM.match('mswin')
|
7
|
+
STDERR.puts "Run 'ruby install.rb' instead for Windows"
|
8
|
+
STDERR.puts "Exiting..."
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
if RUBY_PLATFORM =~ /sunos|solaris/i
|
13
|
+
have_header('sys/systeminfo.h')
|
14
|
+
end
|
15
|
+
|
16
|
+
########################################################################
|
17
|
+
# Move any ".rb" files under 'lib/sys/' to ".orig" to prevent mkmf from
|
18
|
+
# installing them during the 'make install' phase.
|
19
|
+
########################################################################
|
20
|
+
if File.basename(Dir.pwd) == 'ext'
|
21
|
+
Dir.chdir('..'){
|
22
|
+
Dir["lib/sys/*.rb"].each{ |f|
|
23
|
+
File.rename(f, 'lib/sys/' + File.basename(f, '.rb')+ '.orig')
|
24
|
+
}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
create_makefile('sys/uname')
|
data/test/tc_uname.rb
CHANGED
@@ -5,34 +5,28 @@
|
|
5
5
|
##############################################################################
|
6
6
|
base = File.basename(Dir.pwd)
|
7
7
|
|
8
|
-
if base ==
|
9
|
-
|
10
|
-
|
11
|
-
Dir.chdir("..") if base == "test"
|
12
|
-
Dir.mkdir("sys") unless File.exists?("sys")
|
8
|
+
if base == 'test' || base =~ /sys-uname/
|
9
|
+
Dir.chdir('..') if base == 'test'
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
if RUBY_PLATFORM.match('mswin')
|
12
|
+
$LOAD_PATH.unshift(Dir.pwd + '/lib')
|
13
|
+
else
|
14
|
+
require 'ftools'
|
15
|
+
require 'rbconfig'
|
16
|
+
Dir.mkdir('sys') unless File.exists?('sys')
|
17
|
+
file = 'uname.' + Config::CONFIG['DLEXT']
|
18
|
+
if File.exists?(file)
|
19
|
+
File.copy(file, 'sys')
|
20
20
|
else
|
21
|
-
|
21
|
+
File.copy('ext/' + file, 'sys')
|
22
|
+
end
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
file = "lib/os/windows.rb"
|
26
|
-
File.copy(file,"sys/uname.rb")
|
27
|
-
else
|
28
|
-
file = "uname" + extension
|
29
|
-
File.copy(file,"sys")
|
30
|
-
end
|
31
|
-
$LOAD_PATH.unshift Dir.pwd
|
25
|
+
$LOAD_PATH.unshift(Dir.pwd)
|
32
26
|
end
|
33
27
|
|
34
|
-
require
|
35
|
-
require
|
28
|
+
require 'sys/uname'
|
29
|
+
require 'test/unit'
|
36
30
|
include Sys
|
37
31
|
|
38
32
|
# For testing purposes only
|
@@ -45,11 +39,11 @@ class TC_Uname < Test::Unit::TestCase
|
|
45
39
|
assert_not_nil(Uname::VERSION)
|
46
40
|
assert_nothing_raised{ Uname::VERSION }
|
47
41
|
assert_kind_of(String, Uname::VERSION)
|
48
|
-
assert_equal(
|
42
|
+
assert_equal('0.7.4', Uname::VERSION)
|
49
43
|
end
|
50
44
|
|
51
45
|
def test_machine
|
52
|
-
assert_respond_to(Uname
|
46
|
+
assert_respond_to(Uname, :machine)
|
53
47
|
assert_nothing_raised{ Uname.machine }
|
54
48
|
assert_kind_of(String, Uname.machine)
|
55
49
|
end
|
@@ -75,7 +69,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
75
69
|
def test_sysname
|
76
70
|
assert_respond_to(Uname, :sysname)
|
77
71
|
assert_nothing_raised{ Uname.sysname }
|
78
|
-
assert_kind_of(String, Uname.sysname,
|
72
|
+
assert_kind_of(String, Uname.sysname, 'Invalid Type')
|
79
73
|
end
|
80
74
|
|
81
75
|
def test_architecture
|
@@ -84,7 +78,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
84
78
|
assert_nothing_raised{ Uname.architecture }
|
85
79
|
assert_kind_of(String, Uname.architecture)
|
86
80
|
else
|
87
|
-
puts "
|
81
|
+
puts '"architecture" test skipped on this platform'
|
88
82
|
end
|
89
83
|
end
|
90
84
|
|
@@ -94,7 +88,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
94
88
|
assert_nothing_raised{ Uname.platform }
|
95
89
|
assert_kind_of(String, Uname.platform)
|
96
90
|
else
|
97
|
-
puts "
|
91
|
+
puts '"platform" test skipped on this platform'
|
98
92
|
end
|
99
93
|
end
|
100
94
|
|
@@ -104,7 +98,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
104
98
|
assert_nothing_raised{ Uname.isa_list }
|
105
99
|
assert_kind_of(String, Uname.isa_list)
|
106
100
|
else
|
107
|
-
puts "
|
101
|
+
puts '"isa_list" test skipped on this platform'
|
108
102
|
end
|
109
103
|
end
|
110
104
|
|
@@ -114,7 +108,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
114
108
|
assert_nothing_raised{ Uname.hw_provider }
|
115
109
|
assert_kind_of(String, Uname.hw_provider)
|
116
110
|
else
|
117
|
-
puts "
|
111
|
+
puts '"hw_provider" test skipped on this platform'
|
118
112
|
end
|
119
113
|
end
|
120
114
|
|
@@ -124,7 +118,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
124
118
|
assert_nothing_raised{ Uname.hw_serial_number }
|
125
119
|
assert_kind_of(Integer, Uname.hw_serial_number)
|
126
120
|
else
|
127
|
-
puts "
|
121
|
+
puts '"hw_serial_number" test skipped on this platform'
|
128
122
|
end
|
129
123
|
end
|
130
124
|
|
@@ -134,7 +128,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
134
128
|
assert_nothing_raised{ Uname.srpc_domain }
|
135
129
|
assert_kind_of(String, Uname.srpc_domain)
|
136
130
|
else
|
137
|
-
puts "
|
131
|
+
puts '"srpc_domain" test skipped on this platform'
|
138
132
|
end
|
139
133
|
end
|
140
134
|
|
@@ -144,7 +138,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
144
138
|
assert_nothing_raised{ Uname.dhcp_cache }
|
145
139
|
assert_kind_of(String, Uname.dhcp_cache)
|
146
140
|
else
|
147
|
-
puts "
|
141
|
+
puts '"srpc_domain" test skipped on this platform'
|
148
142
|
end
|
149
143
|
end
|
150
144
|
|
@@ -154,7 +148,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
154
148
|
assert_nothing_raised{ Uname.model }
|
155
149
|
assert_kind_of(String, Uname.model)
|
156
150
|
else
|
157
|
-
puts "
|
151
|
+
puts '"model" test skipped on this platform'
|
158
152
|
end
|
159
153
|
end
|
160
154
|
|
@@ -164,7 +158,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
164
158
|
assert_nothing_raised{ Uname.id }
|
165
159
|
assert_kind_of(String, Uname.id)
|
166
160
|
else
|
167
|
-
puts "
|
161
|
+
puts '"id" test skipped on this platform'
|
168
162
|
end
|
169
163
|
end
|
170
164
|
|
@@ -172,11 +166,11 @@ class TC_Uname < Test::Unit::TestCase
|
|
172
166
|
members = %w/sysname nodename machine version release/
|
173
167
|
case RUBY_PLATFORM
|
174
168
|
when /sunos|solaris/i
|
175
|
-
members.push(
|
169
|
+
members.push('architecture','platform')
|
176
170
|
when /powerpc|darwin/i
|
177
|
-
members.push(
|
171
|
+
members.push('model')
|
178
172
|
when /hpux/i
|
179
|
-
members.push(
|
173
|
+
members.push('id')
|
180
174
|
when /win32|mingw|cygwin|dos/i
|
181
175
|
members = %w/
|
182
176
|
boot_device build_number build_type caption code_set country_code
|
@@ -198,8 +192,8 @@ class TC_Uname < Test::Unit::TestCase
|
|
198
192
|
/
|
199
193
|
end
|
200
194
|
assert_nothing_raised{ Uname.uname }
|
201
|
-
assert_kind_of(Struct, Uname.uname
|
202
|
-
assert_equal(members, Uname.uname.members
|
195
|
+
assert_kind_of(Struct, Uname.uname)
|
196
|
+
assert_equal(members, Uname.uname.members)
|
203
197
|
end
|
204
198
|
|
205
199
|
# The following tests are win32 only
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: sys-uname
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.7.4
|
7
|
+
date: 2006-11-19 00:00:00 -07:00
|
8
8
|
summary: An interface for returning uname (platform) information
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,8 +34,8 @@ files:
|
|
34
34
|
- README
|
35
35
|
- CHANGES
|
36
36
|
- MANIFEST
|
37
|
-
- extconf.rb
|
38
|
-
-
|
37
|
+
- ext/extconf.rb
|
38
|
+
- ext/uname.c
|
39
39
|
test_files:
|
40
40
|
- test/tc_uname.rb
|
41
41
|
rdoc_options: []
|
@@ -44,10 +44,11 @@ extra_rdoc_files:
|
|
44
44
|
- CHANGES
|
45
45
|
- README
|
46
46
|
- MANIFEST
|
47
|
+
- doc/uname.txt
|
47
48
|
executables: []
|
48
49
|
|
49
50
|
extensions:
|
50
|
-
- extconf.rb
|
51
|
+
- ext/extconf.rb
|
51
52
|
requirements: []
|
52
53
|
|
53
54
|
dependencies: []
|
data/extconf.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
##########################
|
2
|
-
# extconf.rb - sys-uname
|
3
|
-
##########################
|
4
|
-
require "mkmf"
|
5
|
-
require "ftools"
|
6
|
-
|
7
|
-
if PLATFORM.match('mswin')
|
8
|
-
STDERR.puts "Run 'ruby install.rb' instead for Windows"
|
9
|
-
STDERR.puts "Exiting..."
|
10
|
-
exit
|
11
|
-
else
|
12
|
-
File.delete("uname.c") if File.exists?("uname.c")
|
13
|
-
File.symlink("lib/os/unix.c","uname.c")
|
14
|
-
end
|
15
|
-
|
16
|
-
if RUBY_PLATFORM =~ /sunos|solaris/i
|
17
|
-
have_header("sys/systeminfo.h")
|
18
|
-
end
|
19
|
-
|
20
|
-
########################################################################
|
21
|
-
# Move any ".rb" files under 'lib/os/' to ".orig" to prevent mkmf from
|
22
|
-
# installing them during the 'make site-install' phase.
|
23
|
-
########################################################################
|
24
|
-
Dir["lib/os/*.rb"].each{ |f|
|
25
|
-
File.rename(f,"lib/os/" + File.basename(f,".rb")+".orig")
|
26
|
-
}
|
27
|
-
|
28
|
-
create_makefile("sys/uname")
|