vidibus-sysinfo 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,16 +22,20 @@ module Vidibus
22
22
 
23
23
  class << self
24
24
  def command
25
- "free -m | grep Mem:"
25
+ 'free -m'
26
26
  end
27
27
 
28
28
  def parse(output)
29
+ new_format = !!output.match(/available/)
29
30
  if output.match(/^Mem:\s+([\d\s]+)$/)
30
31
  numbers = $1.split(/\s+/)
31
32
  total = numbers[0].to_i
32
33
  buffers = numbers[4].to_i
33
- cached = numbers[5].to_i
34
- used = numbers[1].to_i - buffers - cached
34
+ cached = new_format ? buffers : numbers[5].to_i
35
+ used = numbers[1].to_i
36
+ unless new_format
37
+ used -= buffers + cached
38
+ end
35
39
  Result.new({
36
40
  total: total,
37
41
  used: used,
@@ -1,5 +1,5 @@
1
1
  module Vidibus
2
2
  module Sysinfo
3
- VERSION = '1.1.2'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-sysinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-31 00:00:00.000000000 Z
12
+ date: 2016-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: 2271517936403787525
148
+ hash: 4064069564153402800
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements: