scone 0.1.5 → 0.1.6

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: cb6ff1a445e94e4be13d9f726c83a4f76173537865a7af89e70db30ed95b1d5c
4
- data.tar.gz: 99bb1c7860931a3c95bd857f4ba3d71c5a7184be89a832e97c666c6587492a55
3
+ metadata.gz: 2a68d6f35f089b7a8b6df3577baff450d5f62839071955cbbcf6be1ac367bb1f
4
+ data.tar.gz: 2f7c870b142997ae0c0644408ebbfe4e223591a1d0dfee8a9ae92265e2159ab1
5
5
  SHA512:
6
- metadata.gz: d9235aa210b037a90d34df2f0ab5a607f1a9c5485cd43312001a1945952e6a7ec2172f3a8cf3a544ab3cc2c67df9c0c5d77d6bee3c08ea8699e0106c025f8f98
7
- data.tar.gz: d5480dcdb92e34db286f5615f5ce71a0f3dfb2159c10ec43d65244b543b0efc8d143c835834ab32028f614b41671a45dbeab1e48770de4d5add316da6fe1584c
6
+ metadata.gz: a21ae57698ca4e66f4575f44c5cdeb263a2382cf16a65baeb45675b3a649ad7da89168754266af85e119c437793da88e8adc7256a9653d9583ef65ed3fe6446e
7
+ data.tar.gz: 89626619c045c81dcdd52a5ed88a495c6567b69df1ff157168334e4cc7adc036bb3eccd342bfe21519cd83d39943ec5332522f7f520a867ceb67a2e34c900b30
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  AllCops:
2
+ NewCops: enable
2
3
  TargetRubyVersion: 2.6
3
4
 
4
5
  Style/StringLiterals:
@@ -10,4 +11,20 @@ Style/StringLiteralsInInterpolation:
10
11
  EnforcedStyle: double_quotes
11
12
 
12
13
  Layout/LineLength:
13
- Max: 120
14
+ Enabled: true
15
+ Max: 320
16
+
17
+ Metrics/BlockLength:
18
+ Enabled: true
19
+ Max: 50
20
+
21
+ Metrics/MethodLength:
22
+ Enabled: true
23
+ Max: 50
24
+
25
+ Metrics/AbcSize:
26
+ Enabled: true
27
+ Max: 50
28
+
29
+ Style/SymbolProc:
30
+ Enabled: false
data/Makefile CHANGED
@@ -3,7 +3,7 @@ RDOC ?= rdoc
3
3
  BUNDLE ?= bundle
4
4
  RAKE ?= rake
5
5
  GEM ?= gem
6
- RUFO ?= rufo
6
+ RUBOCOP ?= rubocop
7
7
 
8
8
 
9
9
  help: Makefile
@@ -74,13 +74,12 @@ release:
74
74
  .PHONY: format
75
75
  format:
76
76
  @echo ">> ============= Format the Code ============= <<"
77
- $(GEM) install rufo
78
- $(RUFO) .
77
+ $(RUBOCOP) -a
79
78
 
80
79
 
81
80
  ## ci: Run all CI tests.
82
81
  .PHONY: ci
83
- ci: test
82
+ ci: test format
84
83
  @echo "\n==> All quality checks passed"
85
84
 
86
85
 
data/cache/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  *
2
+ !proc.stat.txt
2
3
  !.gitignore
@@ -0,0 +1,9 @@
1
+ cpu 70188 0 10456 2238527 10766 0 271 199 0 0
2
+ cpu0 70188 0 10456 2238527 10766 0 271 199 0 0
3
+ intr 2329851 11 9 0 0 3694 0 3 0 1 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 154597 179787 0 80549 0 0 0 256 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4
+ ctxt 6808805
5
+ btime 1635081048
6
+ processes 5701
7
+ procs_running 2
8
+ procs_blocked 0
9
+ softirq 1365458 1 530760 2 334105 79887 0 24048 0 0 396655
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,5 +16,9 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
17
- module Directory
19
+ # Scone Module
20
+ module Scone
21
+ # IO Module
22
+ module IO
23
+ end
18
24
  end
