scone 0.1.3 → 0.1.7
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 +9 -1
- data/cache/.gitignore +3 -0
- data/cache/proc.stat.txt +9 -0
- data/lib/scone/io/{Directory.rb → directory.rb} +7 -2
- data/lib/scone/io/{File.rb → file.rb} +7 -2
- data/lib/scone/io/{System.rb → system.rb} +7 -2
- data/lib/scone/platform.rb +27 -0
- data/lib/scone/ubuntu/{Group.rb → group.rb} +7 -2
- data/lib/scone/ubuntu/package.rb +24 -0
- data/lib/scone/ubuntu/stat.rb +68 -0
- data/lib/scone/ubuntu/user.rb +24 -0
- data/lib/scone/version.rb +4 -1
- data/lib/scone.rb +4 -0
- data/scone.gemspec +30 -11
- metadata +12 -8
- data/lib/scone/ubuntu/Package.rb +0 -19
- data/lib/scone/ubuntu/User.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13a944eb96de16c0a854f02db6bf2bf168cc250eddd8c63bc51ed351b56a17e4
|
4
|
+
data.tar.gz: 742b0229c57d877249f0c3f996bea565c57d419d332b0c57e5fd7fd0ec833cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd7fcc1a6606fe266c6a1f225ac3d557e5186e0a77584d9f14b32b260927c2750e3aceb8c5601f6fe83eb41132c00fb45174cfa1c4496f3f14c3e30f79c9c6e
|
7
|
+
data.tar.gz: e3aeb2de01bb6c1bc1b15efed951ea3ba1b7a0306cf545bf6d89a04519b1835880087dc448a60d59e9c1f49e67323430127bd97cd42b0a6a59f8a207b762ac08
|
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,6 +3,7 @@ RDOC ?= rdoc
|
|
3
3
|
BUNDLE ?= bundle
|
4
4
|
RAKE ?= rake
|
5
5
|
GEM ?= gem
|
6
|
+
RUBOCOP ?= rubocop
|
6
7
|
|
7
8
|
|
8
9
|
help: Makefile
|
@@ -69,9 +70,16 @@ release:
|
|
69
70
|
$(RAKE) release
|
70
71
|
|
71
72
|
|
73
|
+
## format: Format the ruby code.
|
74
|
+
.PHONY: format
|
75
|
+
format:
|
76
|
+
@echo ">> ============= Format the Code ============= <<"
|
77
|
+
$(RUBOCOP) -a
|
78
|
+
|
79
|
+
|
72
80
|
## ci: Run all CI tests.
|
73
81
|
.PHONY: ci
|
74
|
-
ci: test
|
82
|
+
ci: test format
|
75
83
|
@echo "\n==> All quality checks passed"
|
76
84
|
|
77
85
|
|
data/cache/.gitignore
ADDED
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
|
@@ -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,9 @@
|
|
14
16
|
# limitations under the License.
|
15
17
|
#
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# IO Module
|
22
|
+
module IO
|
23
|
+
end
|
19
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,6 +16,9 @@
|
|
14
16
|
# limitations under the License.
|
15
17
|
#
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# IO Module
|
22
|
+
module IO
|
23
|
+
end
|
19
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,6 +16,9 @@
|
|
14
16
|
# limitations under the License.
|
15
17
|
#
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# IO Module
|
22
|
+
module IO
|
23
|
+
end
|
19
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,6 +16,9 @@
|
|
14
16
|
# limitations under the License.
|
15
17
|
#
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
# Scone Module
|
20
|
+
module Scone
|
21
|
+
# Ubuntu Module
|
22
|
+
module Ubuntu
|
23
|
+
end
|
19
24
|
end
|
@@ -0,0 +1,24 @@
|
|
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
|
+
end
|
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
|
@@ -0,0 +1,24 @@
|
|
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
|
+
end
|
24
|
+
end
|
data/lib/scone/version.rb
CHANGED
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,7 +18,9 @@
|
|
16
18
|
|
17
19
|
require_relative "scone/version"
|
18
20
|
|
21
|
+
# Scone Module
|
19
22
|
module Scone
|
20
23
|
class Error < StandardError; end
|
24
|
+
|
21
25
|
# Your code goes here...
|
22
26
|
end
|
data/scone.gemspec
CHANGED
@@ -1,15 +1,33 @@
|
|
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
|
+
|
1
19
|
require_relative "lib/scone/version"
|
2
20
|
|
3
21
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name
|
5
|
-
spec.version
|
6
|
-
spec.authors
|
7
|
-
spec.email
|
8
|
-
|
9
|
-
spec.summary
|
10
|
-
spec.description
|
11
|
-
spec.homepage
|
12
|
-
spec.license
|
22
|
+
spec.name = "scone"
|
23
|
+
spec.version = Scone::VERSION
|
24
|
+
spec.authors = ["clivern"]
|
25
|
+
spec.email = ["hello@clivern.com"]
|
26
|
+
|
27
|
+
spec.summary = "A Unified SDK for Linux OS Distributions in Ruby."
|
28
|
+
spec.description = "A Set of Modules to work with a different Linux Operating System Distributions in Ruby."
|
29
|
+
spec.homepage = "https://github.com/Clivern/Scone"
|
30
|
+
spec.license = "MIT"
|
13
31
|
spec.required_ruby_version = ">= 2.6.0"
|
14
32
|
|
15
33
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -23,8 +41,9 @@ Gem::Specification.new do |spec|
|
|
23
41
|
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
24
42
|
end
|
25
43
|
end
|
26
|
-
|
27
|
-
spec.
|
44
|
+
|
45
|
+
spec.bindir = "exe"
|
46
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
47
|
spec.require_paths = ["lib"]
|
29
48
|
|
30
49
|
# Uncomment to register a new dependency of your gem
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- clivern
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
@@ -31,13 +31,17 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- bin/console
|
33
33
|
- bin/setup
|
34
|
+
- cache/.gitignore
|
35
|
+
- cache/proc.stat.txt
|
34
36
|
- lib/scone.rb
|
35
|
-
- lib/scone/io/
|
36
|
-
- lib/scone/io/
|
37
|
-
- lib/scone/io/
|
38
|
-
- lib/scone/
|
39
|
-
- lib/scone/ubuntu/
|
40
|
-
- lib/scone/ubuntu/
|
37
|
+
- lib/scone/io/directory.rb
|
38
|
+
- lib/scone/io/file.rb
|
39
|
+
- lib/scone/io/system.rb
|
40
|
+
- lib/scone/platform.rb
|
41
|
+
- lib/scone/ubuntu/group.rb
|
42
|
+
- lib/scone/ubuntu/package.rb
|
43
|
+
- lib/scone/ubuntu/stat.rb
|
44
|
+
- lib/scone/ubuntu/user.rb
|
41
45
|
- lib/scone/version.rb
|
42
46
|
- renovate.json
|
43
47
|
- scone.gemspec
|
data/lib/scone/ubuntu/Package.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Scone - A Unified SDK for Linux OS Distributions in Ruby
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
module Package
|
18
|
-
|
19
|
-
end
|
data/lib/scone/ubuntu/User.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Scone - A Unified SDK for Linux OS Distributions in Ruby
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
module User
|
18
|
-
|
19
|
-
end
|