LinuxSystemInfo 0.0.1 → 0.0.2

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: 73d92283b612c6974d932ff743685a58d88cd83b
4
- data.tar.gz: 0ce6cacfa0e87c0b5f4738b65ae771c2d8da767f
3
+ metadata.gz: 3e77581804c8079d35f6a27203996e5d379d4c76
4
+ data.tar.gz: 1f70eadf838f4718ac9a3038b65e8726216e2ece
5
5
  SHA512:
6
- metadata.gz: be4e3174e0de0eb7a1e6b567a2c4ebc14f247fbee7a637ea2165fbd7733ff7ce907600d34be6c5d7eee7b7b95a03bafde66c997ee5fe1e72f4cc8e68974f0fd2
7
- data.tar.gz: 605b366086fb81a807555740cad5aff4e0729c3c8e69fe6e975ab12fe6dee896614df78f8f9fec94dc8f96aca82839fa7af6f6b04b041416157ea76c2a9fd3e2
6
+ metadata.gz: 037359ad3a1d4008dcd38e2da72c813fd9a089293c85653a47037712247d7b3e47ec3ca4ffd671cb1649aef7c0df08139a55df450965490fc5b88ec3a7da3b18
7
+ data.tar.gz: 8bd414fc3d65bc29619b00abac4da3e74097524aee81371e605d6c76a8df8d5b605ea0516b3bcf23d4b1ef59633923416e10bd938a259ba54dedb6c18cc0dc71
data/README.md CHANGED
@@ -1,11 +1,28 @@
1
1
  # LinuxSystemInfo
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/LinuxSystemInfo.svg)](http://badge.fury.io/rb/LinuxSystemInfo)
3
4
  [![Dependency Status](https://gemnasium.com/SaimonL/linux-system-info.svg)](https://gemnasium.com/SaimonL/linux-system-info)
4
5
 
5
6
  Linux System Info is a gem that allows you to get information about you're linux
6
7
  computer. It retrieves information such as CPU, RAM, Hard drive etc. This works
7
8
  only for your local computer and for Linux Debain or Redhat based operating system.
8
9
 
10
+ ## Requirements
11
+
12
+ The following utility is needed to get a list of devices connected to the PCI bus.
13
+
14
+ Debain based linux (installed by default)
15
+
16
+ ```bash
17
+ sudo apt-get install pciutils
18
+ ````
19
+
20
+ RedHat based linux (not installed by default)
21
+
22
+ ```bash
23
+ sudo yum install pciutils
24
+ ````
25
+
9
26
  ## Installation
10
27
 
11
28
  Add this line to your application's Gemfile:
@@ -285,7 +302,7 @@ Example: LinuxSystemInfo.to_s
285
302
 
286
303
  ## Contributing
287
304
 
288
- 1. Fork it ( https://github.com/[my-github-username]/LinuxSystemInfo/fork )
305
+ 1. Fork it ( https://github.com/SaimonL/LinuxSystemInfo/fork )
289
306
  2. Create your feature branch (`git checkout -b my-new-feature`)
290
307
  3. Commit your changes (`git commit -am 'Add some feature'`)
291
308
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module LinuxSystemInfo
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
@@ -29,7 +29,7 @@ module LinuxSystemInfo
29
29
  cpu_detail = `cat /proc/cpuinfo`
30
30
  cpu_detail = cpu_detail.split("\n")
31
31
 
32
- {
32
+ output = {
33
33
  :model => {
34
34
  :name => cpu_detail.grep(/model name/).first.split(':').last,
35
35
  :number => cpu.grep(/Model/).first.split.last
@@ -40,14 +40,17 @@ module LinuxSystemInfo
40
40
  :cores => cpu.grep(/Core/).first.split.last,
41
41
  :socket => cpu.grep(/Socket/).first.split.last,
42
42
  :family => cpu.grep(/family/).first.split.last,
43
- :flags => cpu_detail.grep(/flags/).first.split(':').last,
44
- :L1 => {
45
- :d => cpu.grep(/L1d cache/).first.split.last,
46
- :i => cpu.grep(/L1i cache/).first.split.last
47
- },
48
- :L2 => cpu.grep(/L2 cache/).first.split.last,
49
- :L3 => cpu.grep(/L3 cache/).first.split.last
43
+ :flags => cpu_detail.grep(/flags/).first.split(':').last
50
44
  }
45
+
46
+ (1..50).each do |l|
47
+ find = "L#{l}[a-z]* cache:"
48
+ unless cpu.grep(/#{find}/) == []
49
+ output.merge!({ :"L#{l}" => cpu.grep(/#{find}/).first.split(':').last.strip })
50
+ end
51
+ end
52
+
53
+ output
51
54
  end
52
55
 
53
56
  def memory
data/spec/cpu_spec.rb CHANGED
@@ -46,20 +46,10 @@ describe 'With cpu info' do
46
46
  expect(@cpu[:flags]).to_not be_nil
47
47
  end
48
48
 
49
- it 'will have L1d' do
50
- expect(@cpu[:L1][:d]).to match /\d+K/
51
- end
52
-
53
- it 'will have L1i' do
54
- expect(@cpu[:L1][:i]).to match /\d+K/
55
- end
56
-
57
- it 'will have L2' do
58
- expect(@cpu[:L2]).to match /\d+K/
59
- end
60
-
61
- it 'will have L3' do
62
- expect(@cpu[:L3]).to match /\d+K/
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
63
53
  end
64
54
  end
65
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LinuxSystemInfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saimon Lovell