linux-kstat 0.2.6-universal-linux → 0.2.7-universal-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5fd1d292dd974e197bf8ac06ca71f017e35ab7b98b434b59fa813362a5656f2
4
- data.tar.gz: 025522376653a48dc026ecb97c8d709e290618c1d117b39409d3cb7aca4baa77
3
+ metadata.gz: b82d1f048b54e608c00c657ba80aaa56cb59f1419bedf75f542010d258ae19c1
4
+ data.tar.gz: c6c9974612a18126e39249b257962eae3cdaaf0f5e90693d9009360d8d3f8b5a
5
5
  SHA512:
6
- metadata.gz: d8de3c37e3b6d2cf5f6ca39f1c2259446ec7a09f05e9169eff2c4c7db1eee555eeee02c87f4711bc09cde564d0b769553c8b77f914e911936120746274ab8150
7
- data.tar.gz: ca8949524b8995249dfdb0d85cc7d9a853a14c596c35c6986d08919abf49ddb8ac6e3ec662677cfef85182a8ee19355c0e804a3d6d95e4fc237d5b665a7ad55b
6
+ metadata.gz: 00b1b9c55ea70c6b20bcb3db8fdb0a98ad24bda5c5caf5467049a9543a460837af3d419d0783a48c2f47b9410311b9ba4b44ace86583d7669cd2cdb659090232
7
+ data.tar.gz: 9e99699d334b264d792653444b5514662ca65c65809e07e74e3e666b294c6062aa4060874526ae2ace4fbb4616f69dfd94e7d590d949bb8ae840b498831a0d59
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.7 - 20-Apr-2024
2
+ * Rubocop updates.
3
+ * Spec updates.
4
+ * Gemspec updates.
5
+ * Documentation and other miscellaneous project updates.
6
+
1
7
  ## 0.2.6 - 10-Dec-2020
2
8
  * Specify an rspec version for the development dependency.
3
9
  * Minor updates to gemspec, Rakefile.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/MANIFEST.md CHANGED
@@ -1,6 +1,7 @@
1
1
  * CHANGES.md
2
2
  * README.md
3
3
  * MANIFEST.md
4
+ * Gemfile
4
5
  * Rakefile
5
6
  * linux-kstat.gemspec
6
7
  * certs/djberg96_pub.pem
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,14 +1,15 @@
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 = eval(IO.read('linux-kstat.gemspec'))
12
+ spec = Gem::Specification.load('linux-kstat.gemspec')
12
13
  spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
13
14
  Gem::Package.build(spec)
14
15
  end
@@ -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.6'.freeze
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
- IO.readlines('/proc/stat').each{ |line|
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 => info[1].to_i,
61
- :nice => info[2].to_i,
62
- :system => info[3].to_i,
63
- :idle => info[4].to_i,
64
- :iowait => info[5].to_i,
65
- :irq => info[6].to_i,
66
- :softirq => info[7].to_i,
67
- :steal => info[8].to_i,
68
- :guest => info[9].to_i,
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
- if info.size > 2
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
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'linux/kstat'
data/linux-kstat.gemspec CHANGED
@@ -2,26 +2,31 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'linux-kstat'
5
- gem.version = '0.2.6'
5
+ gem.version = '0.2.7'
6
6
  gem.license = 'Apache-2.0'
7
7
  gem.author = 'Daniel J. Berger'
8
8
  gem.email = 'djberg96@gmail.com'
9
- gem.platform = Gem::Platform.new('universal-linux')
10
9
  gem.homepage = 'https://github.com/djberg96/linux-kstat'
11
10
  gem.summary = 'Ruby interface for Linux kernel stats in /proc/stat'
12
11
  gem.test_files = Dir['spec/*_spec.rb']
13
12
  gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
14
13
  gem.cert_chain = ['certs/djberg96_pub.pem']
15
14
 
15
+ gem.add_development_dependency('rake')
16
+ gem.add_development_dependency('rubocop')
17
+ gem.add_development_dependency('rubocop-rspec')
16
18
  gem.add_development_dependency('rspec', '~> 3.9')
17
19
 
20
+ gem.platform = Gem::Platform.new(['universal', 'linux'])
21
+
18
22
  gem.metadata = {
19
- 'homepage_uri' => 'https://github.com/djberg96/linux-kstat',
20
- 'bug_tracker_uri' => 'https://github.com/djberg96/linux-kstat/issues',
21
- 'changelog_uri' => 'https://github.com/djberg96/linux-kstat/blob/master/CHANGES',
22
- 'documentation_uri' => 'https://github.com/djberg96/linux-kstat/wiki',
23
- 'source_code_uri' => 'https://github.com/djberg96/linux-kstat',
24
- 'wiki_uri' => 'https://github.com/djberg96/linux-kstat/wiki'
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'
25
30
  }
26
31
 
27
32
  gem.description = <<-EOF
@@ -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){ Linux::Kstat.new }
12
+ let(:kstat){ described_class.new }
11
13
 
