scone 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +18 -1
- data/Makefile +3 -4
- data/cache/.gitignore +1 -0
- data/cache/proc.stat.txt +9 -0
- data/lib/scone/io/Directory.rb +7 -1
- data/lib/scone/io/File.rb +7 -1
- data/lib/scone/io/System.rb +7 -1
- data/lib/scone/platform.rb +27 -0
- data/lib/scone/ubuntu/Group.rb +7 -1
- data/lib/scone/ubuntu/Package.rb +7 -1
- data/lib/scone/ubuntu/User.rb +7 -1
- data/lib/scone/ubuntu/stat.rb +68 -0
- data/lib/scone/version.rb +4 -1
- data/lib/scone.rb +3 -0
- data/scone.gemspec +2 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a68d6f35f089b7a8b6df3577baff450d5f62839071955cbbcf6be1ac367bb1f
|
4
|
+
data.tar.gz: 2f7c870b142997ae0c0644408ebbfe4e223591a1d0dfee8a9ae92265e2159ab1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
$(
|
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
data/cache/proc.stat.txt
ADDED
@@ -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
|
data/lib/scone/io/Directory.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
|
-
|
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
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# IO Module
|
22
|
+
module IO
|
23
|
+
end
|
18
24
|
end
|
data/lib/scone/io/System.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
|
-
|
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
|
data/lib/scone/ubuntu/Group.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
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# Ubuntu Module
|
22
|
+
module Ubuntu
|
23
|
+
end
|
18
24
|
end
|
data/lib/scone/ubuntu/Package.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
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# Ubuntu Module
|
22
|
+
module Ubuntu
|
23
|
+
end
|
18
24
|
end
|
data/lib/scone/ubuntu/User.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
|
-
|
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
data/lib/scone.rb
CHANGED
data/scone.gemspec
CHANGED
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.
|
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
|