LinuxSystemInfo 0.0.5 → 0.1.0

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
  SHA1:
3
- metadata.gz: bddb8a7b8cd8763dfbc53881ac4da5849f65a44f
4
- data.tar.gz: 0bb6cf8d049b8664a35434e7b9833da09307942d
3
+ metadata.gz: 602d914b59dc1b98b935aa5f0abdfd19b9608e14
4
+ data.tar.gz: 85c06e4e0f9f3a9a20c69bb7b29d73d32ae88b30
5
5
  SHA512:
6
- metadata.gz: f12428a487163082abd0a7481d51ef81cdbd20836c14333a49ce70b54319583bf05699bfcc1871104e640722e1de75222a3dd55fd6e2203f5e4b81e45dd938a4
7
- data.tar.gz: 9fb493c2a884f4c59a0ead181ff7703b834bcaba9b6542995e1e467a10a3cb2c1b2704809b1c50a5af04efc4e4528016ef783dc664a1a5e9ae121cb705fa46cd
6
+ metadata.gz: 73e76d634240de03fcc3d2ffb18f4ed6bbaf14e6f6c0b7da711934967bec513604d82acef1e1daf9e6e215d25275c60c224c91989438e989af28f5d29ec1d7cc
7
+ data.tar.gz: 5853c4f0c29767a4e1b007ee7c8e04015be25b74ccfaa4b38d098716824e3b857fa03e4c3809097f2155b0c5c3e4375ade3159411846ccbe1917e21a8a6bcb94
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
23
  spec.add_development_dependency 'json', '>= 1.7'
24
- spec.add_development_dependency 'rspec', '>= 3.0'
24
+ spec.add_development_dependency 'rspec', '>= 3'
25
25
  end
@@ -4,10 +4,24 @@ require 'json'
4
4
  module LinuxSystemInfo
5
5
  class << self
6
6
  def info
7
+ uptime = `uptime`.strip
8
+ uptime = uptime.split(',')
9
+
10
+ running_time = ''
11
+ users = ''
12
+
13
+ if uptime[1].match(/\d+ (user|users)/).nil?
14
+ running_time = [ uptime[0], uptime[1] ].join ', '
15
+ users = uptime[2]
16
+ else
17
+ running_time = uptime[0]
18
+ users = uptime[1]
19
+ end
20
+
7
21
  {
8
22
  os: `cat /proc/version`.strip,
9
- uptime: `uptime -p`.strip,
10
- users: `users | wc -w`.strip
23
+ uptime: running_time.strip,
24
+ users: users.strip
11
25
  }
12
26
  end
13
27
 
@@ -101,6 +115,7 @@ module LinuxSystemInfo
101
115
  storage.each do |file|
102
116
  file = file.split
103
117
  next if file[0][0..4] != '/dev/'
118
+ next if file[1].nil?
104
119
  output[file[0]] = {
105
120
  :size => file[1],
106
121
  :used => file[2],
@@ -1,3 +1,3 @@
1
1
  module LinuxSystemInfo
2
- VERSION = '0.0.5'
2
+ VERSION = '0.1.0'
3
3
  end
data/spec/audio_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe 'With audio info' do
11
11
  end
12
12
 
13
13
  it 'will detect correct device' do
14
- expect(@audio.first).to match /(Audio)/
14
+ expect(@audio.first).to match /(Audio|HDA|HDMI)/
15
15
  end
16
16
  end
17
17
  end
data/spec/info_spec.rb CHANGED
@@ -15,11 +15,11 @@ describe 'With info' do
15
15
  end
16
16
 
17
17
  it 'will have valid uptime' do
18
- expect(@os[:uptime]).to match /up \d+ [a-z]+, \d+ [a-z]+/
18
+ expect(@os[:uptime]).to match /\d+:\d+:\d+ up/
19
19
  end
20
20
 
21
21
  it 'will have valid users count' do
22
- expect(@os[:users].to_i).to be > 0
22
+ expect(@os[:users].to_i).to be >= 0
23
23
  end
24
24
  end
25
25
  end
data/spec/storage_spec.rb CHANGED
@@ -15,15 +15,15 @@ describe 'With storage info' do
15
15
  end
16
16
 
17
17
  it 'will have valid size' do
18
- expect(@storage.first.last[:size]).to match /\d+(G|M)/
18
+ expect(@storage.first.last[:size]).to match /\d+(T|G|M|K)/
19
19
  end
20
20
 
21
21
  it 'will have valid used' do
22
- expect(@storage.first.last[:used]).to match /\d+(G|M)/
22
+ expect(@storage.first.last[:used]).to match /\d+(T|G|M|K)/
23
23
  end
24
24
 
25
25
  it 'will have valid available' do
26
- expect(@storage.first.last[:available]).to match /\d+(G|M)/
26
+ expect(@storage.first.last[:available]).to match /\d+(T|G|M|K)/
27
27
  end
28
28
 
29
29
  it 'will have valid used_percentage' do
data/spec/video_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe 'With video info' do
11
11
  end
12
12
 
13
13
  it 'will detect correct device' do
14
- expect(@video.first).to match /(VGA|Graphics Controller)/
14
+ expect(@video.first).to match /(Radeon|HD|VGA|Graphics Controller)/
15
15
  end
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LinuxSystemInfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saimon Lovell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '3'
69
69
  description: This gem gives information about RAM, CPU, HARD Drives and more. Works
70
70
  only on Linux OS.
71
71
  email:
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 2.4.5
118
+ rubygems_version: 2.4.6
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Get local linux hardware information.