12
- context "constants" do
13
- it "defines a version constant that is set to the expected value" do
14
- expect(Linux::Kstat::VERSION).to eql('0.2.6')
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 "hash access" do
20
- it "allows hash style key access" do
21
- expect(subject).to respond_to(:[])
22
- expect{ subject[:cpu] }.to_not raise_error
23
- expect(subject[:cpu].keys.size).to eql(10)
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 "contains the expected keys and value types" do
27
- expect(kstat[:cpu]).to be_kind_of(Hash)
28
- expect(kstat[:btime]).to be_kind_of(Numeric)
29
- expect(kstat[:intr]).to be_kind_of(Array)
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 "does not allow key assignment" do
33
- expect{ subject[:cpu] = 'test' }.to raise_error(NoMethodError)
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.6
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,8 +35,50 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date: 2020-12-10 00:00:00.000000000 Z
38
+ date: 2024-04-20 00:00:00.000000000 Z
39
39
  dependencies:
40
+ - !ruby/object:Gem::Dependency
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
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
40
82
  - !ruby/object:Gem::Dependency
41
83
  name: rspec
42
84
  requirement: !ruby/object:Gem::Requirement
@@ -60,6 +102,7 @@ extensions: []
60
102
  extra_rdoc_files: []
61
103
  files:
62
104
  - CHANGES.md
105
+ - Gemfile
63
106
  - LICENSE
64
107
  - MANIFEST.md
65
108
  - README.md
@@ -75,11 +118,12 @@ licenses:
75
118
  metadata:
76
119
  homepage_uri: https://github.com/djberg96/linux-kstat
77
120
  bug_tracker_uri: https://github.com/djberg96/linux-kstat/issues
78
- changelog_uri: https://github.com/djberg96/linux-kstat/blob/master/CHANGES
121
+ changelog_uri: https://github.com/djberg96/linux-kstat/blob/master/CHANGES.md
79
122
  documentation_uri: https://github.com/djberg96/linux-kstat/wiki
80
123
  source_code_uri: https://github.com/djberg96/linux-kstat
81
124
  wiki_uri: https://github.com/djberg96/linux-kstat/wiki
82
- post_install_message:
125
+ rubygems_mfa_required: 'true'
126
+ post_install_message:
83
127
  rdoc_options: []
84
128
  require_paths:
85
129
  - lib
@@ -94,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
138
  - !ruby/object:Gem::Version
95
139
  version: '0'
96
140
  requirements: []
97
- rubygems_version: 3.0.3
98
- signing_key:
141
+ rubygems_version: 3.4.19
142
+ signing_key:
99
143
  specification_version: 4
100
144
  summary: Ruby interface for Linux kernel stats in /proc/stat
101
145
  test_files:
metadata.gz.sig CHANGED
Binary file