sys-uname 0.8.6-universal-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,160 @@
1
+ == 0.8.6 - 2-Sep-2011
2
+ * Fixed a failing test for Ruby 1.9.x.
3
+ * The gemspec for Windows is now 'universal'.
4
+ * Some minor doc updates.
5
+
6
+ == 0.8.5 - 11-Dec-2010
7
+ * Removed some non-ascii characters that somehow made it into the source.
8
+ * Some updates to the Rakefile, including a default task.
9
+
10
+ == 0.8.4 - 29-Jan-2010
11
+ * Bug fix for Windows 7, which appears to have removed the QuantumLength and
12
+ QuantumType members of the Win32_OperatingSystem class. Thanks go to Mark
13
+ Seymour for the spot. RubyForge bug # 27645.
14
+ * Changed license to Artistic 2.0.
15
+ * Refactored the Rakefile and gemspec considerably. The gem building code is
16
+ now all inlined within the Rakefile build task itself.
17
+ * Minor doc updates and some code reformatting.
18
+
19
+ == 0.8.3 - 26-Apr-2008
20
+ * Added an explicit "require 'time'" in the Windows version because recent
21
+ versions of Ruby now need it.
22
+ * Changed the way I do platform checks in the Rakefile.
23
+
24
+ == 0.8.2 - 22-Nov-2007
25
+ * Fixed an issue where Ruby no longer parsed a certain type of date that
26
+ MS Windows uses. See RubyForge Bug #10646 for more information.
27
+
28
+ == 0.8.1 - 29-Aug-2007
29
+ * Made a minor modification to the build script for Linux. It turns out Linux
30
+ has sysctl, but not the necessary mibs for the Uname.model method. Thanks go
31
+ to Mickey Knox (?) for the spot.
32
+ * Removed the install.rb file. The code from that program was integrated
33
+ directly into the Rakefile.
34
+
35
+ == 0.8.0 - 10-Apr-2007
36
+ * The Uname.model method should now work on most BSD platforms, not just OS X,
37
+ since it uses the sysctl() function behind the scenes.
38
+ * The 'id' method was changed to 'id_number' on HP-UX to avoid confusion with
39
+ the Object.id method.
40
+ * The UnameError class is now Uname::Error.
41
+ * Added a Rakefile. There are now tasks for building, testing and installing
42
+ this package.
43
+ * Removed some pre-setup code from the test suite that was no longer necessary
44
+ as a result of the Rake test task.
45
+
46
+ == 0.7.4 - 19-Nov-2006
47
+ * Internal layout changes, doc updates and gemspec improvements.
48
+ * No code changes.
49
+
50
+ == 0.7.3 - 30-Jul-2006
51
+ * Bug fix for 64 bit platforms.
52
+ * Minor modification of the extconf.rb file.
53
+
54
+ == 0.7.2 - 5-Jul-2006
55
+ * Removed '?' from the struct member names on MS Windows since these are no
56
+ longer legal.
57
+ * Removed duplicate definition of Uname.version on MS Windows (oops).
58
+ * Added a gemspec.
59
+ * Added inline rdoc documentation to the source files.
60
+
61
+ == 0.7.1 - 5-May-2005
62
+ * Removed the uname.rd file. The uname.txt file is rdoc friendly, so you
63
+ can autogenerate html from that file if you wish.
64
+ * Removed the version.h file - no longer needed now that the Windows version
65
+ is pure Ruby.
66
+ * Renamed test.rb to uname_test.rb
67
+ * Minor setup modifications to the test suite.
68
+ * This package is now hosted on RubyForge.
69
+
70
+ == 0.7.0 - 11-Jan-2004
71
+ * Scrapped the C version for Windows in favor of a pure Ruby version that uses
72
+ WMI + OLE. I highly recommend using Ruby 1.8.2 or later on Win32 systems.
73
+ Earlier versions may cause segfaults.
74
+ * Added the isa_list, hw_provider, hw_serial_number, srpc_domain and
75
+ dhcp_cache methods for Solaris.
76
+ * Added install.rb program for Windows, and modified extconf.rb to only run on
77
+ non-Windows systems.
78
+ * The 'examples' directory has been moved to the toplevel directory.
79
+ * Removed the INSTALL file. That information is now included in the README.
80
+ * Documentation updates.
81
+
82
+ == 0.6.1 - 25-Apr-2004
83
+ * Simplified extconf.rb script and installation instructions.
84
+ * Combined three test scripts into a single test script.
85
+ * Warranty information added.
86
+
87
+ == 0.6.0 - 25-Jun-2003
88
+ * Added HP-UX support, including the id() class method (HP-UX only)
89
+ * Fixed minor bug in extconf.rb (forgot 'require ftools' at top)
90
+ * Added HP-UX specific tests and support
91
+ * Made test.rb friendlier for folks without TestUnit installed
92
+
93
+ == 0.5.0 - 16-Jun-2003
94
+ * Added OS X support, including the "model" method. Thanks to Mike Hall
95
+ for the patch
96
+ * Removed VERSION() class method. Use the constant instead
97
+ * Moved rd documentation to its own file (under /doc directory)
98
+ * Added a version.h file under 'lib' to store VERSION info for
99
+ all source files
100
+ * Modified extconf.rb file to handle OS X support. In addition, moved
101
+ test.rb into a static file under /test, instead of dynamically
102
+ generating it
103
+ * Fixed up test suite. Added OS X specific tests and support. Should now
104
+ work with TestUnit 0.1.6 or later
105
+
106
+ == 0.4.1 - 7-Feb-2003
107
+ * Fixed C89 issue (again) - thanks go to Daniel Zepeda for the spot
108
+ * Fixed bugs in extconf.rb file (rescue clause, ftools)
109
+
110
+ == 0.4.0 - 6-Feb-2003
111
+ * MS Windows support!
112
+ * Added a test suite and automatic test.rb creation
113
+ * Documentation additions/fixes
114
+ * Internal directory layout and filename changes (Changelog -> CHANGES)
115
+
116
+ == 0.3.3 - 6-Jan-2003
117
+ * Made the code C89 compliant for older compilers. Thanks to Paul Brannan
118
+ for teaching me how to fix this in general.
119
+ * Moved README to doc/uname.txt
120
+ * Created an INSTALL file
121
+ * Added a copyright notice
122
+ * Added a VERSION class method
123
+ * Changed tarball name to reflect RAA package name
124
+ * Minor doc changes
125
+
126
+ == 0.3.2 - 8-Aug-2002
127
+ * Changed the struct name returned by the 'uname()' method from
128
+ "Uname::UnameStruct" to just "UnameStruct". This was to make it
129
+ compliant with future versions of Ruby. The extra namespace was
130
+ redundant anyway.
131
+ * I include the documentation now, instead of making you install rd2 :)
132
+
133
+ == 0.3.1 - 22-Jul-2002
134
+ * Added the 'uname' class method, which returns a struct that contains all
135
+ of the uname information
136
+ * Added a test script. Do 'ruby test.rb' to run it.
137
+ * If rd2 is installed on your system, the documentation is automatically
138
+ generated for you.
139
+ * Moved html documentation to 'doc' directory.
140
+ * Changed version number style to be consistent with other 'Sys' modules
141
+ * Now installs into 'Sys-Uname-x.x.x' directory (instead of just 'Uname')
142
+
143
+ == 0.03 - 6-June-2002
144
+ * rd style documentation now inline
145
+ * README.html is now uname.html - created via rdtool
146
+ * The 'platform()' and 'architecture()' methods have been added for Solaris
147
+ * You can now do an 'include Sys' to shorten your syntax
148
+ * The whole 'Sys' class has been removed. Delete your sys.so file if you
149
+ installed a previous version of Sys-Uname
150
+
151
+ == 0.02 - 3-June-2002
152
+ * Potentially fatal memory problems corrected.
153
+ * Should now build with C++ as well
154
+ * Thanks to Mike Hall for both the spot and the fix
155
+ * Added a Changelog file
156
+ * Added a README.html file
157
+ * Added a Manifest file
158
+
159
+ == 0.01 - 31-May-2002
160
+ * 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 universal-mingw32
10
+
11
+ = Synopsis
12
+ require 'sys/uname'
13
+ include Sys
14
+
15
+ p Uname.uname
16
+
17
+ = Solaris Notes
18
+ Folks building this library 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,73 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+ include Config
6
+
7
+ WINDOWS = CONFIG['host_os'] =~ /msdos|mswin|win32|windows|mingw|cygwin/i
8
+
9
+ CLEAN.include(
10
+ '**/*.gem', # Gem files
11
+ '**/*.rbc', # Rubinius
12
+ '**/*.o', # C object file
13
+ '**/*.log', # Ruby extension build log
14
+ '**/Makefile', # C Makefile
15
+ '**/conftest.dSYM', # OS X build directory
16
+ "**/*.#{CONFIG['DLEXT']}" # C shared object
17
+ )
18
+
19
+ desc "Build the source for C extensions"
20
+ task :build => [:clean] do
21
+ Dir.chdir("ext"){
22
+ ruby "extconf.rb"
23
+ sh "make"
24
+ cp "uname." + Config::CONFIG['DLEXT'], 'sys'
25
+ }
26
+ end
27
+
28
+ desc "Run the example program"
29
+ task :example => [:build] do
30
+ if WINDOWS
31
+ sh 'ruby -Ilib examples/uname_test.rb'
32
+ else
33
+ sh 'ruby -Iext examples/uname_test.rb'
34
+ end
35
+ end
36
+
37
+ namespace 'gem' do
38
+ desc "Create the sys-uname gem"
39
+ task :create do
40
+ spec = eval(IO.read('sys-uname.gemspec'))
41
+ if WINDOWS
42
+ spec.files = spec.files.reject{ |f| f.include?('ext') }
43
+ spec.platform = Gem::Platform::CURRENT
44
+ spec.platform.cpu = 'universal'
45
+ spec.platform.version = nil
46
+ spec.original_platform = spec.platform
47
+ else
48
+ spec.files = spec.files.reject{ |f| f.include?('lib') }
49
+ spec.extensions = ['ext/extconf.rb']
50
+ spec.extra_rdoc_files += ['ext/sys/uname.c']
51
+ end
52
+ Gem::Builder.new(spec).build
53
+ end
54
+
55
+ desc "Install the sys-uname gem"
56
+ task :install => [:create] do
57
+ file = Dir['sys-uname*.gem'].first
58
+ sh "gem install #{file}"
59
+ end
60
+ end
61
+
62
+ desc "Run the test suite"
63
+ Rake::TestTask.new("test") do |t|
64
+ if WINDOWS
65
+ t.libs << 'lib'
66
+ else
67
+ task :test => :build
68
+ t.libs << 'ext'
69
+ t.libs.delete('lib')
70
+ end
71
+ end
72
+
73
+ task :default => :test
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_number
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-2011 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"