sys-uname 0.7.4-mswin32 → 0.8.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ == 0.8.0 - 10-Apr-2007
2
+ * The Uname.model method should now work on most BSD platforms, not just OS X,
3
+ since it uses the sysctl() function behind the scenes.
4
+ * The 'id' method was changed to 'id_number' on HP-UX to avoid confusion with
5
+ the Object.id method.
6
+ * The UnameError class is now Uname::Error.
7
+ * Added a Rakefile. There are now tasks for building, testing and installing
8
+ this package.
9
+ * Removed some pre-setup code from the test suite that was no longer necessary
10
+ as a result of the Rake test task.
11
+ * No code changes.
12
+
1
13
  == 0.7.4 - 19-Nov-2006
2
14
  * Internal layout changes, doc updates and gemspec improvements.
3
15
  * No code changes.
data/MANIFEST CHANGED
@@ -1,16 +1,12 @@
1
- install.rb
2
- MANIFEST
3
- CHANGES
4
- README
5
- sys-uname.gemspec
6
-
7
- doc/uname.txt
8
-
9
- examples/uname_test.rb
10
-
11
- ext/extconf.rb
12
- ext/uname.c
13
-
14
- lib/sys/uname.rb
15
-
16
- test/tc_uname.rb
1
+ * install.rb
2
+ * MANIFEST
3
+ * CHANGES
4
+ * Rakefile
5
+ * README
6
+ * sys-uname.gemspec
7
+ * doc/uname.txt
8
+ * examples/uname_test.rb
9
+ * ext/extconf.rb
10
+ * ext/uname.c
11
+ * lib/sys/uname.rb
12
+ * test/tc_uname.rb
data/README CHANGED
@@ -6,14 +6,8 @@
6
6
  Active WMI service (normally on by default).
7
7
 
8
8
  = Installation
9
- === Unix
10
- ruby extconf.rb
11
- make
12
- ruby test/tc_uname.rb (optional)
13
- make site-install
14
- === MS Windows
15
- ruby test\tc_uname.rb (optional)
16
- ruby install.rb
9
+ rake test (optional)
10
+ rake install (non-gem) or rake install_gem (gems)
17
11
 
18
12
  = Synopsis
19
13
  require 'sys/uname'
@@ -25,12 +19,13 @@
25
19
  Folks building this package on SunOS get two extra methods: architecture()
26
20
  and platform()
27
21
 
28
- = OS X Notes
29
- OS X users get the extra method "model()".
22
+ = BSD flavors, including OS X
23
+ Users on BSD platforms get the extra Uname.model method.
30
24
 
31
25
  = HP-UX Notes
32
- HP-UX users get the extra method "id()". This is actually a String, not
33
- a Fixnum, because that's how it's defined in the utsname struct.
26
+ HP-UX users get the extra Uname.id_number method. This is actually a
27
+ String, not a Fixnum, because that's how it's defined in the utsname
28
+ struct.
34
29
 
35
30
  = MS Windows Notes
36
31
  The C version for Windows has been completely scrapped in favor of an OLE
@@ -39,4 +34,4 @@
39
34
  UnameStruct members mean.
40
35
 
41
36
  = Documentation
42
- For more details, see the 'uname.txt' file under the 'doc' directory.
37
+ For more details, see the 'uname.txt' file under the 'doc' directory.
data/Rakefile ADDED
@@ -0,0 +1,72 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+
5
+ desc "Clean the build files for the sys-uname source for UNIX systems"
6
+ task :clean do
7
+ FileUtils.rm_rf('sys') if File.exists?('sys')
8
+
9
+ Dir.chdir('ext') do
10
+ unless RUBY_PLATFORM.match('mswin')
11
+ FileUtils.rm_rf('sys') if File.exists?('sys')
12
+ build_file = 'uname.' + Config::CONFIG['DLEXT']
13
+ sh 'make distclean' if File.exists?(build_file)
14
+ end
15
+ end
16
+ end
17
+
18
+ desc "Build the sys-uname package on UNIX systems (but don't install it)"
19
+ task :build => [:clean] do
20
+ Dir.chdir('ext') do
21
+ unless RUBY_PLATFORM.match('mswin')
22
+ ruby 'extconf.rb'
23
+ sh 'make'
24
+ build_file = 'uname.' + Config::CONFIG['DLEXT']
25
+ Dir.mkdir('sys') unless File.exists?('sys')
26
+ FileUtils.cp(build_file, 'sys')
27
+ end
28
+ end
29
+ end
30
+
31
+ desc "Run the example program"
32
+ task :example => [:build] do
33
+ Dir.mkdir('sys') unless File.exists?('sys')
34
+ if RUBY_PLATFORM.match('mswin')
35
+ sh 'ruby -Ilib examples/uname_test.rb'
36
+ else
37
+ sh 'ruby -Iext examples/uname_test.rb'
38
+ end
39
+ end
40
+
41
+ if RUBY_PLATFORM.match('mswin')
42
+ desc "Install the sys-uname package (non-gem)"
43
+ task :install do
44
+ sh 'ruby install.rb'
45
+ end
46
+ else
47
+ desc "Install the sys-uname package"
48
+ task :install => [:build] do
49
+ Dir.chdir('ext') do
50
+ sh 'make install'
51
+ end
52
+ end
53
+ end
54
+
55
+ desc "Install the sys-uname package as a gem"
56
+ task :install_gem do
57
+ ruby 'sys-uname.gemspec'
58
+ file = Dir['sys-uname*.gem'].first
59
+ sh "gem install #{file}"
60
+ end
61
+
62
+ desc "Run the test suite"
63
+ Rake::TestTask.new("test") do |t|
64
+ if RUBY_PLATFORM.match('mswin')
65
+ t.libs << 'lib'
66
+ else
67
+ task :test => :build
68
+ t.libs << 'ext'
69
+ t.libs.delete('lib')
70
+ end
71
+ t.test_files = FileList['test/tc_uname.rb']
72
+ end
data/doc/uname.txt CHANGED
@@ -76,7 +76,7 @@ Uname.dhcp_cache
76
76
  interface configured by boot(1M) followed by the DHCPACK reply from
77
77
  the server.
78
78
 
79
- == OS X Only
79
+ == BSD Platforms Only (including OS X)
80
80
  Uname.model
81
81
  Returns the model type, e.g. "PowerBook5,1"
82
82
 
@@ -105,7 +105,7 @@ Uname.id
105
105
  Ruby's
106
106
 
107
107
  == Copyright
108
- (C) 2002-2006 Daniel J. Berger
108
+ (C) 2002-2007 Daniel J. Berger
109
109
  All Rights Reserved
110
110
 
111
111
  == Warranty
@@ -115,8 +115,8 @@ Uname.id
115
115
 
116
116
  == Author
117
117
  Daniel Berger
118
- djberg96 at gmail dot com
118
+ djberg96 at nospam at gmail dot com
119
119
  imperator on IRC (Freenode)
120
120
 
121
121
  == See Also
122
- uname(1) for unix, or WMI for MS Windows.
122
+ uname(1) for unix, or WMI for MS Windows.
data/lib/sys/uname.rb CHANGED
@@ -3,12 +3,13 @@ require 'socket'
3
3
  require 'parsedate'
4
4
 
5
5
  module Sys
6
- # This is the error raised if any of the Sys::Uname methods should fail.
7
- class UnameError < StandardError; end
8
6
 
9
7
  # An interface for returning uname (platform) information.
10
8
  class Uname
11
- VERSION = '0.7.4'
9
+ # This is the error raised if any of the Sys::Uname methods should fail.
10
+ class Error < StandardError; end
11
+
12
+ VERSION = '0.8.0'
12
13
 
13
14
  fields = %w/
14
15
  boot_device
@@ -81,7 +82,7 @@ module Sys
81
82
  begin
82
83
  wmi = WIN32OLE.connect(cs)
83
84
  rescue WIN32OLERuntimeError => e
84
- raise UnameError, e
85
+ raise Error, e
85
86
  else
86
87
  query = "select * from Win32_OperatingSystem"
