LinuxSystemInfo 0.1.2 → 0.2.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 +5 -5
- data/CHANGELOG.md +9 -0
- data/LinuxSystemInfo.gemspec +20 -5
- data/README.md +30 -5
- data/lib/LinuxSystemInfo/version.rb +1 -1
- data/lib/LinuxSystemInfo.rb +13 -10
- data/lib/accounts/users.rb +39 -0
- data/lib/components/media.rb +1 -1
- data/lib/components/memory.rb +1 -1
- data/lib/components/network.rb +9 -9
- data/lib/components/processors.rb +3 -3
- metadata +30 -33
- data/.gitignore +0 -18
- data/.travis.yml +0 -7
- data/spec/audio_spec.rb +0 -17
- data/spec/connection_spec.rb +0 -29
- data/spec/cpu_spec.rb +0 -55
- data/spec/info_spec.rb +0 -25
- data/spec/network_spec.rb +0 -17
- data/spec/ram_spec.rb +0 -37
- data/spec/spec_helper.rb +0 -4
- data/spec/storage_spec.rb +0 -38
- data/spec/usb_spec.rb +0 -17
- data/spec/video_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f477fcc02854dcdebf654f03cfdf5262d0a1f28a70b642dd2ec53d6be51f5f9
|
4
|
+
data.tar.gz: '086ce8b2249aa22c047ccb5083234d490e0abfb8adabd45cc6763a898f7e0a00'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8db5837c7fbbfe98bd3d90d54c9a855f4c37a51cd0275d6a42518353eae3529fac43daf8dc852a8de285f6efb7d1a682f0ef646c6b20bc37bab61477bb6568c
|
7
|
+
data.tar.gz: 78f5925b6d8a61710261eeb3f7c739823c57ef99298c25ac291280d246637108a0621c643687001cd24d7cf5e0fa51ed52090000ab0e6fd1ec4bed6bb82c1a20
|
data/CHANGELOG.md
ADDED
data/LinuxSystemInfo.gemspec
CHANGED
@@ -1,20 +1,34 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
require 'LinuxSystemInfo/version'
|
2
|
+
|
3
|
+
require_relative 'lib/LinuxSystemInfo/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'LinuxSystemInfo'
|
8
7
|
spec.version = LinuxSystemInfo::VERSION
|
9
8
|
spec.authors = ['Saimon Lovell']
|
10
9
|
spec.email = ['staysynchronize@gmail.com']
|
10
|
+
|
11
11
|
spec.summary = %q{Get local linux hardware information.}
|
12
12
|
spec.description = %q{This gem gives information about RAM, CPU, HARD Drives and more. Works only on Linux OS.}
|
13
13
|
spec.homepage = 'https://github.com/SaimonL/linux-system-info'
|
14
14
|
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 3.0.0'
|
16
|
+
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/SaimonL/linux-system-info'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/SaimonL/linux-system-info/blob/master/CHANGELOG.md'
|
22
|
+
|
23
|
+
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
15
29
|
|
16
|
-
spec.
|
17
|
-
spec.executables = spec.files.grep(%r{
|
30
|
+
spec.bindir = 'exe'
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
18
32
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
33
|
spec.require_paths = ['lib']
|
20
34
|
|
@@ -24,4 +38,5 @@ Gem::Specification.new do |spec|
|
|
24
38
|
spec.add_development_dependency 'rake'
|
25
39
|
spec.add_development_dependency 'json'
|
26
40
|
spec.add_development_dependency 'rspec'
|
41
|
+
spec.add_development_dependency 'pry'
|
27
42
|
end
|
data/README.md
CHANGED
@@ -11,16 +11,16 @@ only for your local computer and for Linux Debain or Redhat based operating syst
|
|
11
11
|
|
12
12
|
The following utility is needed to get a list of devices connected to the PCI bus.
|
13
13
|
|
14
|
-
Debain based
|
14
|
+
Debain based Linux
|
15
15
|
|
16
16
|
```bash
|
17
|
-
sudo apt-get install pciutils sysstat
|
17
|
+
sudo apt-get install pciutils sysstat net-tools
|
18
18
|
````
|
19
19
|
|
20
|
-
RedHat based
|
20
|
+
RedHat based Linux
|
21
21
|
|
22
22
|
```bash
|
23
|
-
sudo yum install pciutils sysstat
|
23
|
+
sudo yum install pciutils sysstat net-tools
|
24
24
|
````
|
25
25
|
|
26
26
|
# Installation
|
@@ -70,7 +70,7 @@ Or install it yourself as:
|
|
70
70
|
:cores => "2",
|
71
71
|
:socket => "1",
|
72
72
|
:family => "6",
|
73
|
-
:flags => "fpu vme de pse tsc msr pae mce cx8 apic
|
73
|
+
:flags => ["fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic"],
|
74
74
|
:L1=>
|
75
75
|
{
|
76
76
|
:d => "32K",
|
@@ -243,6 +243,31 @@ Returns all process that are not by root, nobody, and syslog user.
|
|
243
243
|
}
|
244
244
|
```
|
245
245
|
|
246
|
+
### Users
|
247
|
+
|
248
|
+
#### LinuxSystemInfo.users
|
249
|
+
|
250
|
+
Returns an array of all users including systems
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
[
|
254
|
+
{
|
255
|
+
account: "deleteme",
|
256
|
+
uid: 1001,
|
257
|
+
gid: 1001,
|
258
|
+
info: {
|
259
|
+
full_name: "full name",
|
260
|
+
room_number: "room number",
|
261
|
+
work_phone: "work phone",
|
262
|
+
home_phone: "home phone",
|
263
|
+
other: "other"
|
264
|
+
},
|
265
|
+
home: "/home/deleteme",
|
266
|
+
shell: "/bin/bash"
|
267
|
+
},
|
268
|
+
]
|
269
|
+
```
|
270
|
+
|
246
271
|
### ALL
|
247
272
|
|
248
273
|
#### LinuxSystemInfo.all
|
data/lib/LinuxSystemInfo.rb
CHANGED
@@ -6,6 +6,8 @@ require 'components/network'
|
|
6
6
|
require 'components/memory'
|
7
7
|
require 'components/media'
|
8
8
|
|
9
|
+
require 'accounts/users'
|
10
|
+
|
9
11
|
module LinuxSystemInfo
|
10
12
|
class << self
|
11
13
|
def info
|
@@ -45,16 +47,17 @@ module LinuxSystemInfo
|
|
45
47
|
|
46
48
|
def all
|
47
49
|
{
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
50
|
+
info: info,
|
51
|
+
hostname: hostname,
|
52
|
+
cpu: { info: cpu, usage: cpu_usage },
|
53
|
+
ram: memory,
|
54
|
+
storage: storage,
|
55
|
+
network: network,
|
56
|
+
connection: connection,
|
57
|
+
video: video,
|
58
|
+
audio: audio,
|
59
|
+
usb: usb,
|
60
|
+
users: users
|
58
61
|
}
|
59
62
|
end
|
60
63
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module LinuxSystemInfo
|
2
|
+
class << self
|
3
|
+
def users
|
4
|
+
data = []
|
5
|
+
all_users = `cat /etc/passwd`.split("\n")
|
6
|
+
|
7
|
+
all_users.each do |each_user|
|
8
|
+
data << extract_user(each_user)
|
9
|
+
end
|
10
|
+
|
11
|
+
data
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def extract_user(data)
|
17
|
+
user = data.split(':')
|
18
|
+
|
19
|
+
{
|
20
|
+
account: user[0],
|
21
|
+
uid: user[2]&.to_i,
|
22
|
+
gid: user[3]&.to_i,
|
23
|
+
info: extract_user_info(user[4]),
|
24
|
+
home: user[5],
|
25
|
+
shell: user[6]
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def extract_user_info(data)
|
30
|
+
info = data&.split(',')
|
31
|
+
|
32
|
+
if info.empty? || info.count == 1
|
33
|
+
{ full_name: nil, room_number: nil, work_phone: nil, home_phone: nil, other: nil }
|
34
|
+
else
|
35
|
+
{ full_name: info[0], room_number: info[1], work_phone: info[2], home_phone: info[3], other: info[4] }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/components/media.rb
CHANGED
data/lib/components/memory.rb
CHANGED
data/lib/components/network.rb
CHANGED
@@ -2,19 +2,19 @@ module LinuxSystemInfo
|
|
2
2
|
class << self
|
3
3
|
def connection
|
4
4
|
output = Hash.new
|
5
|
-
|
6
|
-
|
5
|
+
networks = `ifconfig`
|
6
|
+
networks = networks.split("\n\n")
|
7
7
|
|
8
|
-
|
8
|
+
networks.each do |data|
|
9
9
|
interface = data.scan(/^[a-z]+\d?/).first
|
10
10
|
next if interface == 'lo'
|
11
|
-
|
11
|
+
|
12
12
|
output[interface] = {
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
13
|
+
mac: data.match(/ether [a-z0-9:]+/).to_s.sub('ether ', ''),
|
14
|
+
ip: data.match(/inet (\d+\.)+\d+/).to_s.sub('inet ', ''),
|
15
|
+
mask: data.match(/netmask (\d+\.?)+/).to_s.sub('netmask ', ''),
|
16
|
+
broadcast: data.match(/broadcast (\d+\.?)+/).to_s.sub('broadcast ', ''),
|
17
|
+
ip6: data.match(/inet6 (([a-z]|\d)+([a-z]|\d)+(:|::)+)+(([a-z]|\d)+(\/)*([a-z]|\d)+)/).to_s.sub('inet6 ', '').strip
|
18
18
|
}
|
19
19
|
end
|
20
20
|
output
|
@@ -8,7 +8,7 @@ module LinuxSystemInfo
|
|
8
8
|
cpu_detail = cpu_detail.split("\n")
|
9
9
|
|
10
10
|
output = {
|
11
|
-
:model
|
11
|
+
:model => {
|
12
12
|
:name => cpu_detail.grep(/model name/).first.split(':').last,
|
13
13
|
:number => cpu.grep(/Model/).first.split.last
|
14
14
|
},
|
@@ -18,7 +18,7 @@ module LinuxSystemInfo
|
|
18
18
|
:cores => cpu.grep(/Core/).first.split.last,
|
19
19
|
:socket => cpu.grep(/Socket/).first.split.last,
|
20
20
|
:family => cpu.grep(/family/).first.split.last,
|
21
|
-
:flags => cpu_detail.grep(/flags/).first.split(':').last
|
21
|
+
:flags => cpu_detail.grep(/flags/).first.split(':').last&.split(' ')&.compact&.sort
|
22
22
|
}
|
23
23
|
|
24
24
|
(1..50).each do |l|
|
@@ -71,4 +71,4 @@ module LinuxSystemInfo
|
|
71
71
|
output
|
72
72
|
end
|
73
73
|
end
|
74
|
-
end
|
74
|
+
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saimon Lovell
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: This gem gives information about RAM, CPU, HARD Drives and more. Works
|
84
98
|
only on Linux OS.
|
85
99
|
email:
|
@@ -88,9 +102,8 @@ executables: []
|
|
88
102
|
extensions: []
|
89
103
|
extra_rdoc_files: []
|
90
104
|
files:
|
91
|
-
- ".gitignore"
|
92
105
|
- ".rspec"
|
93
|
-
-
|
106
|
+
- CHANGELOG.md
|
94
107
|
- Gemfile
|
95
108
|
- LICENSE.txt
|
96
109
|
- LinuxSystemInfo.gemspec
|
@@ -98,26 +111,21 @@ files:
|
|
98
111
|
- Rakefile
|
99
112
|
- lib/LinuxSystemInfo.rb
|
100
113
|
- lib/LinuxSystemInfo/version.rb
|
114
|
+
- lib/accounts/users.rb
|
101
115
|
- lib/components/media.rb
|
102
116
|
- lib/components/memory.rb
|
103
117
|
- lib/components/network.rb
|
104
118
|
- lib/components/processors.rb
|
105
|
-
- spec/audio_spec.rb
|
106
|
-
- spec/connection_spec.rb
|
107
|
-
- spec/cpu_spec.rb
|
108
|
-
- spec/info_spec.rb
|
109
|
-
- spec/network_spec.rb
|
110
|
-
- spec/ram_spec.rb
|
111
|
-
- spec/spec_helper.rb
|
112
|
-
- spec/storage_spec.rb
|
113
|
-
- spec/usb_spec.rb
|
114
|
-
- spec/video_spec.rb
|
115
119
|
- tasks/rspec.rake
|
116
120
|
homepage: https://github.com/SaimonL/linux-system-info
|
117
121
|
licenses:
|
118
122
|
- MIT
|
119
|
-
metadata:
|
120
|
-
|
123
|
+
metadata:
|
124
|
+
allowed_push_host: https://rubygems.org
|
125
|
+
homepage_uri: https://github.com/SaimonL/linux-system-info
|
126
|
+
source_code_uri: https://github.com/SaimonL/linux-system-info
|
127
|
+
changelog_uri: https://github.com/SaimonL/linux-system-info/blob/master/CHANGELOG.md
|
128
|
+
post_install_message:
|
121
129
|
rdoc_options: []
|
122
130
|
require_paths:
|
123
131
|
- lib
|
@@ -125,26 +133,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
133
|
requirements:
|
126
134
|
- - ">="
|
127
135
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
136
|
+
version: 3.0.0
|
129
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
138
|
requirements:
|
131
139
|
- - ">="
|
132
140
|
- !ruby/object:Gem::Version
|
133
141
|
version: '0'
|
134
142
|
requirements: []
|
135
|
-
|
136
|
-
|
137
|
-
signing_key:
|
143
|
+
rubygems_version: 3.4.18
|
144
|
+
signing_key:
|
138
145
|
specification_version: 4
|
139
146
|
summary: Get local linux hardware information.
|
140
|
-
test_files:
|
141
|
-
- spec/audio_spec.rb
|
142
|
-
- spec/connection_spec.rb
|
143
|
-
- spec/cpu_spec.rb
|
144
|
-
- spec/info_spec.rb
|
145
|
-
- spec/network_spec.rb
|
146
|
-
- spec/ram_spec.rb
|
147
|
-
- spec/spec_helper.rb
|
148
|
-
- spec/storage_spec.rb
|
149
|
-
- spec/usb_spec.rb
|
150
|
-
- spec/video_spec.rb
|
147
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/spec/audio_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With audio info' do
|
4
|
-
before(:all) do
|
5
|
-
@audio = LinuxSystemInfo.audio
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have hard drives' do
|
10
|
-
expect(@audio.size).to be >= 1
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will detect correct device' do
|
14
|
-
expect(@audio.first).to match /(Audio|HDA|HDMI)/
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/connection_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With connection info' do
|
4
|
-
before(:all) do
|
5
|
-
@connection = LinuxSystemInfo.connection
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have proper ips' do
|
10
|
-
expect(@connection.first.last.length).to eq 5
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have proper mac address' do
|
14
|
-
expect(@connection.first.last[:mac]).to match /([a-z]|\d|:)+/
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'will have proper ip address' do
|
18
|
-
expect(@connection.first.last[:ip]).to match /(\d|\.)+/
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'will have proper mask' do
|
22
|
-
expect(@connection.first.last[:mask]).to match /(\d|\.)+/
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'will have proper broadcast' do
|
26
|
-
expect(@connection.first.last[:broadcast]).to match /(\d|\.)+/
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/spec/cpu_spec.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With cpu info' do
|
4
|
-
before(:all) do
|
5
|
-
@cpu = LinuxSystemInfo.cpu
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have models' do
|
10
|
-
expect(@cpu[:model].length).to eq 2
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have model name' do
|
14
|
-
expect(@cpu[:model][:name]).to_not be_empty
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'will have model number' do
|
18
|
-
expect(@cpu[:model][:number]).to_not be_empty
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'will have address size' do
|
22
|
-
expect(@cpu[:address_sizes]).to include 'bits'
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'will have architecture' do
|
26
|
-
expect(@cpu[:architecture]).to_not be_empty
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'will have threads' do
|
30
|
-
expect(@cpu[:threads].to_i).to be >= 0
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'will have cores' do
|
34
|
-
expect(@cpu[:cores].to_i).to be > 0
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'will have socket' do
|
38
|
-
expect(@cpu[:socket].to_i).to be > 0
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'will have family' do
|
42
|
-
expect(@cpu[:family]).to_not be_nil
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'will have flags' do
|
46
|
-
expect(@cpu[:flags]).to_not be_nil
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'will have all L caches' do
|
50
|
-
(1..50).each do |l|
|
51
|
-
expect(@cpu[:"L#{l}"]).to match(/\d+K/) unless @cpu[:"L#{l}"].nil?
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
data/spec/info_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With info' do
|
4
|
-
before(:all) do
|
5
|
-
@os = LinuxSystemInfo.info
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have valid list' do
|
10
|
-
expect(@os.length).to be == 3
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have os' do
|
14
|
-
expect(@os.first).to_not be_nil
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'will have valid uptime' do
|
18
|
-
expect(@os[:uptime]).to match /\d+:\d+:\d+ up/
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'will have valid users count' do
|
22
|
-
expect(@os[:users].to_i).to be >= 0
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/network_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With network info' do
|
4
|
-
before(:all) do
|
5
|
-
@network = LinuxSystemInfo.network
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have one or more network' do
|
10
|
-
expect(@network.length).to be > 0
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have network indo' do
|
14
|
-
expect(@network.first).to_not be_nil
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/ram_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With memory info' do
|
4
|
-
before(:all) do
|
5
|
-
@ram = LinuxSystemInfo.memory
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have measurement unit' do
|
10
|
-
expect(@ram[:unit]).to eq 'Megabyte'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have valid total' do
|
14
|
-
expect(@ram[:total].to_i).to be > 64
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'will have valid used' do
|
18
|
-
expect(@ram[:used].to_i).to be > 64
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'will have valid free' do
|
22
|
-
expect(@ram[:free].to_i).to be >= 0
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'will have valid shared' do
|
26
|
-
expect(@ram[:shared].to_i).to be >= 0
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'will have valid buffers' do
|
30
|
-
expect(@ram[:buffers].to_i).to be >= 0
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'will have valid cached' do
|
34
|
-
expect(@ram[:buffers].to_i).to be >= 0
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/storage_spec.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With storage info' do
|
4
|
-
before(:all) do
|
5
|
-
@storage = LinuxSystemInfo.storage
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have hard drives' do
|
10
|
-
expect(@storage.length).to be >= 1
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have 5 units per drive' do
|
14
|
-
expect(@storage.first.last.length).to eq 5
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'will have valid size' do
|
18
|
-
expect(@storage.first.last[:size]).to match /\d+(T|G|M|K)/
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'will have valid used' do
|
22
|
-
expect(@storage.first.last[:used]).to match /\d+(T|G|M|K)/
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'will have valid available' do
|
26
|
-
expect(@storage.first.last[:available]).to match /\d+(T|G|M|K)/
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'will have valid used_percentage' do
|
30
|
-
expect(@storage.first.last[:used_percentage]).to match /\d+%/
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'will have valid mount point' do
|
34
|
-
expect(File.exist?(@storage.first.last[:mount])).to eq true
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
data/spec/usb_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With usb info' do
|
4
|
-
before(:all) do
|
5
|
-
@usb = LinuxSystemInfo.usb
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have one or more usb' do
|
10
|
-
expect(@usb.length).to be > 0
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will have usb indo' do
|
14
|
-
expect(@usb.first).to_not be_nil
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/video_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'With video info' do
|
4
|
-
before(:all) do
|
5
|
-
@video = LinuxSystemInfo.video
|
6
|
-
end
|
7
|
-
|
8
|
-
describe 'the returned value' do
|
9
|
-
it 'will have hard drives' do
|
10
|
-
expect(@video.size).to be >= 1
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'will detect correct device' do
|
14
|
-
expect(@video.first).to match /(Radeon|HD|VGA|Graphics Controller)/
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|