sys-cpu 1.0.3 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +21 -0
- data/Gemfile +2 -7
- data/README.md +21 -14
- data/Rakefile +4 -1
- data/doc/bsd.md +58 -0
- data/doc/linux.md +46 -0
- data/install.rb +2 -2
- data/lib/sys/cpu.rb +8 -1
- data/lib/sys/darwin/sys/cpu.rb +54 -8
- data/lib/sys/linux/sys/cpu.rb +33 -31
- data/lib/sys/unix/sys/cpu.rb +25 -33
- data/lib/sys/windows/sys/cpu.rb +244 -143
- data/lib/sys-cpu.rb +2 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/sys_cpu_bsd_spec.rb +70 -51
- data/spec/sys_cpu_hpux_spec.rb +33 -28
- data/spec/sys_cpu_linux_spec.rb +32 -26
- data/spec/{sys_cpu_spec.rb → sys_cpu_shared.rb} +10 -4
- data/spec/sys_cpu_sunos_spec.rb +44 -42
- data/spec/sys_cpu_windows_spec.rb +39 -34
- data/sys-cpu.gemspec +10 -9
- data.tar.gz.sig +0 -0
- metadata +40 -11
- metadata.gz.sig +0 -0
- data/doc/bsd.txt +0 -49
- data/doc/linux.txt +0 -41
data/spec/sys_cpu_bsd_spec.rb
CHANGED
@@ -1,94 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#############################################################
|
2
|
-
#
|
4
|
+
# sys_cpu_bsd_spec.rb
|
3
5
|
#
|
4
|
-
#
|
6
|
+
# Specs for sys-cpu on BSD flavors, including OS X.
|
5
7
|
#############################################################
|
6
8
|
require 'sys/cpu'
|
7
9
|
require 'spec_helper'
|
8
10
|
|
9
11
|
RSpec.describe Sys::CPU, :bsd => true do
|
10
|
-
example
|
11
|
-
expect(
|
12
|
-
expect{
|
12
|
+
example 'architecture method basic functionality' do
|
13
|
+
expect(described_class).to respond_to(:architecture)
|
14
|
+
expect{ described_class.architecture }.not_to raise_error
|
15
|
+
end
|
16
|
+
|
17
|
+
example 'architecture method returns a sane value' do
|
18
|
+
expect(described_class.architecture).to be_kind_of(String)
|
19
|
+
expect(described_class.architecture.size).to be > 0
|
13
20
|
end
|
14
21
|
|
15
|
-
example
|
16
|
-
expect
|
17
|
-
expect(Sys::CPU.architecture.size).to be > 0
|
22
|
+
example 'architecture method does not accept any arguments' do
|
23
|
+
expect{ described_class.architecture(0) }.to raise_error(ArgumentError)
|
18
24
|
end
|
19
25
|
|
20
|
-
example
|
21
|
-
expect
|
26
|
+
example 'freq method basic functionality' do
|
27
|
+
expect(described_class).to respond_to(:freq)
|
28
|
+
expect{ described_class.freq }.not_to raise_error
|
22
29
|
end
|
23
30
|
|
24
|
-
example
|
25
|
-
expect(
|
26
|
-
expect
|
31
|
+
example 'freq method returns expected value' do
|
32
|
+
expect(described_class.freq).to be_kind_of(Integer)
|
33
|
+
expect(described_class.freq).to be > 0
|
27
34
|
end
|
28
35
|
|
29
|
-
example
|
30
|
-
expect
|
31
|
-
expect(Sys::CPU.freq).to be > 0
|
36
|
+
example 'freq method does not accept any arguments' do
|
37
|
+
expect{ described_class.freq(0) }.to raise_error(ArgumentError)
|
32
38
|
end
|
33
39
|
|
34
|
-
example
|
35
|
-
expect
|
40
|
+
example 'load_avg method basic functionality' do
|
41
|
+
expect(described_class).to respond_to(:load_avg)
|
42
|
+
expect{ described_class.load_avg }.not_to raise_error
|
36
43
|
end
|
37
44
|
|
38
|
-
example
|
39
|
-
expect(
|
40
|
-
expect
|
45
|
+
example 'load_avg returns the expected results' do
|
46
|
+
expect(described_class.load_avg).to be_kind_of(Array)
|
47
|
+
expect(described_class.load_avg.length).to eq(3)
|
48
|
+
expect(described_class.load_avg[0]).to be_kind_of(Float)
|
41
49
|
end
|
42
50
|
|
43
|
-
example
|
44
|
-
expect
|
45
|
-
expect(Sys::CPU.load_avg.length).to eq(3)
|
46
|
-
expect(Sys::CPU.load_avg[0]).to be_kind_of(Float)
|
51
|
+
example 'load_avg does not accept any arguments' do
|
52
|
+
expect{ described_class.load_avg(0) }.to raise_error(ArgumentError)
|
47
53
|
end
|
48
54
|
|
49
|
-
example
|
50
|
-
expect
|
55
|
+
example 'machine method basic functionality' do
|
56
|
+
expect(described_class).to respond_to(:machine)
|
57
|
+
expect{ described_class.machine }.not_to raise_error
|
51
58
|
end
|
52
59
|
|
53
|
-
example
|
54
|
-
expect(
|
55
|
-
expect
|
60
|
+
example 'machine method returns sane value' do
|
61
|
+
expect(described_class.machine).to be_kind_of(String)
|
62
|
+
expect(described_class.machine.size).to be > 0
|
56
63
|
end
|
57
64
|
|
58
|
-
example
|
59
|
-
expect
|
60
|
-
expect(Sys::CPU.machine.size).to be > 0
|
65
|
+
example 'machine method does not accept any arguments' do
|
66
|
+
expect{ described_class.machine(0) }.to raise_error(ArgumentError)
|
61
67
|
end
|
62
68
|
|
63
|
-
example
|
64
|
-
expect
|
69
|
+
example 'model method basic functionality' do
|
70
|
+
expect(described_class).to respond_to(:model)
|
71
|
+
expect{ described_class.model }.not_to raise_error
|
65
72
|
end
|
66
73
|
|
67
|
-
example
|
68
|
-
expect(
|
69
|
-
expect
|
74
|
+
example 'model method returns sane value' do
|
75
|
+
expect(described_class.model).to be_kind_of(String)
|
76
|
+
expect(described_class.model.length).to be > 0
|
70
77
|
end
|
71
78
|
|
72
|
-
example
|
73
|
-
expect
|
74
|
-
expect(Sys::CPU.model.length).to be > 0
|
79
|
+
example 'model method does not accept any arguments' do
|
80
|
+
expect{ described_class.model(0) }.to raise_error(ArgumentError)
|
75
81
|
end
|
76
82
|
|
77
|
-
example
|
78
|
-
expect
|
83
|
+
example 'num_cpu method basic functionality' do
|
84
|
+
expect(described_class).to respond_to(:num_cpu)
|
85
|
+
expect{ described_class.num_cpu }.not_to raise_error
|
79
86
|
end
|
80
87
|
|
81
|
-
example
|
82
|
-
expect(
|
83
|
-
expect
|
88
|
+
example 'num_cpu method returns expected value' do
|
89
|
+
expect(described_class.num_cpu).to be_kind_of(Integer)
|
90
|
+
expect(described_class.num_cpu).to be > 0
|
84
91
|
end
|
85
92
|
|
86
|
-
example
|
87
|
-
expect
|
88
|
-
expect(Sys::CPU.num_cpu).to be > 0
|
93
|
+
example 'num_cpu method does not accept any arguments' do
|
94
|
+
expect{ described_class.num_cpu(0) }.to raise_error(ArgumentError)
|
89
95
|
end
|
90
96
|
|
91
|
-
|
92
|
-
|
97
|
+
context "ffi methods and constants are private" do
|
98
|
+
example "ffi constants are private" do
|
99
|
+
constants = described_class.constants
|
100
|
+
expect(constants).not_to include(:CTL_HW)
|
101
|
+
expect(constants).not_to include(:CPU_TYPE_X86)
|
102
|
+
expect(constants).not_to include(:CPU_TYPE_X86_64)
|
103
|
+
expect(constants).not_to include(:HW_MACHINE)
|
104
|
+
expect(constants).not_to include(:ClockInfo)
|
105
|
+
end
|
106
|
+
|
107
|
+
example "ffi methods are private" do
|
108
|
+
methods = described_class.methods(false)
|
109
|
+
expect(methods).not_to include(:sysctl)
|
110
|
+
expect(methods).not_to include(:sysctlbyname)
|
111
|
+
end
|
93
112
|
end
|
94
113
|
end
|
data/spec/sys_cpu_hpux_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#####################################################################
|
2
4
|
# sys_cpu_hpux_spec.rb
|
3
5
|
#
|
@@ -8,43 +10,46 @@ require 'sys/cpu'
|
|
8
10
|
require 'spec_helper'
|
9
11
|
|
10
12
|
RSpec.describe Sys::CPU, :hpux => true do
|
11
|
-
example
|
12
|
-
expect(
|
13
|
-
expect{
|
14
|
-
expect{
|
15
|
-
expect(
|
13
|
+
example 'cpu_freq' do
|
14
|
+
expect(described_class).to respond_to(:freq)
|
15
|
+
expect{ described_class.freq }.not_to raise_error
|
16
|
+
expect{ described_class.freq(0) }.not_to raise_error
|
17
|
+
expect(described_class.freq).to be_kind_of(Integer)
|
18
|
+
end
|
19
|
+
|
20
|
+
example 'num_cpu' do
|
21
|
+
expect(described_class).to respond_to(:num_cpu)
|
22
|
+
expect{ described_class.num_cpu }.not_to raise_error
|
23
|
+
expect(described_class.num_cpu).to be_kind_of(Integer)
|
16
24
|
end
|
17
25
|
|
18
|
-
example
|
19
|
-
expect(
|
20
|
-
expect{
|
21
|
-
expect(
|
26
|
+
example 'num_active_cpu' do
|
27
|
+
expect(described_class).to respond_to(:num_active_cpu)
|
28
|
+
expect{ described_class.num_active_cpu }.not_to raise_error
|
29
|
+
expect(described_class.num_active_cpu).to be_kind_of(Integer)
|
22
30
|
end
|
23
31
|
|
24
|
-
example
|
25
|
-
expect(
|
26
|
-
expect{
|
27
|
-
expect(
|
32
|
+
example 'cpu_architecture' do
|
33
|
+
expect(described_class).to respond_to(:architecture)
|
34
|
+
expect{ described_class.architecture }.not_to raise_error
|
35
|
+
expect(described_class.architecture).to be_kind_of(String)
|
28
36
|
end
|
29
37
|
|
30
|
-
example
|
31
|
-
expect(
|
32
|
-
expect{
|
33
|
-
expect(Sys::CPU.architecture).to be_kind_of(String)
|
38
|
+
example 'load_avg basic sanity check' do
|
39
|
+
expect(described_class).to respond_to(:load_avg)
|
40
|
+
expect{ described_class.load_avg }.not_to raise_error
|
34
41
|
end
|
35
42
|
|
36
|
-
example
|
37
|
-
expect(
|
38
|
-
expect{
|
39
|
-
expect{
|
40
|
-
expect{ Sys::CPU.load_avg{ |e| }.not_to raise_error }
|
41
|
-
expect{ Sys::CPU.load_avg(0){ }.to raise_error(ArgumentError) }
|
43
|
+
example 'load_avg with arguments and/or block sanity check' do
|
44
|
+
expect{ described_class.load_avg(0) }.not_to raise_error
|
45
|
+
expect{ described_class.load_avg{} }.not_to raise_error
|
46
|
+
expect{ described_class.load_avg(0){} }.to raise_error(ArgumentError)
|
42
47
|
end
|
43
48
|
|
44
|
-
example
|
45
|
-
expect(
|
46
|
-
expect(
|
47
|
-
expect(
|
48
|
-
expect(
|
49
|
+
example 'load_avg expected results' do
|
50
|
+
expect(described_class.load_avg).to be_kind_of(Array)
|
51
|
+
expect(described_class.load_avg(0)).to be_kind_of(Array)
|
52
|
+
expect(described_class.load_avg.length).to eq(3)
|
53
|
+
expect(described_class.load_avg(0).length).to eq(3)
|
49
54
|
end
|
50
55
|
end
|
data/spec/sys_cpu_linux_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
###########################################################
|
2
4
|
# sys_cpu_linux_spec.rb
|
3
5
|
#
|
@@ -8,46 +10,50 @@ require 'sys/cpu'
|
|
8
10
|
require 'spec_helper'
|
9
11
|
|
10
12
|
RSpec.describe Sys::CPU, :linux => true do
|
11
|
-
example
|
12
|
-
expect
|
13
|
-
|
13
|
+
example 'dynamic methods are defined as expected' do
|
14
|
+
expect do
|
15
|
+
described_class.processors do |cs|
|
14
16
|
cs.members.each{ |m| cs[m].to_s }
|
15
|
-
|
16
|
-
|
17
|
+
end
|
18
|
+
end.not_to raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
example 'load average works as expected' do
|
22
|
+
expect{ described_class.load_avg }.not_to raise_error
|
23
|
+
expect(described_class.load_avg.length).to eq(3)
|
17
24
|
end
|
18
25
|
|
19
|
-
example
|
20
|
-
expect{
|
21
|
-
expect(
|
26
|
+
example 'cpu_stats works as expected' do
|
27
|
+
expect{ described_class.cpu_stats }.not_to raise_error
|
28
|
+
expect(described_class.cpu_stats).to be_kind_of(Hash)
|
29
|
+
expect(described_class.cpu_stats['cpu0'].length).to be >= 4
|
22
30
|
end
|
23
31
|
|
24
|
-
example
|
25
|
-
expect{
|
26
|
-
expect(
|
27
|
-
expect(Sys::CPU.cpu_stats['cpu0'].length).to be >= 4
|
32
|
+
example 'architecture works as expected' do
|
33
|
+
expect{ described_class.architecture }.not_to raise_error
|
34
|
+
expect(described_class.architecture).to be_kind_of(String)
|
28
35
|
end
|
29
36
|
|
30
|
-
example
|
31
|
-
expect{
|
32
|
-
expect(
|
37
|
+
example 'model works as expected' do
|
38
|
+
expect{ described_class.model }.not_to raise_error
|
39
|
+
expect(described_class.model).to be_kind_of(String)
|
33
40
|
end
|
34
41
|
|
35
|
-
example
|
36
|
-
expect{
|
37
|
-
expect(
|
42
|
+
example 'freq works as expected' do
|
43
|
+
expect{ described_class.freq }.not_to raise_error
|
44
|
+
expect(described_class.freq).to be_kind_of(Numeric)
|
38
45
|
end
|
39
46
|
|
40
|
-
example
|
41
|
-
expect{
|
42
|
-
expect(
|
47
|
+
example 'num_cpu works as expected' do
|
48
|
+
expect{ described_class.num_cpu }.not_to raise_error
|
49
|
+
expect(described_class.num_cpu).to be_kind_of(Numeric)
|
43
50
|
end
|
44
51
|
|
45
|
-
example
|
46
|
-
expect{
|
47
|
-
expect(Sys::CPU.num_cpu).to be_kind_of(Numeric)
|
52
|
+
example 'bogus methods are not picked up by method_missing' do
|
53
|
+
expect{ described_class.bogus }.to raise_error(NoMethodError)
|
48
54
|
end
|
49
55
|
|
50
|
-
example
|
51
|
-
expect{
|
56
|
+
example 'constructor is private' do
|
57
|
+
expect{ described_class.new }.to raise_error(NoMethodError)
|
52
58
|
end
|
53
59
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#######################################################################
|
2
4
|
# sys_cpu_spec.rb
|
3
5
|
#
|
@@ -7,12 +9,16 @@
|
|
7
9
|
require 'sys/cpu'
|
8
10
|
require 'rspec'
|
9
11
|
|
10
|
-
RSpec.
|
11
|
-
example
|
12
|
-
expect(Sys::CPU::VERSION).to eq('1.0.
|
12
|
+
RSpec.shared_examples Sys::CPU do
|
13
|
+
example 'version number is set to the expected value' do
|
14
|
+
expect(Sys::CPU::VERSION).to eq('1.0.6')
|
13
15
|
end
|
14
16
|
|
15
|
-
example
|
17
|
+
example 'version number is frozen' do
|
16
18
|
expect(Sys::CPU::VERSION).to be_frozen
|
17
19
|
end
|
20
|
+
|
21
|
+
example 'constructor is private' do
|
22
|
+
expect{ described_class.new }.to raise_error(NoMethodError)
|
23
|
+
end
|
18
24
|
end
|
data/spec/sys_cpu_sunos_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
###########################################################
|
2
4
|
# sys_cpu_sunos_spec.rb
|
3
5
|
#
|
@@ -8,73 +10,73 @@ require 'sys/cpu'
|
|
8
10
|
require 'spec_helper'
|
9
11
|
|
10
12
|
RSpec.describe Sys::CPU, :sunos => true do
|
11
|
-
example
|
12
|
-
expect(
|
13
|
-
expect{
|
13
|
+
example 'freq method basic functionality' do
|
14
|
+
expect(described_class).to respond_to(:freq)
|
15
|
+
expect{ described_class.freq }.not_to raise_error
|
14
16
|
end
|
15
17
|
|
16
|
-
example
|
17
|
-
expect{
|
18
|
+
example 'freq method does not accept any arguments' do
|
19
|
+
expect{ described_class.freq(0) }.to raise_error(ArgumentError)
|
18
20
|
end
|
19
21
|
|
20
|
-
example
|
21
|
-
expect(
|
22
|
-
expect(
|
22
|
+
example 'freq method returns a sane value' do
|
23
|
+
expect(described_class.freq).to be_kind_of(Integer)
|
24
|
+
expect(described_class.freq).to be > 100
|
23
25
|
end
|
24
26
|
|
25
|
-
example
|
26
|
-
expect(
|
27
|
-
expect{
|
27
|
+
example 'fpu_type basic functionality' do
|
28
|
+
expect(described_class).to respond_to(:fpu_type)
|
29
|
+
expect{ described_class.fpu_type }.not_to raise_error
|
28
30
|
end
|
29
31
|
|
30
|
-
example
|
31
|
-
expect(
|
32
|
-
expect(
|
32
|
+
example 'fpu_type returns a sane value' do
|
33
|
+
expect(described_class.fpu_type).to be_kind_of(String)
|
34
|
+
expect(described_class.fpu_type).not_to be_empty
|
33
35
|
end
|
34
36
|
|
35
|
-
example
|
36
|
-
expect(
|
37
|
-
expect{
|
37
|
+
example 'load_avg basic functionality' do
|
38
|
+
expect(described_class).to respond_to(:load_avg)
|
39
|
+
expect{ described_class.load_avg }.not_to raise_error
|
38
40
|
end
|
39
41
|
|
40
|
-
example
|
41
|
-
expect(
|
42
|
-
expect(
|
43
|
-
expect(
|
42
|
+
example 'load_avg method returns the expected values' do
|
43
|
+
expect(described_class.load_avg).to be_kind_of(Array)
|
44
|
+
expect(described_class.load_avg.length).to eq(3)
|
45
|
+
expect(described_class.load_avg.first).to be_kind_of(Float)
|
44
46
|
end
|
45
47
|
|
46
|
-
example
|
47
|
-
expect(
|
48
|
-
expect{
|
48
|
+
example 'model method basic functionality' do
|
49
|
+
expect(described_class).to respond_to(:model)
|
50
|
+
expect{ described_class.model }.not_to raise_error
|
49
51
|
end
|
50
52
|
|
51
|
-
example
|
52
|
-
expect(
|
53
|
-
expect(
|
53
|
+
example 'model method returns a sane value' do
|
54
|
+
expect(described_class.model).to be_kind_of(String)
|
55
|
+
expect(described_class.model).not_to be_empty
|
54
56
|
end
|
55
57
|
|
56
|
-
example
|
57
|
-
expect(
|
58
|
-
expect{
|
58
|
+
example 'num_cpu method basic functionalty' do
|
59
|
+
expect(described_class).to respond_to(:num_cpu)
|
60
|
+
expect{ described_class.num_cpu }.not_to raise_error
|
59
61
|
end
|
60
62
|
|
61
|
-
example
|
62
|
-
expect(
|
63
|
-
expect(
|
63
|
+
example 'num_cpu method returns a sane value' do
|
64
|
+
expect(described_class.num_cpu).to be_kind_of(Integer)
|
65
|
+
expect(described_class.num_cpu).to be > 0
|
64
66
|
end
|
65
67
|
|
66
|
-
example
|
67
|
-
expect(
|
68
|
-
expect{
|
68
|
+
example 'state basic functionality' do
|
69
|
+
expect(described_class).to respond_to(:state)
|
70
|
+
expect{ described_class.state }.not_to raise_error
|
69
71
|
end
|
70
72
|
|
71
|
-
example
|
72
|
-
expect{
|
73
|
-
expect{
|
73
|
+
example 'state method accepts one optional argument' do
|
74
|
+
expect{ described_class.state(0) }.not_to raise_error
|
75
|
+
expect{ described_class.state(0, 0) }.to raise_error(ArgumentError)
|
74
76
|
end
|
75
77
|
|
76
|
-
example
|
77
|
-
expect(
|
78
|
-
expect(
|
78
|
+
example 'state method returns a sane value' do
|
79
|
+
expect(described_class.state(0)).to be_kind_of(String)
|
80
|
+
expect(described_class.state.empty?).to be false
|
79
81
|
end
|
80
82
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
######################################################################
|
2
4
|
# sys_cpu_windows_spec.rb
|
3
5
|
#
|
@@ -11,51 +13,54 @@ require 'socket'
|
|
11
13
|
RSpec.describe Sys::CPU, :windows => true do
|
12
14
|
let(:host) { Socket.gethostname }
|
13
15
|
|
14
|
-
example
|
15
|
-
expect(
|
16
|
-
expect{
|
17
|
-
expect{
|
18
|
-
expect(
|
16
|
+
example 'architecture' do
|
17
|
+
expect(described_class).to respond_to(:architecture)
|
18
|
+
expect{ described_class.architecture }.not_to raise_error
|
19
|
+
expect{ described_class.architecture(host) }.not_to raise_error
|
20
|
+
expect(described_class.architecture).to be_kind_of(String)
|
21
|
+
end
|
22
|
+
|
23
|
+
example 'freq basic functionality' do
|
24
|
+
expect(described_class).to respond_to(:freq)
|
25
|
+
expect{ described_class.freq }.not_to raise_error
|
26
|
+
expect(described_class.freq).to be_kind_of(Integer)
|
19
27
|
end
|
20
28
|
|
21
|
-
example
|
22
|
-
expect(
|
23
|
-
expect{
|
24
|
-
expect{ Sys::CPU.freq(0) }.not_to raise_error
|
25
|
-
expect{ Sys::CPU.freq(0, host) }.not_to raise_error
|
26
|
-
expect(Sys::CPU.freq).to be_kind_of(Integer)
|
29
|
+
example 'freq with arguments' do
|
30
|
+
expect{ described_class.freq(0) }.not_to raise_error
|
31
|
+
expect{ described_class.freq(0, host) }.not_to raise_error
|
27
32
|
end
|
28
33
|
|
29
|
-
example
|
30
|
-
expect(
|
31
|
-
expect{
|
32
|
-
expect{
|
33
|
-
expect(
|
34
|
+
example 'model' do
|
35
|
+
expect(described_class).to respond_to(:model)
|
36
|
+
expect{ described_class.model }.not_to raise_error
|
37
|
+
expect{ described_class.model(host) }.not_to raise_error
|
38
|
+
expect(described_class.model).to be_kind_of(String)
|
34
39
|
end
|
35
40
|
|
36
|
-
example
|
37
|
-
expect(
|
38
|
-
expect{
|
39
|
-
expect{
|
40
|
-
expect(
|
41
|
+
example 'num_cpu' do
|
42
|
+
expect(described_class).to respond_to(:num_cpu)
|
43
|
+
expect{ described_class.num_cpu }.not_to raise_error
|
44
|
+
expect{ described_class.num_cpu(host) }.not_to raise_error
|
45
|
+
expect(described_class.num_cpu).to be_kind_of(Integer)
|
41
46
|
end
|
42
47
|
|
43
|
-
example
|
44
|
-
expect(
|
45
|
-
expect{
|
46
|
-
expect{
|
47
|
-
expect(
|
48
|
+
example 'cpu_type' do
|
49
|
+
expect(described_class).to respond_to(:cpu_type)
|
50
|
+
expect{ described_class.cpu_type }.not_to raise_error
|
51
|
+
expect{ described_class.cpu_type(host) }.not_to raise_error
|
52
|
+
expect(described_class.cpu_type).to be_kind_of(String)
|
48
53
|
end
|
49
54
|
|
50
|
-
example
|
51
|
-
expect(
|
52
|
-
expect{
|
53
|
-
expect{
|
54
|
-
expect(
|
55
|
+
example 'load_avg' do
|
56
|
+
expect(described_class).to respond_to(:load_avg)
|
57
|
+
expect{ described_class.load_avg }.not_to raise_error
|
58
|
+
expect{ described_class.load_avg(0, host) }.not_to raise_error
|
59
|
+
expect(described_class.load_avg).to be_kind_of(Integer).or be_kind_of(NilClass)
|
55
60
|
end
|
56
61
|
|
57
|
-
example
|
58
|
-
expect(
|
59
|
-
expect{
|
62
|
+
example 'processors' do
|
63
|
+
expect(described_class).to respond_to(:processors)
|
64
|
+
expect{ described_class.processors{} }.not_to raise_error
|
60
65
|
end
|
61
66
|
end
|
data/sys-cpu.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'sys-cpu'
|
5
|
-
spec.version = '1.0.
|
5
|
+
spec.version = '1.0.6'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
8
8
|
spec.license = 'Apache-2.0'
|
@@ -12,23 +12,24 @@ Gem::Specification.new do |spec|
|
|
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 = Dir['*.rdoc']
|
16
|
-
|
17
15
|
# The ffi dependency is only relevent for the Unix version. Given the
|
18
16
|
# ubiquity of ffi these days, I felt a bogus dependency on ffi for Windows
|
19
17
|
# and Linux was worth the tradeoff of not having to create 3 separate gems.
|
20
18
|
spec.add_dependency('ffi', '~> 1.1')
|
21
19
|
|
22
20
|
spec.add_development_dependency('rake')
|
21
|
+
spec.add_development_dependency('rubocop')
|
23
22
|
spec.add_development_dependency('rspec', '~> 3.9')
|
23
|
+
spec.add_development_dependency('rubocop-rspec')
|
24
24
|
|
25
25
|
spec.metadata = {
|
26
|
-
'homepage_uri'
|
27
|
-
'bug_tracker_uri'
|
28
|
-
'changelog_uri'
|
29
|
-
'documentation_uri'
|
30
|
-
'source_code_uri'
|
31
|
-
'wiki_uri'
|
26
|
+
'homepage_uri' => 'https://github.com/djberg96/sys-cpu',
|
27
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/sys-cpu/issues',
|
28
|
+
'changelog_uri' => 'https://github.com/djberg96/sys-cpu/blob/main/CHANGES.md',
|
29
|
+
'documentation_uri' => 'https://github.com/djberg96/sys-cpu/wiki',
|
30
|
+
'source_code_uri' => 'https://github.com/djberg96/sys-cpu',
|
31
|
+
'wiki_uri' => 'https://github.com/djberg96/sys-cpu/wiki',
|
32
|
+
'rubygems_mfa_required' => 'true'
|
32
33
|
}
|
33
34
|
|
34
35
|
spec.description = <<-EOF
|
data.tar.gz.sig
CHANGED
Binary file
|