scone 0.1.5 → 0.1.9

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: 99500c9ae644a78f8231b5ec64c2931cffd939021ba436b924c4a92544bc16be
4
+ data.tar.gz: 95fc4841209e96936bc7b08b4fba987c701ccbc1d7679ed4263049dfde49fd55
5
5
  SHA512:
6
- metadata.gz: d9235aa210b037a90d34df2f0ab5a607f1a9c5485cd43312001a1945952e6a7ec2172f3a8cf3a544ab3cc2c67df9c0c5d77d6bee3c08ea8699e0106c025f8f98
7
- data.tar.gz: d5480dcdb92e34db286f5615f5ce71a0f3dfb2159c10ec43d65244b543b0efc8d143c835834ab32028f614b41671a45dbeab1e48770de4d5add316da6fe1584c
6
+ metadata.gz: ffafa062e3fae1b706bae8878330fad4f852082ff70250a79a0fbcf545d6827803719c1c9d206427f9e543c93446c4f454e5370e309832d9c93221be1aa363e7
7
+ data.tar.gz: daa854f58fd9acc132b6e06ebacfacdb69c5c357f024178805f5509e7b0b3a745bfcb45cd683b050e7d305d0563916dd0ae675a2e8510dde63a2c4a3e5b7babc
data/.rubocop.yml CHANGED
@@ -1,13 +1,9 @@
1
+ inherit_gem:
2
+ rubocop-shopify: rubocop.yml
3
+
1
4
  AllCops:
5
+ NewCops: enable
2
6
  TargetRubyVersion: 2.6
3
7
 
4
- Style/StringLiterals:
5
- Enabled: true
6
- EnforcedStyle: double_quotes
7
-
8
- Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
- EnforcedStyle: double_quotes
11
-
12
- Layout/LineLength:
13
- Max: 120
8
+ Style/SymbolProc:
9
+ Enabled: false
data/Gemfile CHANGED
@@ -8,3 +8,4 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
  gem "rspec", "~> 3.0"
10
10
  gem "rubocop", "~> 1.21"
11
+ gem "rubocop-shopify", "~> 2.3.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scone (0.1.0)
4
+ scone (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -39,6 +39,8 @@ GEM
39
39
  unicode-display_width (>= 1.4.0, < 3.0)
40
40
  rubocop-ast (1.12.0)
41
41
  parser (>= 3.0.1.1)
42
+ rubocop-shopify (2.3.0)
43
+ rubocop (~> 1.22)
42
44
  ruby-progressbar (1.11.0)
43
45
  unicode-display_width (2.1.0)
44
46
 
@@ -49,6 +51,7 @@ DEPENDENCIES
49
51
  rake (~> 13.0)
50
52
  rspec (~> 3.0)
51
53
  rubocop (~> 1.21)
54
+ rubocop-shopify (~> 2.3.0)
52
55
  scone!
53
56
 
54
57
  BUNDLED WITH
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/Rakefile CHANGED
@@ -9,4 +9,4 @@ require "rubocop/rake_task"
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
12
- task default: %i[spec rubocop]
12
+ task default: [:spec, :rubocop]
data/cache/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  *
2
+ !proc.stat.txt
3
+ !ifconfig.txt
2
4
  !.gitignore
@@ -0,0 +1,18 @@
1
+ eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
2
+ inet 104.248.58.9 netmask 255.255.240.0 broadcast 104.248.63.255
3
+ inet6 2604:a880:400:d0::1986:5001 prefixlen 64 scopeid 0x0<global>
4
+ inet6 fe80::5074:3eff:fe15:d08b prefixlen 64 scopeid 0x20<link>
5
+ ether 52:74:3e:15:d0:8b txqueuelen 1000 (Ethernet)
6
+ RX packets 663200 bytes 90827363 (90.8 MB)
7
+ RX errors 0 dropped 0 overruns 0 frame 0
8
+ TX packets 652332 bytes 479484344 (479.4 MB)
9
+ TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
10
+
11
+ lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
12
+ inet 127.0.0.1 netmask 255.0.0.0
13
+ inet6 ::1 prefixlen 128 scopeid 0x10<host>
14
+ loop txqueuelen 1000 (Local Loopback)
15
+ RX packets 0 bytes 0 (0.0 B)
16
+ RX errors 0 dropped 0 overruns 0 frame 0
17
+ TX packets 0 bytes 0 (0.0 B)
18
+ TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
@@ -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
@@ -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
@@ -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
+ # Ubuntu Module
22
+ module Ubuntu
23
+ # IP Address Class
24
+ class IPAddr
25
+ end
26
+ end
27
+ 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
@@ -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.9"
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
  #
@@ -22,7 +24,7 @@ Gem::Specification.new do |spec|
22
24
  spec.authors = ["clivern"]
23
25
  spec.email = ["hello@clivern.com"]
24
26
 
25
- spec.summary = "A Unified SDK for Linux OS Distributions in Ruby."
27
+ spec.summary = "A Ruby SDK for Different Linux Operating System Distributions."
26
28
  spec.description = "A Set of Modules to work with a different Linux Operating System Distributions in Ruby."
27
29
  spec.homepage = "https://github.com/Clivern/Scone"
28
30
  spec.license = "MIT"
@@ -35,7 +37,7 @@ Gem::Specification.new do |spec|
35
37
  # Specify which files should be added to the gem when it is released.
36
38
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
37
39
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
38
- `git ls-files -z`.split("\x0").reject do |f|
40
+ %x(git ls-files -z).split("\x0").reject do |f|
39
41
  (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
40
42
  end
41
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - clivern
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-24 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Set of Modules to work with a different Linux Operating System Distributions
14
14
  in Ruby.
@@ -32,13 +32,18 @@ files:
32
32
  - bin/console
33
33
  - bin/setup
34
34
  - cache/.gitignore
35
+ - cache/ifconfig.txt
36
+ - cache/proc.stat.txt
35
37
  - lib/scone.rb
36
- - lib/scone/io/Directory.rb
37
- - lib/scone/io/File.rb
38
- - lib/scone/io/System.rb
39
- - lib/scone/ubuntu/Group.rb
40
- - lib/scone/ubuntu/Package.rb
41
- - lib/scone/ubuntu/User.rb
38
+ - lib/scone/io/directory.rb
39
+ - lib/scone/io/file.rb
40
+ - lib/scone/io/system.rb
41
+ - lib/scone/platform.rb
42
+ - lib/scone/ubuntu/group.rb
43
+ - lib/scone/ubuntu/ip.rb
44
+ - lib/scone/ubuntu/package.rb
45
+ - lib/scone/ubuntu/stat.rb
46
+ - lib/scone/ubuntu/user.rb
42
47
  - lib/scone/version.rb
43
48
  - renovate.json
44
49
  - scone.gemspec
@@ -67,5 +72,5 @@ requirements: []
67
72
  rubygems_version: 3.1.6
68
73
  signing_key:
69
74
  specification_version: 4
70
- summary: A Unified SDK for Linux OS Distributions in Ruby.
75
+ summary: A Ruby SDK for Different Linux Operating System Distributions.
71
76
  test_files: []
@@ -1,18 +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
- end
@@ -1,18 +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
- end