mool 3.0.3 → 3.0.4

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
- ---
2
- SHA1:
3
- metadata.gz: 9295f700cae5807201956c95bb52d2eb7bc6ab08
4
- data.tar.gz: bfd04e0f598e3c3633b9b24c1c7d2640ffe0ec01
5
- SHA512:
6
- metadata.gz: 92f5b5228a1ce6f17d4b5e56602c9a44f363d033baca541b82f4dff876d99ae53f39324e4434180ed0ce6c96a4cb62387cc84bbe3c33fafe60636f3f36c8cb58
7
- data.tar.gz: aa199535a5a1779253051220d8a415d1a742b8c1d15277580e867af655a0d5c19852878a30f599ba81e49d4601c348c9d26e7c64e89f3dce5638090cbcb24d97
1
+ ---
2
+ SHA512:
3
+ data.tar.gz: 07ff4c8a4b049899c63d5b69b5a2003191daae26be016d20bd15099fe6709decf235035b68405d92ad1b7e6a3f098e08b9e704c13e81cc4c34dbd84ba5a0e836
4
+ metadata.gz: f9c76443f9f84d2aa5f32f874ffab89f8948bd57e21d4b3d50bb23148c772134b9c7b65b366b4988d557aa422f8f69397d21ebe233ce73e837d68c01805df97f
5
+ SHA1:
6
+ data.tar.gz: 668b7d3e2c182767a145970cd38ff1894a1eb55b
7
+ metadata.gz: e4a8dba4cee2e87cb154eb99106e459f73044880
data/lib/mool/command.rb CHANGED
@@ -10,7 +10,7 @@ module Mool
10
10
  end
11
11
 
12
12
  def self.df_command
13
- `df`
13
+ `POSIXLY_CORRECT=512 df`
14
14
  end
15
15
 
16
16
  def self.dev_name_command(dev_entry)
data/lib/mool/disk.rb CHANGED
@@ -6,6 +6,10 @@ module Mool
6
6
  :devname,
7
7
  :devtype,
8
8
  :size,
9
+ :total_size,
10
+ :percentage_used,
11
+ :used_size,
12
+ :free_size,
9
13
  :swap,
10
14
  :mount_point,
11
15
  :file_system,
@@ -39,6 +43,7 @@ module Mool
39
43
  end
40
44
 
41
45
  def mounting_point
46
+ @mount_point = nil
42
47
  Mool::Command.mount_command.include?(@logical_name) &&
43
48
  @mount_point ||= Mool::Command.mount_command.scan(
44
49
  /#{@logical_name} (\S+)/
@@ -93,10 +98,15 @@ module Mool
93
98
  result = Mool::Command.df_command.scan(
94
99
  /(#{@logical_name}|#{@devname})\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/
95
100
  ).flatten
96
- @total_block = Mool::Command.capacity_partition_command(@path).chomp.to_f *
97
- Mool::BLOCK_SIZE
98
- @block_used = result[2].to_f * Mool::BLOCK_SIZE
99
- @block_free = @total_block - @block_used
101
+ # @total_block = Mool::Command.capacity_partition_command(@path).chomp.to_f
102
+ @total_block = result[1].to_f
103
+ @total_size = result[1].to_f * Mool::BLOCK_SIZE
104
+ @block_used = result[2].to_f
105
+ @block_free = result[3].to_f
106
+ @used_size = result[2].to_f * Mool::BLOCK_SIZE
107
+ @free_size = result[3].to_f * Mool::BLOCK_SIZE
108
+ return if result.empty?
109
+ @percentage_used = result[4].delete('%')
100
110
  end
101
111
 
102
112
  def partitions
@@ -178,6 +188,26 @@ module Mool
178
188
 
179
189
  disks.each { |disk| disk.partitions.each { |part| part.partitions && part.slaves }}
180
190
  disks.each { |disk| disk.slaves.each { |part| part.partitions && part.slaves }}
191
+
192
+ disks.each do |disk|
193
+ disk.partitions.each do |partition|
194
+ partition.slaves.each do |slave|
195
+ partition.total_size += slave.total_size
196
+ partition.used_size += slave.used_size
197
+ partition.free_size += slave.free_size
198
+ partition.block_free += slave.block_free
199
+ partition.block_used += slave.block_used
200
+ partition.total_block += slave.total_block
201
+ end
202
+ disk.total_size += partition.total_size
203
+ disk.used_size += partition.used_size
204
+ disk.free_size += partition.free_size
205
+ disk.block_free += partition.block_free
206
+ disk.block_used += partition.block_used
207
+ disk.total_block += partition.total_block
208
+ end
209
+ end
210
+
181
211
  disks
182
212
  end
183
213
 
data/lib/mool/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mool
2
- VERSION = "3.0.3"
2
+ VERSION = "3.0.4"
3
3
  end
metadata CHANGED
@@ -1,65 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mool
3
- version: !ruby/object:Gem::Version
4
- version: 3.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.4
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - g.edera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
11
+
12
+ date: 2018-04-03 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.16'
20
- type: :development
21
16
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.16'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: "1.16"
34
22
  type: :development
23
+ version_requirements: *id001
24
+ - !ruby/object:Gem::Dependency
25
+ name: rake
35
26
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.0'
27
+ requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: "10.0"
48
32
  type: :development
33
+ version_requirements: *id002
34
+ - !ruby/object:Gem::Dependency
35
+ name: minitest
49
36
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.0'
55
- description: 'Get operative system information: Disk, Memory, Cpu, Load-average, Processes.'
56
- email:
37
+ requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: "5.0"
42
+ type: :development
43
+ version_requirements: *id003
44
+ description: "Get operative system information: Disk, Memory, Cpu, Load-average, Processes."
45
+ email:
57
46
  - gab.edera@gmail.com
58
47
  executables: []
48
+
59
49
  extensions: []
50
+
60
51
  extra_rdoc_files: []
61
- files:
62
- - ".gitignore"
52
+
53
+ files:
54
+ - .gitignore
63
55
  - Gemfile
64
56
  - LICENSE.txt
65
57
  - README.md
@@ -79,28 +71,30 @@ files:
79
71
  - lib/mool/version.rb
80
72
  - mool.gemspec
81
73
  homepage: https://github.com/gedera/mool
82
- licenses:
74
+ licenses:
83
75
  - MIT
84
- metadata:
76
+ metadata:
85
77
  allowed_push_host: https://rubygems.org
86
78
  post_install_message:
87
79
  rdoc_options: []
88
- require_paths:
80
+
81
+ require_paths:
89
82
  - lib
90
- required_ruby_version: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
- required_rubygems_version: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: '0'
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - &id004
86
+ - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - *id004
100
92
  requirements: []
93
+
101
94
  rubyforge_project:
102
- rubygems_version: 2.6.11
95
+ rubygems_version: 2.6.12
103
96
  signing_key:
104
97
  specification_version: 4
105
98
  summary: Get operative system information (Linux).
106
99
  test_files: []
100
+