sys-cpu 0.8.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,30 +2,30 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'sys-cpu'
5
- spec.version = '0.8.1'
5
+ spec.version = '1.0.1'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.email = 'djberg96@gmail.com'
8
8
  spec.license = 'Apache-2.0'
9
9
  spec.homepage = 'https://github.com/djberg96/sys-cpu'
10
10
  spec.summary = 'A Ruby interface for providing CPU information'
11
- spec.test_file = 'test/test_sys_cpu.rb'
11
+ spec.test_files = Dir['spec/*.rb']
12
12
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
13
  spec.cert_chain = ['certs/djberg96_pub.pem']
14
14
 
15
- spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
15
+ spec.extra_rdoc_files = Dir['*.rdoc']
16
16
 
17
17
  # The ffi dependency is only relevent for the Unix version. Given the
18
18
  # ubiquity of ffi these days, I felt a bogus dependency on ffi for Windows
19
19
  # and Linux was worth the tradeoff of not having to create 3 separate gems.
20
- spec.add_dependency('ffi')
20
+ spec.add_dependency('ffi', '~> 1.1')
21
21
 
22
- spec.add_development_dependency('test-unit')
23
22
  spec.add_development_dependency('rake')
23
+ spec.add_development_dependency('rspec', '~> 3.9')
24
24
 
