sys-cpu 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +12 -0
- data/MANIFEST +28 -0
- data/README +20 -19
- data/doc/{freebsd.txt → bsd.txt} +8 -6
- data/doc/hpux.txt +4 -4
- data/doc/sunos.txt +4 -2
- data/doc/windows.txt +3 -3
- data/ext/bsd/bsd.c +252 -0
- data/ext/extconf.rb +24 -0
- data/ext/hpux/hpux.c +219 -0
- data/{lib/sys → ext/sunos}/sunos.c +20 -17
- data/{lib → ext}/version.h +1 -1
- data/test/tc_bsd.rb +56 -0
- data/test/tc_cpu.rb +17 -0
- data/test/tc_hpux.rb +13 -27
- data/test/tc_linux.rb +5 -12
- data/test/tc_sunos.rb +8 -25
- data/test/tc_version.rb +1 -29
- data/test/tc_windows.rb +11 -18
- metadata +20 -12
- data/extconf.rb +0 -36
- data/test/tc_freebsd.rb +0 -71
- data/test/ts_all.rb +0 -17
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: sys-cpu
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date:
|
6
|
+
version: 0.6.0
|
7
|
+
date: 2007-04-26 00:00:00 -06:00
|
8
8
|
summary: A Ruby interface for providing CPU information
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email: djberg96
|
11
|
+
email: djberg96 at nospam at gmail dot com
|
12
12
|
homepage: http://www.rubyforge.org/projects/sysutils
|
13
13
|
rubyforge_project: sysutils
|
14
14
|
description: A Ruby interface for providing CPU information
|
@@ -29,34 +29,42 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Daniel J. Berger
|
31
31
|
files:
|
32
|
-
- doc/
|
32
|
+
- doc/bsd.txt
|
33
33
|
- doc/hpux.txt
|
34
34
|
- doc/linux.txt
|
35
35
|
- doc/sunos.txt
|
36
36
|
- doc/windows.txt
|
37
|
-
- test/
|
37
|
+
- test/tc_bsd.rb
|
38
|
+
- test/tc_cpu.rb
|
38
39
|
- test/tc_hpux.rb
|
39
40
|
- test/tc_linux.rb
|
40
41
|
- test/tc_sunos.rb
|
41
42
|
- test/tc_version.rb
|
42
43
|
- test/tc_windows.rb
|
43
|
-
- test/ts_all.rb
|
44
44
|
- CHANGES
|
45
45
|
- README
|
46
|
-
-
|
47
|
-
-
|
48
|
-
-
|
46
|
+
- MANIFEST
|
47
|
+
- ext/sunos/sunos.c
|
48
|
+
- ext/extconf.rb
|
49
|
+
- ext/bsd
|
50
|
+
- ext/bsd/bsd.c
|
51
|
+
- ext/hpux
|
52
|
+
- ext/hpux/hpux.c
|
53
|
+
- ext/sunos
|
54
|
+
- ext/version.h
|
49
55
|
test_files:
|
50
|
-
- test/
|
56
|
+
- test/tc_cpu.rb
|
51
57
|
rdoc_options: []
|
52
58
|
|
53
59
|
extra_rdoc_files:
|
54
60
|
- CHANGES
|
55
61
|
- README
|
62
|
+
- MANIFEST
|
63
|
+
- ext/sunos/sunos.c
|
56
64
|
executables: []
|
57
65
|
|
58
66
|
extensions:
|
59
|
-
- extconf.rb
|
67
|
+
- ext/extconf.rb
|
60
68
|
requirements: []
|
61
69
|
|
62
70
|
dependencies: []
|
data/extconf.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require "mkmf"
|
2
|
-
require "ftools"
|
3
|
-
|
4
|
-
# Linux and Windows should use install.rb instead
|
5
|
-
if RUBY_PLATFORM =~ /windows|win32|mingw|cygwin|dos|linux/
|
6
|
-
STDERR.puts "For this platform, run 'ruby install.rb' instead"
|
7
|
-
STDERR.puts "Exiting..."
|
8
|
-
exit
|
9
|
-
end
|
10
|
-
|
11
|
-
# Move any .rb files to .orig to prevent them from being installed
|
12
|
-
# during make site-install.
|
13
|
-
File.move("lib/sys/linux.rb","lib/sys/linux.orig") rescue nil
|
14
|
-
File.move("lib/sys/windows.rb","lib/sys/windows.orig") rescue nil
|
15
|
-
|
16
|
-
File.delete('cpu.c') if File.exists?('cpu.c')
|
17
|
-
|
18
|
-
case RUBY_PLATFORM
|
19
|
-
when /hpux/i
|
20
|
-
File.symlink("lib/sys/hpux.c", "cpu.c")
|
21
|
-
create_makefile("sys/cpu")
|
22
|
-
when /sunos|solaris/i
|
23
|
-
File.symlink("lib/sys/sunos.c", "cpu.c")
|
24
|
-
unless have_func("getloadavg")
|
25
|
-
have_library("kstat")
|
26
|
-
end
|
27
|
-
create_makefile("sys/cpu")
|
28
|
-
when /freebsd/i
|
29
|
-
File.symlink("lib/sys/freebsd.c", "cpu.c")
|
30
|
-
have_library("kvm")
|
31
|
-
create_makefile("sys/cpu")
|
32
|
-
when /linux|dos|windows|win32|mingw|cygwin/i
|
33
|
-
STDERR.puts "Run 'ruby install.rb' instead for this platform"
|
34
|
-
else
|
35
|
-
STDERR.puts "This platform is not currently supported. Exiting..."
|
36
|
-
end
|
data/test/tc_freebsd.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
###########################################################
|
2
|
-
# tc_freebsd.rb
|
3
|
-
#
|
4
|
-
# Test suite for sys-cpu on FreeBSD. This should only be
|
5
|
-
# run *after* the make process.
|
6
|
-
###########################################################
|
7
|
-
base = File.basename(Dir.pwd)
|
8
|
-
if base == "test" || base =~ /sys-cpu/
|
9
|
-
require "ftools"
|
10
|
-
Dir.chdir ".." if base == "test"
|
11
|
-
|
12
|
-
Dir.mkdir("sys") unless File.exist?("sys")
|
13
|
-
|
14
|
-
if File.exist?("cpu.so")
|
15
|
-
File.copy("cpu.so","sys")
|
16
|
-
else
|
17
|
-
puts "No cpu.so file found. Please run extconf.rb and make first"
|
18
|
-
exit
|
19
|
-
end
|
20
|
-
|
21
|
-
$LOAD_PATH.unshift Dir.pwd
|
22
|
-
end
|
23
|
-
|
24
|
-
require "sys/cpu"
|
25
|
-
require "test/unit"
|
26
|
-
include Sys
|
27
|
-
|
28
|
-
class TC_FreeBSD < Test::Unit::TestCase
|
29
|
-
def test_architecture
|
30
|
-
assert_respond_to(CPU, :architecture)
|
31
|
-
assert_nothing_raised{ CPU.architecture }
|
32
|
-
assert_kind_of(String,CPU.architecture)
|
33
|
-
assert_raises(ArgumentError){ CPU.architecture(0) }
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_cpu_freq
|
37
|
-
assert_respond_to(CPU, :freq)
|
38
|
-
assert_nothing_raised{ CPU.freq }
|
39
|
-
assert_kind_of(Integer,CPU.freq)
|
40
|
-
assert_raises(ArgumentError){ CPU.freq(0) }
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_load_avg
|
44
|
-
assert_respond_to(CPU, :load_avg)
|
45
|
-
assert_nothing_raised{ CPU.load_avg }
|
46
|
-
assert_kind_of(Array,CPU.load_avg)
|
47
|
-
assert_equal(3,CPU.load_avg.length)
|
48
|
-
assert_raises(ArgumentError){ CPU.load_avg(0) }
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_machine
|
52
|
-
assert_respond_to(CPU, :machine)
|
53
|
-
assert_nothing_raised{ CPU.machine }
|
54
|
-
assert_kind_of(String,CPU.machine)
|
55
|
-
assert_raises(ArgumentError){ CPU.machine(0) }
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_model
|
59
|
-
assert_respond_to(CPU, :model)
|
60
|
-
assert_nothing_raised{ CPU.model }
|
61
|
-
assert_kind_of(String,CPU.model)
|
62
|
-
assert_raises(ArgumentError){ CPU.model(0) }
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_num_cpu
|
66
|
-
assert_respond_to(CPU, :num_cpu)
|
67
|
-
assert_nothing_raised{ CPU.num_cpu }
|
68
|
-
assert_kind_of(Integer,CPU.num_cpu)
|
69
|
-
assert_raises(ArgumentError){ CPU.num_cpu(0) }
|
70
|
-
end
|
71
|
-
end
|
data/test/ts_all.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift Dir.pwd
|
2
|
-
$LOAD_PATH.unshift Dir.pwd + '/test'
|
3
|
-
|
4
|
-
require 'tc_version'
|
5
|
-
|
6
|
-
case RUBY_PLATFORM
|
7
|
-
when /sunos|solaris/i
|
8
|
-
require 'tc_sunos'
|
9
|
-
when /linux/i
|
10
|
-
require 'tc_linux'
|
11
|
-
when /mswin|cygwin|mingw/i
|
12
|
-
require 'tc_windows'
|
13
|
-
when /hpux/i
|
14
|
-
require 'tc_hpux'
|
15
|
-
when /bsd/i
|
16
|
-
require 'tc_freebsd'
|
17
|
-
end
|