scone 0.1.4 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0d27795c29032d6ed593f5a04b1b0a87bafbbd8021bc3f7c1aa35ead4771c3e
4
- data.tar.gz: a5e509a0b5665ad22166c35a08ab047f5ed1e45e84b2ca542473213414324f25
3
+ metadata.gz: 1d64f4f9ea56d29a7332f66027872d77346bbfdde74b2ee53127b202b7e76205
4
+ data.tar.gz: e2c4039fc5dc29bf34d6f54941a01d563e1e8a5b79a1bd5e5b74d005fe6d1682
5
5
  SHA512:
6
- metadata.gz: e77a018cb9e01cc8531425127b7e4b855389d403cc1c11a0271ca97616a3980492ae93a5c9e019e2abbbb827b0252d8fa5ac13c541d9f8d814f4040e223f8077
7
- data.tar.gz: 83326ac63d84a3ecbd7a05db88bb760c4ff2a4a417dd74612281717f528a181062b41e23d8001601bae51de60c277ac4f74a11a0640f35411dc710195a7a9275
6
+ metadata.gz: 96e3d1888d6f9c20aa5d1ab5d06736d6e9c113d20d45d0d36a24ef4c549a1a4705d0dddbb29b5b0101350bbcbc43dd3329a86c1f62e8f4a428ed844d4ed83496
7
+ data.tar.gz: 5d379fd75ce99aa29027b17137bda3df98ec3020c350d14e1f59ced7e5b88cce78a36ed8bc1bd73789b3c7c58dd279115a53c37ccdd80e1427bfdd6565973295
data/.rubocop.yml CHANGED
@@ -1,13 +1,5 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
1
+ inherit_gem:
2
+ rubocop-shopify: rubocop.yml
3
3
 
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
4
+ Style/SymbolProc:
5
+ 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,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
@@ -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,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.4"
21
+ VERSION = "0.1.8"
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
  #
@@ -35,10 +37,11 @@ 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
44
+
42
45
  spec.bindir = "exe"
43
46
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
44
47
  spec.require_paths = ["lib"]
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.4
4
+ version: 0.1.8
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,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
- - 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
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
42
45
  - lib/scone/version.rb
43
46
  - renovate.json
44
47
  - scone.gemspec
@@ -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