sys-uname 0.8.4-x86-mingw32

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 ADDED
@@ -0,0 +1,151 @@
1
+ == 0.8.4 - 29-Jan-2010
2
+ * Bug fix for Windows 7, which appears to have removed the QuantumLength and
3
+ QuantumType members of the Win32_OperatingSystem class. Thanks go to Mark
4
+ Seymour for the spot. RubyForge bug # 27645.
5
+ * Changed license to Artistic 2.0.
6
+ * Refactored the Rakefile and gemspec considerably. The gem building code is
7
+ now all inlined within the Rakefile build task itself.
8
+ * Minor doc updates and some code reformatting.
9
+
10
+ == 0.8.3 - 26-Apr-2008
11
+ * Added an explicit "require 'time'" in the Windows version because recent
12
+ versions of Ruby now need it.
13
+ * Changed the way I do platform checks in the Rakefile.
14
+
15
+ == 0.8.2 - 22-Nov-2007
16
+ * Fixed an issue where Ruby no longer parsed a certain type of date that
17
+ MS Windows uses. See RubyForge Bug #10646 for more information.
18
+
19
+ == 0.8.1 - 29-Aug-2007
20
+ * Made a minor modification to the build script for Linux. It turns out Linux
21
+ has sysctl, but not the necessary mibs for the Uname.model method. Thanks go
22
+ to Mickey Knox (?) for the spot.
23
+ * Removed the install.rb file. The code from that program was integrated
24
+ directly into the Rakefile.
25
+
26
+ == 0.8.0 - 10-Apr-2007
27
+ * The Uname.model method should now work on most BSD platforms, not just OS X,
28
+ since it uses the sysctl() function behind the scenes.
29
+ * The 'id' method was changed to 'id_number' on HP-UX to avoid confusion with
30
+ the Object.id method.
31
+ * The UnameError class is now Uname::Error.
32
+ * Added a Rakefile. There are now tasks for building, testing and installing
33
+ this package.
34
+ * Removed some pre-setup code from the test suite that was no longer necessary
35
+ as a result of the Rake test task.
36
+
37
+ == 0.7.4 - 19-Nov-2006
38
+ * Internal layout changes, doc updates and gemspec improvements.
39
+ * No code changes.
40
+
41
+ == 0.7.3 - 30-Jul-2006
42
+ * Bug fix for 64 bit platforms.
43
+ * Minor modification of the extconf.rb file.
44
+
45
+ == 0.7.2 - 5-Jul-2006
46
+ * Removed '?' from the struct member names on MS Windows since these are no
47
+ longer legal.
48
+ * Removed duplicate definition of Uname.version on MS Windows (oops).
49
+ * Added a gemspec.
50
+ * Added inline rdoc documentation to the source files.
51
+
52
+ == 0.7.1 - 5-May-2005
53
+ * Removed the uname.rd file. The uname.txt file is rdoc friendly, so you
54
+ can autogenerate html from that file if you wish.
55
+ * Removed the version.h file - no longer needed now that the Windows version
56
+ is pure Ruby.
57
+ * Renamed test.rb to uname_test.rb
58
+ * Minor setup modifications to the test suite.
59
+ * This package is now hosted on RubyForge.
60
+
61
+ == 0.7.0 - 11-Jan-2004
62
+ * Scrapped the C version for Windows in favor of a pure Ruby version that uses
63
+ WMI + OLE. I highly recommend using Ruby 1.8.2 or later on Win32 systems.
64
+ Earlier versions may cause segfaults.
65
+ * Added the isa_list, hw_provider, hw_serial_number, srpc_domain and
66
+ dhcp_cache methods for Solaris.
67
+ * Added install.rb program for Windows, and modified extconf.rb to only run on
68
+ non-Windows systems.
69
+ * The 'examples' directory has been moved to the toplevel directory.
70
+ * Removed the INSTALL file. That information is now included in the README.
71
+ * Documentation updates.
72
+
73
+ == 0.6.1 - 25-Apr-2004
74
+ * Simplified extconf.rb script and installation instructions.
75
+ * Combined three test scripts into a single test script.
76
+ * Warranty information added.
77
+
78
+ == 0.6.0 - 25-Jun-2003
79
+ * Added HP-UX support, including the id() class method (HP-UX only)
80
+ * Fixed minor bug in extconf.rb (forgot 'require ftools' at top)
81
+ * Added HP-UX specific tests and support
82
+ * Made test.rb friendlier for folks without TestUnit installed
83
+
84
+ == 0.5.0 - 16-Jun-2003
85
+ * Added OS X support, including the "model" method. Thanks to Mike Hall
86
+ for the patch
87
+ * Removed VERSION() class method. Use the constant instead
88
+ * Moved rd documentation to its own file (under /doc directory)
89
+ * Added a version.h file under 'lib' to store VERSION info for
90
+ all source files
91
+ * Modified extconf.rb file to handle OS X support. In addition, moved
92
+ test.rb into a static file under /test, instead of dynamically
93
+ generating it
94
+ * Fixed up test suite. Added OS X specific tests and support. Should now
95
+ work with TestUnit 0.1.6 or later
96
+
97
+ == 0.4.1 - 7-Feb-2003
98
+ * Fixed C89 issue (again) - thanks go to Daniel Zepeda for the spot
99
+ * Fixed bugs in extconf.rb file (rescue clause, ftools)
100
+
101
+ == 0.4.0 - 6-Feb-2003
102
+ * MS Windows support!
103
+ * Added a test suite and automatic test.rb creation
104
+ * Documentation additions/fixes
105
+ * Internal directory layout and filename changes (Changelog -> CHANGES)
106
+
107
+ == 0.3.3 - 6-Jan-2003
108
+ * Made the code C89 compliant for older compilers. Thanks to Paul Brannan
109
+ for teaching me how to fix this in general.
110
+ * Moved README to doc/uname.txt
111
+ * Created an INSTALL file
112
+ * Added a copyright notice
113
+ * Added a VERSION class method
114
+ * Changed tarball name to reflect RAA package name
115
+ * Minor doc changes
116
+
117
+ == 0.3.2 - 8-Aug-2002
118
+ * Changed the struct name returned by the 'uname()' method from
119
+ "Uname::UnameStruct" to just "UnameStruct". This was to make it
120
+ compliant with future versions of Ruby. The extra namespace was
121
+ redundant anyway.
122
+ * I include the documentation now, instead of making you install rd2 :)
123
+
124
+ == 0.3.1 - 22-Jul-2002
125
+ * Added the 'uname' class method, which returns a struct that contains all
126
+ of the uname information
127
+ * Added a test script. Do 'ruby test.rb' to run it.
128
+ * If rd2 is installed on your system, the documentation is automatically
129
+ generated for you.
130
+ * Moved html documentation to 'doc' directory.
131
+ * Changed version number style to be consistent with other 'Sys' modules
132
+ * Now installs into 'Sys-Uname-x.x.x' directory (instead of just 'Uname')
133
+
134
+ == 0.03 - 6-June-2002
135
+ * rd style documentation now inline
136
+ * README.html is now uname.html - created via rdtool
137
+ * The 'platform()' and 'architecture()' methods have been added for Solaris
138
+ * You can now do an 'include Sys' to shorten your syntax
139
+ * The whole 'Sys' class has been removed. Delete your sys.so file if you
140
+ installed a previous version of Sys-Uname
141
+
142
+ == 0.02 - 3-June-2002
143
+ * Potentially fatal memory problems corrected.
144
+ * Should now build with C++ as well
145
+ * Thanks to Mike Hall for both the spot and the fix
146
+ * Added a Changelog file
147
+ * Added a README.html file
148
+ * Added a Manifest file
149
+
150
+ == 0.01 - 31-May-2002
151
+ * Initial release (unannounced)
data/MANIFEST ADDED
@@ -0,0 +1,11 @@
1
+ * MANIFEST
2
+ * CHANGES
3
+ * README
4
+ * Rakefile
5
+ * sys-uname.gemspec
6
+ * doc/uname.txt
7
+ * examples/uname_test.rb
8
+ * ext/extconf.rb
9
+ * ext/uname.c
10
+ * lib/sys/uname.rb
11
+ * test/tc_uname.rb
data/README ADDED
@@ -0,0 +1,36 @@
1
+ = Description
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.
4
+
5
+ = Installation
6
+ gem install sys-uname
7
+
8
+ # If that doesn't work and you're on Windows try this:
9
+ gem install sys-uname --platform x86-mingw32
10
+
11
+ = Synopsis
12
+ require 'sys/uname'
13
+ include Sys
14
+
15
+ p Uname.uname
16
+
17
+ = Solaris Notes
18
+ Folks building this package on SunOS get two extra methods: architecture()
19
+ and platform()
20
+
21
+ = BSD flavors, including OS X
22
+ Users on BSD platforms get the extra Uname.model method.
23
+
24
+ = HP-UX Notes
25
+ HP-UX users get the extra Uname.id_number method. This is actually a
26
+ String, not a Fixnum, because that's how it's defined in the utsname
27
+ struct.
28
+
29
+ = MS Windows Notes
30
+ The C version for Windows has been completely scrapped in favor of an OLE
31
+ plus WMI approach. It is pure Ruby. Please see the MSDN documentation for
32
+ the Win32_OperatingSystem class for a complete list of what each of the
33
+ UnameStruct members mean.
34
+
35
+ = Documentation
36
+ For more details, see the 'uname.txt' file under the 'doc' directory.
data/Rakefile ADDED
@@ -0,0 +1,85 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+ include Config
6
+
7
+ desc "Clean the build files for the sys-uname source for UNIX systems"
8
+ task :clean do
9
+ Dir.chdir('ext') do
10
+ unless CONFIG['host_os'] =~ /mswin|windows|mingw|cygwin|dos/i
11
+ build_file = 'uname.' + Config::CONFIG['DLEXT']
12
+ rm "sys/#{build_file}" if File.exists?("sys/#{build_file}")
13
+ sh 'make distclean' if File.exists?(build_file)
14
+ end
15
+ end
16
+ end
17
+
18
+ desc "Build the sys-uname library on UNIX systems (but don't install it)"
19
+ task :build => [:clean] do
20
+ Dir.chdir('ext') do
21
+ unless CONFIG['host_os'] =~ /mswin|windows|mingw|cygwin|dos/i
22
+ ruby 'extconf.rb'
23
+ sh 'make'
24
+ build_file = 'uname.' + Config::CONFIG['DLEXT']
25
+ cp build_file, 'sys' # For testing
26
+ end
27
+ end
28
+ end
29
+
30
+ desc "Run the example program"
31
+ task :example => [:build] do
32
+ if CONFIG['host_os'] =~ /mswin|windows|mingw|cygwin|dos/i
33
+ sh 'ruby -Ilib examples/uname_test.rb'
34
+ else
35
+ sh 'ruby -Iext examples/uname_test.rb'
36
+ end
37
+ end
38
+
39
+ namespace 'sys' do
40
+ desc "Install the sys-uname library (system)"
41
+ task :install do
42
+ if CONFIG['host_os'] =~ /mswin|windows|mingw|cygwin|dos/i
43
+ dir = File.join(CONFIG['sitelibdir'], 'sys')
44
+ Dir.mkdir(dir) unless File.exists?(dir)
45
+ FileUtils.cp('lib/sys/uname.rb', dir, :verbose => true)
46
+ else
47
+ Dir.chdir('ext') do
48
+ sh 'make install'
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ namespace 'gem' do
55
+ desc "Build the sys-uname gem"
56
+ task :build do
57
+ spec = eval(IO.read('sys-uname.gemspec'))
58
+ if CONFIG['host_os'] =~ /windows|dos|mswin|mingw|cygwin/i
59
+ spec.files = spec.files.reject{ |f| f.include?('ext') }
60
+ spec.platform = Gem::Platform::CURRENT
61
+ else
62
+ spec.files = spec.files.reject{ |f| f.include?('lib') }
63
+ spec.extensions = ['ext/extconf.rb']
64
+ spec.extra_rdoc_files += ['ext/sys/uname.c']
65
+ end
66
+ Gem::Builder.new(spec).build
67
+ end
68
+
69
+ desc "Install the sys-uname gem"
70
+ task :install => [:build] do
71
+ file = Dir['sys-uname*.gem'].first
72
+ sh "gem install #{file}"
73
+ end
74
+ end
75
+
76
+ desc "Run the test suite"
77
+ Rake::TestTask.new("test") do |t|
78
+ if CONFIG['host_os'] =~ /mswin|windows|mingw|cygwin|dos/i
79
+ t.libs << 'lib'
80
+ else
81
+ task :test => :build
82
+ t.libs << 'ext'
83
+ t.libs.delete('lib')
84
+ end
85
+ end
data/doc/uname.txt ADDED
@@ -0,0 +1,127 @@
1
+ == Description
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.
4
+
5
+ == Synopsis
6
+ require 'sys/uname'
7
+ include Sys
8
+
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
15
+
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'
22
+
23
+ == Constants
24
+ VERSION
25
+ The current version number of the sys-uname library. This is a String.
26
+
27
+ == Class Methods
28
+ Uname.sysname
29
+ Returns the operating system name. e.g. "SunOS"
30
+
31
+ Uname.nodename
32
+ Returns the nodename. This is usually, but not necessarily, the
33
+ same as the system's hostname.
34
+
35
+ You cannot currently set the nodename (root or otherwise). This may
36
+ be added in a future release.
37
+
38
+ Uname.machine
39
+ Returns the machine hardware type. e.g. "i686"
40
+
41
+ Uname.version
42
+ Returns the operating system version. e.g. "5.8". In the case of MS
43
+ Windows, it returns the version plus patch information, separated by
44
+ a hyphen, e.g. "2915-Service Pack 2".
45
+
46
+ Uname.release
47
+ Returns the operating system release. e.g. "2.2.16-3"
48
+
49
+ Uname.uname
50
+ Returns a struct of type UnameStruct that contains sysname, nodename,
51
+ machine, version, and release. On Solaris, it will also include
52
+ architecture and platform. On HP-UX, it will also include id_number.
53
+
54
+ MS Windows - there are many more, and different, fields in the struct.
55
+ Please see the MSDN documenation on the Win32_OperatingSystem WMI class
56
+ for a complete explanation of what each of these members mean.
57
+
58
+ == Solaris Only
59
+ Uname.architecture
60
+ Returns the instruction set architecture. e.g. "sparc"
61
+
62
+ Uname.platform
63
+ Returns the platform identifier. e.g. "SUNW,Sun-Blade-100"
64
+
65
+ Uname.isa_list
66
+ Returns a space separated string containing a list of all variant
67
+ instruction set architectures executable on the current system.
68
+
69
+ They are listed in order of performance, from best to worst.
70
+
71
+ Uname.hw_provider
72
+ Returns the name of the hardware manufacturer.
73
+
74
+ Uname.hw_serial_number
75
+ Returns the ASCII representation of the hardware-specific serial number
76
+ of the machine that executes the function.
77
+
78
+ Uname.srpc_domain
79
+ Returns the name of the Secure Remote Procedure Call domain, if any.
80
+
81
+ Uname.dhcp_cache
82
+ Returns a hexidecimal encoding, in String form, of the name of the
83
+ interface configured by boot(1M) followed by the DHCPACK reply from
84
+ the server.
85
+
86
+ == BSD Platforms Only (including OS X)
87
+ Uname.model
88
+ Returns the model type, e.g. "PowerBook5,1"
89
+
90
+ == HP-UX Only
91
+ Uname.id
92
+ Returns the id number, e.g. 234233587. This is a String, not a Fixnum.
93
+
94
+ == Notes
95
+ Not all of the information that you might be used to seeing with
96
+ a 'uname -a' is available. This may be added in future releases,
97
+ but since different implementations provide different information
98
+ (via different header files) it will be a bit of a pain.
99
+
100
+ Windows users - please see the MSDN documentation for the
101
+ Win32_OperatingSystem class for a complete list of what each of the
102
+ UnameStruct members mean.
103
+
104
+ == Known Bugs
105
+ None that I'm aware of. Please log any bugs on the project page at
106
+ http://www.rubyforge.org/projects/sysutils.
107
+
108
+ == Future Plans
109
+ Add additional info for Linux, Solaris, BSD.
110
+
111
+ == License
112
+ Artistic 2.0
113
+
114
+ == Copyright
115
+ (C) 2002-2010 Daniel J. Berger
116
+ All Rights Reserved
117
+
118
+ == Warranty
119
+ This package is provided "as is" and without any express or
120
+ implied warranties, including, without limitation, the implied
121
+ warranties of merchantability and fitness for a particular purpose.
122
+
123
+ == Author
124
+ Daniel Berger
125
+
126
+ == See Also
127
+ uname(1) for unix, or WMI for MS Windows.
@@ -0,0 +1,41 @@
1
+ ########################################################################
2
+ # uname_test.rb
3
+ #
4
+ # Generic test script for general futzing. Modify as you see fit. This
5
+ # should generally be run via the 'rake example' task.
6
+ ########################################################################
7
+ require 'sys/uname'
8
+ include Sys
9
+
10
+ puts "VERSION: " + Uname::VERSION
11
+ puts 'Nodename: ' + Uname.nodename
12
+ puts 'Sysname: ' + Uname.sysname
13
+ puts 'Version: ' + Uname.version
14
+ puts 'Release: ' + Uname.release
15
+ puts 'Machine: ' + Uname.machine # May be "unknown" on Win32
16
+
17
+ if RUBY_PLATFORM =~ /sun|solaris/i
18
+ print "\nSolaris specific tests\n"
19
+ puts "==========================="
20
+ puts 'Architecture: ' + Uname.architecture
21
+ puts 'Platform: ' + Uname.platform
22
+ puts 'Instruction Set List: ' + Uname.isa_list.split.join(", ")
23
+ puts 'Hardware Provider: ' + Uname.hw_provider
24
+ puts 'Serial Number: ' + Uname.hw_serial_number.to_s
25
+ puts 'SRPC Domain: ' + Uname.srpc_domain # might be empty
26
+ puts 'DHCP Cache: ' + Uname.dhcp_cache # might be empty
27
+ end
28
+
29
+ if RUBY_PLATFORM =~ /powerpc|darwin|bsd|mach/i
30
+ print "\nBSD/OS X specific tests\n"
31
+ puts "======================="
32
+ puts 'Model: ' + Uname.model
33
+ end
34
+
35
+ if RUBY_PLATFORM =~ /hpux/i
36
+ print "\nHP-UX specific tests\n"
37
+ puts "========================"
38
+ puts "ID: " + Uname.id
39
+ end
40
+
41
+ print "\nTest finished successfully\n"