25
25
  spec.metadata = {
26
26
  'homepage_uri' => 'https://github.com/djberg96/sys-cpu',
27
27
  'bug_tracker_uri' => 'https://github.com/djberg96/sys-cpu/issues',
28
- 'changelog_uri' => 'https://github.com/djberg96/sys-cpu/blob/ffi/CHANGES',
28
+ 'changelog_uri' => 'https://github.com/djberg96/sys-cpu/blob/ffi/CHANGES.md',
29
29
  'documentation_uri' => 'https://github.com/djberg96/sys-cpu/wiki',
30
30
  'source_code_uri' => 'https://github.com/djberg96/sys-cpu',
31
31
  'wiki_uri' => 'https://github.com/djberg96/sys-cpu/wiki'
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-cpu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,24 +35,24 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date:
38
+ date: 2020-12-20 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: ffi
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '1.1'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1.1'
54
54
  - !ruby/object:Gem::Dependency
55
- name: test-unit
55
+ name: rake
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
@@ -66,19 +66,19 @@ dependencies:
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  - !ruby/object:Gem::Dependency
69
- name: rake
69
+ name: rspec
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '3.9'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '3.9'
82
82
  description: |2
83
83
  The sys-cpu library provides an interface for gathering information
84
84
  about your system's processor(s). Information includes speed, type,
@@ -86,63 +86,50 @@ description: |2
86
86
  email: djberg96@gmail.com
87
87
  executables: []
88
88
  extensions: []
89
- extra_rdoc_files:
90
- - CHANGES
91
- - README
92
- - MANIFEST
89
+ extra_rdoc_files: []
93
90
  files:
94
- - CHANGES
95
- - test
96
- - test/test_sys_cpu_hpux.rb
97
- - test/test_sys_cpu_bsd.rb
98
- - test/test_sys_cpu_version.rb
99
- - test/test_sys_cpu_sunos.rb
100
- - test/test_sys_cpu_windows.rb
101
- - test/test_sys_cpu_linux.rb
102
- - test/test_sys_cpu.rb
103
- - examples
104
- - examples/example_sys_cpu_sunos.rb
105
- - examples/example_sys_cpu_hpux.rb
106
- - examples/example_sys_cpu_linux.rb
107
- - examples/example_sys_cpu_windows.rb
108
- - examples/example_sys_cpu_bsd.rb
109
- - doc
91
+ - CHANGES.md
92
+ - Gemfile
93
+ - LICENSE
94
+ - MANIFEST.md
95
+ - README.md
96
+ - Rakefile
97
+ - certs/djberg96_pub.pem
98
+ - doc/bsd.txt
99
+ - doc/hpux.txt
110
100
  - doc/linux.txt
111
101
  - doc/sunos.txt
112
- - doc/bsd.txt
113
102
  - doc/windows.txt
114
- - doc/hpux.txt
115
- - sys-cpu.gemspec
103
+ - examples/example_sys_cpu_bsd.rb
104
+ - examples/example_sys_cpu_hpux.rb
105
+ - examples/example_sys_cpu_linux.rb
106
+ - examples/example_sys_cpu_sunos.rb
107
+ - examples/example_sys_cpu_windows.rb
116
108
  - install.rb
117
- - README
118
- - Rakefile
119
- - MANIFEST
120
- - lib
121
109
  - lib/sys-cpu.rb
122
- - lib/sys
123
110
  - lib/sys/cpu.rb
124
- - lib/sys/windows
125
- - lib/sys/windows/sys
126
- - lib/sys/windows/sys/cpu.rb
127
- - lib/sys/linux
128
- - lib/sys/linux/sys
129
111
  - lib/sys/linux/sys/cpu.rb
130
- - lib/sys/unix
131
- - lib/sys/unix/sys
132
112
  - lib/sys/unix/sys/cpu.rb
133
- - certs
134
- - certs/djberg96_pub.pem
113
+ - lib/sys/windows/sys/cpu.rb
114
+ - spec/spec_helper.rb
115
+ - spec/sys_cpu_bsd_spec.rb
116
+ - spec/sys_cpu_hpux_spec.rb
117
+ - spec/sys_cpu_linux_spec.rb
118
+ - spec/sys_cpu_spec.rb
119
+ - spec/sys_cpu_sunos_spec.rb
120
+ - spec/sys_cpu_windows_spec.rb
121
+ - sys-cpu.gemspec
135
122
  homepage: https://github.com/djberg96/sys-cpu
136
123
  licenses:
137
124
  - Apache-2.0
138
125
  metadata:
139
126
  homepage_uri: https://github.com/djberg96/sys-cpu
140
127
  bug_tracker_uri: https://github.com/djberg96/sys-cpu/issues
141
- changelog_uri: https://github.com/djberg96/sys-cpu/blob/ffi/CHANGES
128
+ changelog_uri: https://github.com/djberg96/sys-cpu/blob/ffi/CHANGES.md
142
129
  documentation_uri: https://github.com/djberg96/sys-cpu/wiki
143
130
  source_code_uri: https://github.com/djberg96/sys-cpu
144
131
  wiki_uri: https://github.com/djberg96/sys-cpu/wiki
145
- post_install_message:
132
+ post_install_message:
146
133
  rdoc_options: []
147
134
  require_paths:
148
135
  - lib
@@ -157,9 +144,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
144
  - !ruby/object:Gem::Version
158
145
  version: '0'
159
146
  requirements: []
160
- rubygems_version: 3.0.6
161
- signing_key:
147
+ rubygems_version: 3.0.3
148
+ signing_key:
162
149
  specification_version: 4
163
150
  summary: A Ruby interface for providing CPU information
164
151
  test_files:
165
- - test/test_sys_cpu.rb
152
+ - spec/spec_helper.rb
153
+ - spec/sys_cpu_bsd_spec.rb
154
+ - spec/sys_cpu_hpux_spec.rb
155
+ - spec/sys_cpu_linux_spec.rb
156
+ - spec/sys_cpu_sunos_spec.rb
157
+ - spec/sys_cpu_windows_spec.rb
158
+ - spec/sys_cpu_spec.rb
metadata.gz.sig CHANGED
Binary file
data/README DELETED
@@ -1,75 +0,0 @@
1
- = Description
2
- A Ruby interface for getting cpu information.
3
-
4
- = Installation
5
- gem install sys-cpu
6
-
7
- = Adding the trusted cert
8
- gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/sys-cpu/ffi/certs/djberg96_pub.pem)
9
-
10
- = Notes
11
- == Solaris
12
- Currently there is no 'processors()' iterative method for multi-cpu systems.
13
- I plan to add it this in a future release.
14
-
15
- == OS X
16
- The CPU.model method returns very limited information. I do not yet know
17
- how to get more detailed information.
18
-
19
- == Linux
20
- This is pure Ruby. This version reads information out of /proc/cpuinfo and
21
- /proc/loadavg, so if /proc isn't mounted it won't work.
22
-
23
- The key-value information in /proc/cpuinfo is stored internally (i.e. in
24
- memory) as an array of hashes when you first 'require' this package. This
25
- overhead is exceptionally minimal, given that your average cpuinfo file
26
- contains less than 1k of text (and I don't store whitespace or newlines).
27
-
28
- The text documentation for Linux is dynamically generated during the
29
- build process because the fields vary depending on your setup. So, don't
30
- look at it until *after* you've installed it. You will see a doc/linux.txt
31
- file after you run 'rake install' (via install.rb).
32
-
33
- == HP-UX
34
- Unlike other platforms, you can get load averages for an individual cpu in
35
- multi-cpu systems. See documentation for more details.
36
-
37
- Note that version 0.7.x and later will not work on HP-UX because of the
38
- switch to FFI and the lack of a testing platform. However, version 0.6.x
39
- will work just fine.
40
-
41
- == MS Windows
42
- This is a pure Ruby implementation using the win32ole package + WMI. The C
43
- version has been scrapped.
44
-
45
- As of version 0.5.0, the CPU.usage method has been removed in favor of the
46
- CPU.load_avg method. This does not (currently) use a perf counter, so there
47
- is no longer any delay. Also, the 'processors' method has been
48
- added and the 'supported' method has been dropped. See the documentation
49
- for other changes.
50
-
51
- = Acknowledgements
52
- Thanks go to the MPlayer team for some source code that helped me on
53
- certain versions of FreeBSD in the original C version.
54
-
55
- = Known Bugs
56
- None that I'm aware of. Please report bugs on the project page at
57
- https://github.com/djberg96/sys-cpu
58
-
59
- = Future Plans
60
- Add iterative CPU.processors method.
61
- Add more information in general, such as what 'prtdiag' shows.
62
-
63
- = License
64
- Artistic 2.0
65
-
66
- = Copyright
67
- (C) 2003-2015 Daniel J. Berger, All Rights Reserved
68
-
69
- = Warranty
70
- This package is provided "as is" and without any express or
71
- implied warranties, including, without limitation, the implied
72
- warranties of merchantability and fitness for a particular purpose.
73
-
74
- = Author
75
- Daniel J. Berger
@@ -1,23 +0,0 @@
1
- #######################################################################
2
- # test_sys_cpu.rb
3
- #
4
- # This isn't a test file, just a file that require's the appropriate
5
- # test file base on the platform you're on.
6
- #######################################################################
7
- require 'rbconfig'
8
- require 'test_sys_cpu_version'
9
-
10
- case RbConfig::CONFIG['host_os']
11
- when /bsd|darwin|mach|osx/i
12
- require 'test_sys_cpu_bsd'
13
- when /hpux/i
14
- require 'test_sys_cpu_hpux'
15
- when /linux/i
16
- require 'test_sys_cpu_linux'
17
- when /sunos|solaris/i
18
- require 'test_sys_cpu_sunos'
19
- when /mswin|win32|dos|mingw|cygwin/i
20
- require 'test_sys_cpu_windows'
21
- else
22
- raise "Platform not supported"
23
- end
@@ -1,97 +0,0 @@
1
- #############################################################
2
- # test_sys_cpu_bsd.rb
3
- #
4
- # The test case for sys-cpu on BSD flavors, including OS X.
5
- #############################################################
6
- require 'sys/cpu'
7
- require 'rbconfig'
8
- require 'test-unit'
9
- require 'test_sys_cpu_version'
10
- include Sys
11
-
12
- class TC_Sys_CPU_BSD < Test::Unit::TestCase
13
- test "architecture method basic functionality" do
14
- assert_respond_to(CPU, :architecture)
15
- assert_nothing_raised{ CPU.architecture }
16
- end
17
-
18
- test "architecture method returns a sane value" do
19
- assert_kind_of(String, CPU.architecture)
20
- assert_true(CPU.architecture.size > 0)
21
- end
22
-
23
- test "architecture method does not accept any arguments" do
24
- assert_raises(ArgumentError){ CPU.architecture(0) }
25
- end
26
-
27
- test "freq method basic functionality" do
28
- assert_respond_to(CPU, :freq)
29
- assert_nothing_raised{ CPU.freq }
30
- end
31
-
32
- test "freq method returns expected value" do
33
- assert_kind_of(Integer, CPU.freq)
34
- assert_true(CPU.freq > 0)
35
- end
36
-
37
- test "freq method does not accept any arguments" do
38
- assert_raises(ArgumentError){ CPU.freq(0) }
39
- end
40
-
41
- test "load_avg method basic functionality" do
42
- assert_respond_to(CPU, :load_avg)
43
- assert_nothing_raised{ CPU.load_avg }
44
- end
45
-
46
- test "load_avg returns the expected results" do
47
- assert_kind_of(Array, CPU.load_avg)
48
- assert_equal(3, CPU.load_avg.length)
49
- assert_kind_of(Float, CPU.load_avg[0])
50
- end
51
-
52
- test "load_avg does not accept any arguments" do
53
- assert_raises(ArgumentError){ CPU.load_avg(0) }
54
- end
55
-
56
- test "machine method basic functionality" do
57
- assert_respond_to(CPU, :machine)
58
- assert_nothing_raised{ CPU.machine }
59
- end
60
-
61
- test "machine method returns sane value" do
62
- assert_kind_of(String, CPU.machine)
63
- assert_true(CPU.machine.size > 0)
64
- end
65
-
66
- test "machine method does not accept any arguments" do
67
- assert_raises(ArgumentError){ CPU.machine(0) }
68
- end
69
-
70
- test "model method basic functionality" do
71
- assert_respond_to(CPU, :model)
72
- assert_nothing_raised{ CPU.model }
73
- end
74
-
75
- test "model method returns sane value" do
76
- assert_kind_of(String, CPU.model)
77
- assert_true(CPU.model.length > 0)
78
- end
79
-
80
- test "model method does not accept any arguments" do
81
- assert_raises(ArgumentError){ CPU.model(0) }
82
- end
83
-
84
- test "num_cpu method basic functionality" do
85
- assert_respond_to(CPU, :num_cpu)
86
- assert_nothing_raised{ CPU.num_cpu }
87
- end
88
-
89
- test "num_cpu method returns expected value" do
90
- assert_kind_of(Integer, CPU.num_cpu)
91
- assert_true(CPU.num_cpu > 0)
92
- end
93
-
94
- test "num_cpu method does not accept any arguments" do
95
- assert_raises(ArgumentError){ CPU.num_cpu(0) }
96
- end
97
- end
@@ -1,49 +0,0 @@
1
- #####################################################################
2
- # test_sys_cpu_hpux.rb
3
- #
4
- # Test suite for the HP-UX platform. This should be run via the
5
- # 'rake test' task.
6
- #####################################################################
7
- require 'sys/cpu'
8
- require 'test-unit'
9
- require 'test_sys_cpu_version'
10
- include Sys
11
-
12
- class TC_Sys_CPU_HPUX < Test::Unit::TestCase
13
- def test_cpu_freq
14
- assert_respond_to(CPU, :freq)
15
- assert_nothing_raised{ CPU.freq }
16
- assert_nothing_raised{ CPU.freq(0) }
17
- assert_kind_of(Integer, CPU.freq, 'Invalid Type')
18
- end
19
-
20
- def test_num_cpu
21
- assert_respond_to(CPU, :num_cpu)
22
- assert_nothing_raised{ CPU.num_cpu }
23
- assert_kind_of(Integer, CPU.num_cpu, 'Invalid Type')
24
- end
25
-
26
- def test_num_active_cpu
27
- assert_respond_to(CPU, :num_active_cpu)
28
- assert_nothing_raised{ CPU.num_active_cpu }
29
- assert_kind_of(Integer, CPU.num_active_cpu, 'Invalid Type')
30
- end
31
-
32
- def test_cpu_architecture
33
- assert_respond_to(CPU, :architecture)
34
- assert_nothing_raised{ CPU.architecture }
35
- assert_kind_of(String, CPU.architecture, 'Invalid Type')
36
- end
37
-
38
- def test_load_avg
39
- assert_respond_to(CPU, :load_avg)
40
- assert_nothing_raised{ CPU.load_avg }
41
- assert_nothing_raised{ CPU.load_avg(0) }
42
- assert_nothing_raised{ CPU.load_avg{ |e| } }
43
- assert_raises(ArgumentError){ CPU.load_avg(0){ } }
44
- assert_kind_of(Array, CPU.load_avg, 'Invalid Type')
45
- assert_kind_of(Array, CPU.load_avg(0), 'Invalid Type')
46
- assert_equal(3, CPU.load_avg.length, 'Bad number of elements')
47
- assert_equal(3, CPU.load_avg(0).length, 'Bad number of elements')
48
- end
49
- end