data/lib/scone/io/File.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,5 +16,9 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
17
- module File
19
+ # Scone Module
20
+ module Scone
21
+ # IO Module
22
+ module IO
23
+ end
18
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,5 +16,9 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
17
- module System
19
+ # Scone Module
20
+ module Scone
21
+ # IO Module
22
+ module IO
23
+ end
18
24
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Scone - A Unified SDK for Linux OS Distributions in Ruby
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # Scone Module
20
+ module Scone
21
+ # Platform Module
22
+ module Platform
23
+ def self.platform
24
+ :UBUNTU
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,5 +16,9 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
17
- module Group
19
+ # Scone Module
20
+ module Scone
21
+ # Ubuntu Module
22
+ module Ubuntu
23
+ end
18
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,5 +16,9 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
17
- module Package
19
+ # Scone Module
20
+ module Scone
21
+ # Ubuntu Module
22
+ module Ubuntu
23
+ end
18
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,5 +16,9 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
17
- module User
19
+ # Scone Module
20
+ module Scone
21
+ # Ubuntu Module
22
+ module Ubuntu
23
+ end
18
24
  end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Scone - A Unified SDK for Linux OS Distributions in Ruby
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # Scone Module
20
+ module Scone
21
+ # Ubuntu Module
22
+ module Ubuntu
23
+ # Proc Stat Class
24
+ class Stat
25
+ def initialize(proc_stat = "/proc/stat")
26
+ @hash = get_proc_stat_info(proc_stat)
27
+ end
28
+
29
+ def proc_stat
30
+ @hash
31
+ end
32
+
33
+ private
34
+
35
+ # Parse the information out of /proc/stat and assign keys and values to
36
+ # a hash that can be accessed via the Forwardable module.
37
+ def get_proc_stat_info(proc_stat)
38
+ hash = {}
39
+
40
+ File.readlines(proc_stat).each do |line|
41
+ info = line.split
42
+
43
+ next if info.empty?
44
+
45
+ hash[info.first.to_sym] = if info.first =~ /^cpu/i
46
+ {
47
+ user: info[1].to_i,
48
+ nice: info[2].to_i,
49
+ system: info[3].to_i,
50
+ idle: info[4].to_i,
51
+ iowait: info[5].to_i,
52
+ irq: info[6].to_i,
53
+ softirq: info[7].to_i,
54
+ steal: info[8].to_i,
55
+ guest: info[9].to_i,
56
+ guest_nice: info[10].to_i
57
+ }
58
+ elsif info.size > 2
59
+ info[1..].map { |e| e.to_i }
60
+ else
61
+ info[1].to_i
62
+ end
63
+ end
64
+ hash
65
+ end
66
+ end
67
+ end
68
+ end
data/lib/scone/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -14,6 +16,7 @@
14
16
  # limitations under the License.
15
17
  #
16
18
 
19
+ # Scone Module
17
20
  module Scone
18
- VERSION = "0.1.5"
21
+ VERSION = "0.1.6"
19
22
  end
data/lib/scone.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
@@ -16,6 +18,7 @@
16
18
 
17
19
  require_relative "scone/version"
18
20
 
21
+ # Scone Module
19
22
  module Scone
20
23
  class Error < StandardError; end
21
24
 
data/scone.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Scone - A Unified SDK for Linux OS Distributions in Ruby
3
5
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - clivern
@@ -32,13 +32,16 @@ files:
32
32
  - bin/console
33
33
  - bin/setup
34
34
  - cache/.gitignore
35
+ - cache/proc.stat.txt
35
36
  - lib/scone.rb
36
37
  - lib/scone/io/Directory.rb
37
38
  - lib/scone/io/File.rb
38
39
  - lib/scone/io/System.rb
40
+ - lib/scone/platform.rb
39
41
  - lib/scone/ubuntu/Group.rb
40
42
  - lib/scone/ubuntu/Package.rb
41
43
  - lib/scone/ubuntu/User.rb
44
+ - lib/scone/ubuntu/stat.rb
42
45
  - lib/scone/version.rb
43
46
  - renovate.json
44
47
  - scone.gemspec