sys-uname 0.8.2 → 0.8.3
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 +5 -0
- data/Rakefile +5 -5
- data/doc/uname.txt +19 -14
- data/ext/sys/uname.c +2 -2
- data/test/tc_uname.rb +14 -12
- metadata +3 -3
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.8.3 - 26-Apr-2008
|
2
|
+
* Added an explicit "require 'time'" in the Windows version because recent
|
3
|
+
versions of Ruby now need it.
|
4
|
+
* Changed the way I do platform checks in the Rakefile.
|
5
|
+
|
1
6
|
== 0.8.2 - 22-Nov-2007
|
2
7
|
* Fixed an issue where Ruby no longer parsed a certain type of date that
|
3
8
|
MS Windows uses. See RubyForge Bug #10646 for more information.
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ include Config
|
|
7
7
|
desc "Clean the build files for the sys-uname source for UNIX systems"
|
8
8
|
task :clean do
|
9
9
|
Dir.chdir('ext') do
|
10
|
-
unless
|
10
|
+
unless CONFIG['host_os'] =~ /mswin|windows/i
|
11
11
|
build_file = 'uname.' + Config::CONFIG['DLEXT']
|
12
12
|
rm "sys/#{build_file}" if File.exists?("sys/#{build_file}")
|
13
13
|
sh 'make distclean' if File.exists?(build_file)
|
@@ -18,7 +18,7 @@ end
|
|
18
18
|
desc "Build the sys-uname package on UNIX systems (but don't install it)"
|
19
19
|
task :build => [:clean] do
|
20
20
|
Dir.chdir('ext') do
|
21
|
-
unless
|
21
|
+
unless CONFIG['host_os'] =~ /mswin|windows/i
|
22
22
|
ruby 'extconf.rb'
|
23
23
|
sh 'make'
|
24
24
|
build_file = 'uname.' + Config::CONFIG['DLEXT']
|
@@ -29,14 +29,14 @@ end
|
|
29
29
|
|
30
30
|
desc "Run the example program"
|
31
31
|
task :example => [:build] do
|
32
|
-
if
|
32
|
+
if CONFIG['host_os'] =~ /mswin|windows/i
|
33
33
|
sh 'ruby -Ilib examples/uname_test.rb'
|
34
34
|
else
|
35
35
|
sh 'ruby -Iext examples/uname_test.rb'
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
if
|
39
|
+
if CONFIG['host_os'] =~ /mswin|windows/i
|
40
40
|
desc "Install the sys-uname package (non-gem)"
|
41
41
|
task :install do
|
42
42
|
Dir.mkdir(dir) unless File.exists?(dir)
|
@@ -60,7 +60,7 @@ end
|
|
60
60
|
|
61
61
|
desc "Run the test suite"
|
62
62
|
Rake::TestTask.new("test") do |t|
|
63
|
-
if
|
63
|
+
if CONFIG['host_os'] =~ /mswin|windows/i
|
64
64
|
t.libs << 'lib'
|
65
65
|
else
|
66
66
|
task :test => :build
|
data/doc/uname.txt
CHANGED
@@ -1,21 +1,28 @@
|
|
1
1
|
== Description
|
2
|
-
A Ruby interface
|
2
|
+
A Ruby interface for getting operating system information. The name comes
|
3
|
+
from the Unix 'uname' command, but this library works on Windows as well.
|
3
4
|
|
4
5
|
== Synopsis
|
5
6
|
require 'sys/uname'
|
6
7
|
include Sys
|
7
8
|
|
8
|
-
|
9
|
-
puts Uname.
|
10
|
-
puts Uname.
|
11
|
-
puts Uname.
|
12
|
-
puts Uname.
|
9
|
+
# Unix
|
10
|
+
puts Uname.nodename => my_host
|
11
|
+
puts Uname.version => #1 Fri Oct 24 22:43:28 MDT 2003
|
12
|
+
puts Uname.sysname => Linux
|
13
|
+
puts Uname.machine => i686
|
14
|
+
puts Uname.release => 2.4.22-21mdk
|
13
15
|
|
14
|
-
p Uname.uname
|
16
|
+
p Uname.uname => Show all UnameStruct members
|
17
|
+
|
18
|
+
# Windows
|
19
|
+
u = Uname.uname
|
20
|
+
puts u.caption => 'Microsoft Windows XP Home Edition
|
21
|
+
puts u.csd_version => 'Service Pack 2'
|
15
22
|
|
16
23
|
== Constants
|
17
24
|
VERSION
|
18
|
-
The current version number of sys-uname.
|
25
|
+
The current version number of the sys-uname library. This is a String.
|
19
26
|
|
20
27
|
== Class Methods
|
21
28
|
Uname.sysname
|
@@ -42,11 +49,11 @@ Uname.release
|
|
42
49
|
Uname.uname
|
43
50
|
Returns a struct of type UnameStruct that contains sysname, nodename,
|
44
51
|
machine, version, and release. On Solaris, it will also include
|
45
|
-
architecture and platform. On HP-UX, it will also include
|
52
|
+
architecture and platform. On HP-UX, it will also include id_number.
|
46
53
|
|
47
54
|
MS Windows - there are many more, and different, fields in the struct.
|
48
|
-
Please see the MSDN documenation
|
49
|
-
each of these members mean.
|
55
|
+
Please see the MSDN documenation on the Win32_OperatingSystem WMI class
|
56
|
+
for a complete explanation of what each of these members mean.
|
50
57
|
|
51
58
|
== Solaris Only
|
52
59
|
Uname.architecture
|
@@ -105,7 +112,7 @@ Uname.id
|
|
105
112
|
Ruby's
|
106
113
|
|
107
114
|
== Copyright
|
108
|
-
(C) 2002-
|
115
|
+
(C) 2002-2008 Daniel J. Berger
|
109
116
|
All Rights Reserved
|
110
117
|
|
111
118
|
== Warranty
|
@@ -115,8 +122,6 @@ Uname.id
|
|
115
122
|
|
116
123
|
== Author
|
117
124
|
Daniel Berger
|
118
|
-
djberg96 at nospam at gmail dot com
|
119
|
-
imperator on IRC (Freenode)
|
120
125
|
|
121
126
|
== See Also
|
122
127
|
uname(1) for unix, or WMI for MS Windows.
|
data/ext/sys/uname.c
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
#include <ruby.h>
|
7
7
|
#include <sys/utsname.h>
|
8
8
|
|
9
|
-
#define SYS_UNAME_VERSION "0.8.
|
9
|
+
#define SYS_UNAME_VERSION "0.8.3"
|
10
10
|
|
11
11
|
/* Solaris */
|
12
12
|
#ifdef HAVE_SYS_SYSTEMINFO_H
|
@@ -298,7 +298,7 @@ void Init_uname()
|
|
298
298
|
#endif
|
299
299
|
NULL);
|
300
300
|
|
301
|
-
/* 0.8.
|
301
|
+
/* 0.8.3: The version of this library */
|
302
302
|
rb_define_const(cUname, "VERSION", rb_str_new2(SYS_UNAME_VERSION));
|
303
303
|
}
|
304
304
|
|
data/test/tc_uname.rb
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
##############################################################################
|
7
7
|
require 'sys/uname'
|
8
8
|
require 'test/unit'
|
9
|
+
require 'rbconfig'
|
9
10
|
include Sys
|
11
|
+
include Config
|
10
12
|
|
11
13
|
# For testing purposes only
|
12
14
|
module Boolean; end
|
@@ -18,7 +20,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
18
20
|
assert_not_nil(Uname::VERSION)
|
19
21
|
assert_nothing_raised{ Uname::VERSION }
|
20
22
|
assert_kind_of(String, Uname::VERSION)
|
21
|
-
assert_equal('0.8.
|
23
|
+
assert_equal('0.8.3', Uname::VERSION)
|
22
24
|
end
|
23
25
|
|
24
26
|
def test_machine
|
@@ -52,7 +54,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def test_architecture
|
55
|
-
if
|
57
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
56
58
|
assert_respond_to(Uname, :architecture)
|
57
59
|
assert_nothing_raised{ Uname.architecture }
|
58
60
|
assert_kind_of(String, Uname.architecture)
|
@@ -62,7 +64,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
62
64
|
end
|
63
65
|
|
64
66
|
def test_platform
|
65
|
-
if
|
67
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
66
68
|
assert_respond_to(Uname, :platform)
|
67
69
|
assert_nothing_raised{ Uname.platform }
|
68
70
|
assert_kind_of(String, Uname.platform)
|
@@ -72,7 +74,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
72
74
|
end
|
73
75
|
|
74
76
|
def test_isa_list
|
75
|
-
if
|
77
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
76
78
|
assert_respond_to(Uname, :isa_list)
|
77
79
|
assert_nothing_raised{ Uname.isa_list }
|
78
80
|
assert_kind_of(String, Uname.isa_list)
|
@@ -82,7 +84,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
82
84
|
end
|
83
85
|
|
84
86
|
def test_hw_provider
|
85
|
-
if
|
87
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
86
88
|
assert_respond_to(Uname,:hw_provider)
|
87
89
|
assert_nothing_raised{ Uname.hw_provider }
|
88
90
|
assert_kind_of(String, Uname.hw_provider)
|
@@ -92,7 +94,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def test_hw_serial_number
|
95
|
-
if
|
97
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
96
98
|
assert_respond_to(Uname, :hw_serial_number)
|
97
99
|
assert_nothing_raised{ Uname.hw_serial_number }
|
98
100
|
assert_kind_of(Integer, Uname.hw_serial_number)
|
@@ -102,7 +104,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
102
104
|
end
|
103
105
|
|
104
106
|
def test_srpc_domain
|
105
|
-
if
|
107
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
106
108
|
assert_respond_to(Uname, :srpc_domain)
|
107
109
|
assert_nothing_raised{ Uname.srpc_domain }
|
108
110
|
assert_kind_of(String, Uname.srpc_domain)
|
@@ -112,7 +114,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
112
114
|
end
|
113
115
|
|
114
116
|
def test_dhcp_cache
|
115
|
-
if
|
117
|
+
if CONFIG['host_os'] =~ /sunos|solaris/i
|
116
118
|
assert_respond_to(Uname, :dhcp_cache)
|
117
119
|
assert_nothing_raised{ Uname.dhcp_cache }
|
118
120
|
assert_kind_of(String, Uname.dhcp_cache)
|
@@ -122,7 +124,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
122
124
|
end
|
123
125
|
|
124
126
|
def test_model
|
125
|
-
if
|
127
|
+
if CONFIG['host_os'] =~ /darwin|powerpc|bsd|mach/i
|
126
128
|
assert_respond_to(Uname, :model)
|
127
129
|
assert_nothing_raised{ Uname.model }
|
128
130
|
assert_kind_of(String, Uname.model)
|
@@ -132,7 +134,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
132
134
|
end
|
133
135
|
|
134
136
|
def test_id_number
|
135
|
-
if
|
137
|
+
if CONFIG['host_os'] =~ /hpux/i
|
136
138
|
assert_respond_to(Uname, :id_number)
|
137
139
|
assert_nothing_raised{ Uname.id_number }
|
138
140
|
assert_kind_of(String, Uname.id_number)
|
@@ -143,7 +145,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
143
145
|
|
144
146
|
def test_uname_struct
|
145
147
|
members = %w/sysname nodename machine version release/
|
146
|
-
case
|
148
|
+
case CONFIG['host_os']
|
147
149
|
when /sunos|solaris/i
|
148
150
|
members.push('architecture','platform')
|
149
151
|
when /powerpc|darwin/i
|
@@ -176,7 +178,7 @@ class TC_Uname < Test::Unit::TestCase
|
|
176
178
|
end
|
177
179
|
|
178
180
|
# The following tests are win32 only
|
179
|
-
if
|
181
|
+
if CONFIG['host_os'] =~ /mswin|windows/i
|
180
182
|
def test_boot_device
|
181
183
|
assert_nothing_raised{ Uname.uname.boot_device }
|
182
184
|
assert_kind_of(String, Uname.uname.boot_device)
|
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: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2008-04-26 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements: []
|
57
57
|
|
58
58
|
rubyforge_project: sysutils
|
59
|
-
rubygems_version: 0.
|
59
|
+
rubygems_version: 1.0.1
|
60
60
|
signing_key:
|
61
61
|
specification_version: 2
|
62
62
|
summary: An interface for returning uname (platform) information
|