87
88
  wmi.InstancesOf("Win32_OperatingSystem").each{ |ole|
@@ -100,7 +101,7 @@ module Sys
100
101
  begin
101
102
  wmi = WIN32OLE.connect(cs)
102
103
  rescue WIN32OLERuntimeError => e
103
- raise UnameError, e
104
+ raise Error, e
104
105
  else
105
106
  query = "select * from Win32_OperatingSystem"
106
107
  wmi.InstancesOf("Win32_OperatingSystem").each{ |ole|
@@ -118,7 +119,7 @@ module Sys
118
119
  begin
119
120
  wmi = WIN32OLE.connect(cs)
120
121
  rescue WIN32OLERuntimeError => e
121
- raise UnameError, e
122
+ raise Error, e
122
123
  else
123
124
  query = "select * from Win32_OperatingSystem"
124
125
  wmi.InstancesOf("Win32_OperatingSystem").each{ |ole|
@@ -139,7 +140,7 @@ module Sys
139
140
  begin
140
141
  wmi = WIN32OLE.connect(cs)
141
142
  rescue WIN32OLERuntimeError => e
142
- raise UnameError, e
143
+ raise Error, e
143
144
  else
144
145
  # Convert a family number into the equivalent string
145
146
  case wmi.Family
@@ -362,7 +363,7 @@ module Sys
362
363
  begin
363
364
  wmi = WIN32OLE.connect(cs)
364
365
  rescue WIN32OLERuntimeError => e
365
- raise UnameError, e
366
+ raise Error, e
366
367
  else
367
368
  query = "select * from Win32_OperatingSystem"
368
369
  wmi.InstancesOf("Win32_OperatingSystem").each{ |ole|
@@ -380,7 +381,7 @@ module Sys
380
381
  begin
381
382
  wmi = WIN32OLE.connect(cs)
382
383
  rescue WIN32OLERuntimeError => e
383
- raise UnameError, e
384
+ raise Error, e
384
385
  else
385
386
  query = "select * from Win32_OperatingSystem"
386
387
  wmi.InstancesOf("Win32_OperatingSystem").each{ |os|
data/sys-uname.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |gem|
4
4
  gem.name = 'sys-uname'
5
- gem.version = '0.7.4'
5
+ gem.version = '0.8.0'
6
6
  gem.author = 'Daniel J. Berger'
7
7
  gem.email = 'djberg96@gmail.com'
8
8
  gem.homepage = 'http://www.rubyforge.org/projects/sysutils'
@@ -27,6 +27,7 @@ if $PROGRAM_NAME == __FILE__
27
27
  spec.required_ruby_version = '>= 1.8.0'
28
28
  spec.extensions = ['ext/extconf.rb']
29
29
  spec.files += ['ext/uname.c']
30
+ spec.extra_rdoc_files += ['ext/uname.c']
30
31
  end
31
32
 
32
33
  Gem.manage_gems
data/test/tc_uname.rb CHANGED
@@ -1,30 +1,9 @@
1
1
  ##############################################################################
2
2
  # tc_uname.rb
3
3
  #
4
- # Test suite for the sys-uname package.
4
+ # Test suite for the sys-uname package. This test suite should be run via
5
+ # the 'rake test' task.
5
6
  ##############################################################################
6
- base = File.basename(Dir.pwd)
7
-
8
- if base == 'test' || base =~ /sys-uname/
9
- Dir.chdir('..') if base == 'test'
10
-
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
- else
21
- File.copy('ext/' + file, 'sys')
22
- end
23
- end
24
-
25
- $LOAD_PATH.unshift(Dir.pwd)
26
- end
27
-
28
7
  require 'sys/uname'
29
8
  require 'test/unit'
30
9
  include Sys
@@ -39,7 +18,7 @@ class TC_Uname < Test::Unit::TestCase
39
18
  assert_not_nil(Uname::VERSION)
40
19
  assert_nothing_raised{ Uname::VERSION }
41
20
  assert_kind_of(String, Uname::VERSION)
42
- assert_equal('0.7.4', Uname::VERSION)
21
+ assert_equal('0.8.0', Uname::VERSION)
43
22
  end
44
23
 
45
24
  def test_machine
@@ -143,7 +122,7 @@ class TC_Uname < Test::Unit::TestCase
143
122
  end
144
123
 
145
124
  def test_model
146
- if RUBY_PLATFORM =~ /darwin|powerpc/i
125
+ if RUBY_PLATFORM =~ /darwin|powerpc|bsd|mach/i
147
126
  assert_respond_to(Uname, :model)
148
127
  assert_nothing_raised{ Uname.model }
149
128
  assert_kind_of(String, Uname.model)
@@ -152,13 +131,13 @@ class TC_Uname < Test::Unit::TestCase
152
131
  end
153
132
  end
154
133
 
155
- def test_id
134
+ def test_id_number
156
135
  if RUBY_PLATFORM =~ /hpux/i
157
- assert_respond_to(Uname, :id)
158
- assert_nothing_raised{ Uname.id }
159
- assert_kind_of(String, Uname.id)
136
+ assert_respond_to(Uname, :id_number)
137
+ assert_nothing_raised{ Uname.id_number }
138
+ assert_kind_of(String, Uname.id_number)
160
139
  else
161
- puts '"id" test skipped on this platform'
140
+ puts '"test_id_number" test skipped on this platform'
162
141
  end
163
142
  end
164
143
 
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: sys-uname
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.4
7
- date: 2006-11-19 00:00:00 -07:00
6
+ version: 0.8.0
7
+ date: 2007-04-11 00:00:00 -06:00
8
8
  summary: An interface for returning uname (platform) information
9
9
  require_paths:
10
10
  - lib
@@ -38,8 +38,8 @@ files:
38
38
  - install.rb
39
39
  - lib
40
40
  - MANIFEST
41
+ - Rakefile
41
42
  - README
42
- - sys-uname-0.7.4-mswin32.gem
43
43
  - sys-uname.gemspec
44
44
  - test
45
45
  - lib/sys/uname.rb
File without changes