linux-kstat 0.2.5-universal-linux → 0.2.7-universal-linux
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 +10 -0
- data/Gemfile +2 -0
- data/MANIFEST.md +1 -0
- data/README.md +6 -1
- data/Rakefile +6 -3
- data/lib/linux/kstat.rb +17 -17
- data/lib/linux-kstat.rb +2 -0
- data/linux-kstat.gemspec +14 -10
- data/spec/linux_kstat_spec.rb +17 -15
- data.tar.gz.sig +0 -0
- metadata +58 -18
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b82d1f048b54e608c00c657ba80aaa56cb59f1419bedf75f542010d258ae19c1
|
4
|
+
data.tar.gz: c6c9974612a18126e39249b257962eae3cdaaf0f5e90693d9009360d8d3f8b5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00b1b9c55ea70c6b20bcb3db8fdb0a98ad24bda5c5caf5467049a9543a460837af3d419d0783a48c2f47b9410311b9ba4b44ace86583d7669cd2cdb659090232
|
7
|
+
data.tar.gz: 9e99699d334b264d792653444b5514662ca65c65809e07e74e3e666b294c6062aa4060874526ae2ace4fbb4616f69dfd94e7d590d949bb8ae840b498831a0d59
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.2.7 - 20-Apr-2024
|
2
|
+
* Rubocop updates.
|
3
|
+
* Spec updates.
|
4
|
+
* Gemspec updates.
|
5
|
+
* Documentation and other miscellaneous project updates.
|
6
|
+
|
7
|
+
## 0.2.6 - 10-Dec-2020
|
8
|
+
* Specify an rspec version for the development dependency.
|
9
|
+
* Minor updates to gemspec, Rakefile.
|
10
|
+
|
1
11
|
## 0.2.5 - 31-Oct-2020
|
2
12
|
* Switched from rdoc to markdown since github wasn't rendering rdoc properly.
|
3
13
|
* Minor gemspec updates.
|
data/Gemfile
ADDED
data/MANIFEST.md
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Ruby](https://github.com/djberg96/linux-kstat/actions/workflows/ruby.yml/badge.svg)](https://github.com/djberg96/linux-kstat/actions/workflows/ruby.yml)
|
2
|
+
|
1
3
|
## Description
|
2
4
|
|
3
5
|
A Ruby library for gathering Linux kernel statistics out of `/proc/stat`.
|
@@ -6,6 +8,9 @@ A Ruby library for gathering Linux kernel statistics out of `/proc/stat`.
|
|
6
8
|
|
7
9
|
`gem install linux-kstat`
|
8
10
|
|
11
|
+
## Adding the trusted cert
|
12
|
+
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/linux-kstat/main/certs/djberg96_pub.pem)`
|
13
|
+
|
9
14
|
### Bundler
|
10
15
|
|
11
16
|
If you have trouble install this gem via bundler, please try this:
|
@@ -15,7 +20,7 @@ If you have trouble install this gem via bundler, please try this:
|
|
15
20
|
Then attempt to install again.
|
16
21
|
|
17
22
|
## Synopsis
|
18
|
-
```
|
23
|
+
```ruby
|
19
24
|
# require 'linux-kstat' will also work
|
20
25
|
require 'linux/kstat'
|
21
26
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/clean'
|
3
3
|
require 'rspec/core/rake_task'
|
4
|
+
require 'rubocop/rake_task'
|
4
5
|
|
5
|
-
CLEAN.include('**/*.gem', '**/*.rbc')
|
6
|
+
CLEAN.include('**/*.gem', '**/*.rbc', '**/*.lock')
|
6
7
|
|
7
8
|
namespace :gem do
|
8
9
|
desc 'Build the linux-kstat gem'
|
9
10
|
task :create => [:clean] do
|
10
11
|
require 'rubygems/package'
|
11
|
-
spec =
|
12
|
+
spec = Gem::Specification.load('linux-kstat.gemspec')
|
12
13
|
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
13
|
-
Gem::Package.build(spec
|
14
|
+
Gem::Package.build(spec)
|
14
15
|
end
|
15
16
|
|
16
17
|
desc "Install the linux-kstat gem"
|
@@ -24,6 +25,8 @@ namespace :gem do
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
RuboCop::RakeTask.new
|
29
|
+
|
27
30
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
28
31
|
t.pattern = ['spec/*.rb']
|
29
32
|
end
|
data/lib/linux/kstat.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'forwardable'
|
2
4
|
|
3
5
|
# The Linux module serves as a namespace only.
|
@@ -7,7 +9,7 @@ module Linux
|
|
7
9
|
extend Forwardable
|
8
10
|
|
9
11
|
# The version of the linux-kstat library
|
10
|
-
VERSION = '0.2.
|
12
|
+
VERSION = '0.2.7'
|
11
13
|
|
12
14
|
# :stopdoc:
|
13
15
|
|
@@ -52,31 +54,29 @@ module Linux
|
|
52
54
|
def get_proc_stat_info
|
53
55
|
hash = {}
|
54
56
|
|
55
|
-
|
57
|
+
File.readlines('/proc/stat').each do |line|
|
56
58
|
info = line.split
|
57
59
|
unless info.empty?
|
58
60
|
if info.first =~ /^cpu/i
|
59
61
|
hash[info.first.to_sym] = {
|
60
|
-
:user
|
61
|
-
:nice
|
62
|
-
:system
|
63
|
-
:idle
|
64
|
-
:iowait
|
65
|
-
:irq
|
66
|
-
:softirq
|
67
|
-
:steal
|
68
|
-
:guest
|
62
|
+
:user => info[1].to_i,
|
63
|
+
:nice => info[2].to_i,
|
64
|
+
:system => info[3].to_i,
|
65
|
+
:idle => info[4].to_i,
|
66
|
+
:iowait => info[5].to_i,
|
67
|
+
:irq => info[6].to_i,
|
68
|
+
:softirq => info[7].to_i,
|
69
|
+
:steal => info[8].to_i,
|
70
|
+
:guest => info[9].to_i,
|
69
71
|
:guest_nice => info[10].to_i
|
70
72
|
}
|
73
|
+
elsif info.size > 2
|
74
|
+
hash[info.first.to_sym] = info[1..-1].map(&:to_i)
|
71
75
|
else
|
72
|
-
|
73
|
-
hash[info.first.to_sym] = info[1..-1].map{ |e| e.to_i }
|
74
|
-
else
|
75
|
-
hash[info.first.to_sym] = info[1].to_i
|
76
|
-
end
|
76
|
+
hash[info.first.to_sym] = info[1].to_i
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
79
|
+
end
|
80
80
|
|
81
81
|
hash
|
82
82
|
end
|
data/lib/linux-kstat.rb
CHANGED
data/linux-kstat.gemspec
CHANGED
@@ -1,28 +1,32 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'rbconfig'
|
3
2
|
|
4
3
|
Gem::Specification.new do |gem|
|
5
4
|
gem.name = 'linux-kstat'
|
6
|
-
gem.version = '0.2.
|
5
|
+
gem.version = '0.2.7'
|
7
6
|
gem.license = 'Apache-2.0'
|
8
7
|
gem.author = 'Daniel J. Berger'
|
9
8
|
gem.email = 'djberg96@gmail.com'
|
10
|
-
gem.platform = Gem::Platform.new('universal-linux')
|
11
9
|
gem.homepage = 'https://github.com/djberg96/linux-kstat'
|
12
10
|
gem.summary = 'Ruby interface for Linux kernel stats in /proc/stat'
|
13
11
|
gem.test_files = Dir['spec/*_spec.rb']
|
14
12
|
gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
15
13
|
gem.cert_chain = ['certs/djberg96_pub.pem']
|
16
14
|
|
17
|
-
gem.add_development_dependency('
|
15
|
+
gem.add_development_dependency('rake')
|
16
|
+
gem.add_development_dependency('rubocop')
|
17
|
+
gem.add_development_dependency('rubocop-rspec')
|
18
|
+
gem.add_development_dependency('rspec', '~> 3.9')
|
19
|
+
|
20
|
+
gem.platform = Gem::Platform.new(['universal', 'linux'])
|
18
21
|
|
19
22
|
gem.metadata = {
|
20
|
-
'homepage_uri'
|
21
|
-
'bug_tracker_uri'
|
22
|
-
'changelog_uri'
|
23
|
-
'documentation_uri'
|
24
|
-
'source_code_uri'
|
25
|
-
'wiki_uri'
|
23
|
+
'homepage_uri' => 'https://github.com/djberg96/linux-kstat',
|
24
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/linux-kstat/issues',
|
25
|
+
'changelog_uri' => 'https://github.com/djberg96/linux-kstat/blob/master/CHANGES.md',
|
26
|
+
'documentation_uri' => 'https://github.com/djberg96/linux-kstat/wiki',
|
27
|
+
'source_code_uri' => 'https://github.com/djberg96/linux-kstat',
|
28
|
+
'wiki_uri' => 'https://github.com/djberg96/linux-kstat/wiki',
|
29
|
+
'rubygems_mfa_required' => 'true'
|
26
30
|
}
|
27
31
|
|
28
32
|
gem.description = <<-EOF
|
data/spec/linux_kstat_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#######################################################################
|
2
4
|
# linux_kstat_spec.rb
|
3
5
|
#
|
@@ -7,30 +9,30 @@ require 'rspec'
|
|
7
9
|
require 'linux/kstat'
|
8
10
|
|
9
11
|
describe Linux::Kstat do
|
10
|
-
let(:kstat){
|
12
|
+
let(:kstat){ described_class.new }
|
11
13
|
|
12
|
-
context
|
13
|
-
it
|
14
|
-
expect(Linux::Kstat::VERSION).to eql('0.2.
|
14
|
+
context 'constants' do
|
15
|
+
it 'defines a version constant that is set to the expected value' do
|
16
|
+
expect(Linux::Kstat::VERSION).to eql('0.2.7')
|
15
17
|
expect(Linux::Kstat::VERSION).to be_frozen
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
context
|
20
|
-
it
|
21
|
-
expect(
|
22
|
-
expect{
|
23
|
-
expect(
|
21
|
+
context 'hash access' do
|
22
|
+
it 'allows hash style key access' do
|
23
|
+
expect(kstat).to respond_to(:[])
|
24
|
+
expect{ kstat[:cpu] }.not_to raise_error
|
25
|
+
expect(kstat[:cpu].keys.size).to be(10)
|
24
26
|
end
|
25
27
|
|
26
|
-
it
|
27
|
-
expect(kstat[:cpu]).to
|
28
|
-
expect(kstat[:btime]).to
|
29
|
-
expect(kstat[:intr]).to
|
28
|
+
it 'contains the expected keys and value types' do
|
29
|
+
expect(kstat[:cpu]).to be_a(Hash)
|
30
|
+
expect(kstat[:btime]).to be_a(Numeric)
|
31
|
+
expect(kstat[:intr]).to be_a(Array)
|
30
32
|
end
|
31
33
|
|
32
|
-
it
|
33
|
-
expect{
|
34
|
+
it 'does not allow key assignment' do
|
35
|
+
expect{ kstat[:cpu] = 'test' }.to raise_error(NoMethodError)
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linux-kstat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: universal-linux
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
@@ -35,10 +35,38 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2024-04-20 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: rake
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rubocop
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rubocop-rspec
|
42
70
|
requirement: !ruby/object:Gem::Requirement
|
43
71
|
requirements:
|
44
72
|
- - ">="
|
@@ -51,6 +79,20 @@ dependencies:
|
|
51
79
|
- - ">="
|
52
80
|
- !ruby/object:Gem::Version
|
53
81
|
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rspec
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.9'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '3.9'
|
54
96
|
description: |2
|
55
97
|
The linux-kstat library provides a hash style interface for reading
|
56
98
|
Linux kernel statistics read out of /proc/stat.
|
@@ -59,31 +101,29 @@ executables: []
|
|
59
101
|
extensions: []
|
60
102
|
extra_rdoc_files: []
|
61
103
|
files:
|
62
|
-
-
|
63
|
-
-
|
64
|
-
- spec/linux_kstat_spec.rb
|
65
|
-
- lib
|
66
|
-
- lib/linux-kstat.rb
|
67
|
-
- lib/linux
|
68
|
-
- lib/linux/kstat.rb
|
69
|
-
- certs
|
70
|
-
- certs/djberg96_pub.pem
|
104
|
+
- CHANGES.md
|
105
|
+
- Gemfile
|
71
106
|
- LICENSE
|
72
107
|
- MANIFEST.md
|
73
108
|
- README.md
|
74
|
-
-
|
109
|
+
- Rakefile
|
110
|
+
- certs/djberg96_pub.pem
|
111
|
+
- lib/linux-kstat.rb
|
112
|
+
- lib/linux/kstat.rb
|
75
113
|
- linux-kstat.gemspec
|
114
|
+
- spec/linux_kstat_spec.rb
|
76
115
|
homepage: https://github.com/djberg96/linux-kstat
|
77
116
|
licenses:
|
78
117
|
- Apache-2.0
|
79
118
|
metadata:
|
80
119
|
homepage_uri: https://github.com/djberg96/linux-kstat
|
81
120
|
bug_tracker_uri: https://github.com/djberg96/linux-kstat/issues
|
82
|
-
changelog_uri: https://github.com/djberg96/linux-kstat/blob/master/CHANGES
|
121
|
+
changelog_uri: https://github.com/djberg96/linux-kstat/blob/master/CHANGES.md
|
83
122
|
documentation_uri: https://github.com/djberg96/linux-kstat/wiki
|
84
123
|
source_code_uri: https://github.com/djberg96/linux-kstat
|
85
124
|
wiki_uri: https://github.com/djberg96/linux-kstat/wiki
|
86
|
-
|
125
|
+
rubygems_mfa_required: 'true'
|
126
|
+
post_install_message:
|
87
127
|
rdoc_options: []
|
88
128
|
require_paths:
|
89
129
|
- lib
|
@@ -98,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
138
|
- !ruby/object:Gem::Version
|
99
139
|
version: '0'
|
100
140
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
141
|
+
rubygems_version: 3.4.19
|
142
|
+
signing_key:
|
103
143
|
specification_version: 4
|
104
144
|
summary: Ruby interface for Linux kernel stats in /proc/stat
|
105
145
|
test_files:
|
metadata.gz.sig
CHANGED
Binary file
|