informo 1.0 → 1.01

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: 0fc4cfd3d130221dfe6ca4689f7e314a83b44364
4
- data.tar.gz: c7c0493ff7144b7fb7e243096681ec68ef12b19e
3
+ metadata.gz: 37ab54aa64d49dcb158ca64729c160eaac47b25e
4
+ data.tar.gz: 615cafc714ee0b9bed1a4676302e81036bb9dc68
5
5
  SHA512:
6
- metadata.gz: 8e73bacc2eb10759ee90fa5717ecfdbe3cfea9cfc0561a170aa3246f1225dbeb8fcb3a932fbd457b114647d2035f1b846ff96422cd6fa373105706f57780be6d
7
- data.tar.gz: 93807cddb9b4c6b3c023617f9dadca7cbd22bfd52a0928fbcd0aa450ba4a52c679432187cc31b6f87a664a69c8f78472a92ff071e629a5efe3796edbc0596423
6
+ metadata.gz: 90010c37426dbd5ad66fd7f053b128a3eb5afd10e06ad63cd1bbfbff82a4f6e9a5233cf1a6683750f8a001b1b124d64ab751e342eab224dded2d646de969f8ad
7
+ data.tar.gz: 0c417b34fe86a78265bad5519fd2609d42f500249beed5b3fc92d1d6fa637c49263fe6fcb9704870cc28c6df412f0ffc6aa5f455a0c02435ac3552fa33b3cd8e
data/README.md CHANGED
@@ -1,16 +1,19 @@
1
1
  # Informo
2
2
 
3
- A ruby gem for retrieving info from linux systems.
3
+ A ruby gem for retrieving info from linux systems. Informo make's it easy to get system information for Linux systems from inside ruby scripts. Currently it is a glorified wrapper around existing native commands and tries to avoid reinventing wheels that already exist inside GNU/Linux
4
4
 
5
5
  ## Installation
6
6
 
7
7
  clone this repo
8
8
 
9
9
  ```
10
- $ gem build informo.gemspec
11
- $ gem install informo-1.0.gem
10
+ $ gem install informo
12
11
  ```
13
12
 
13
+ ## Documentation
14
+
15
+ [rubydoc](http://rubydoc.info/gems/informo/frames)
16
+
14
17
  ## Usage
15
18
 
16
19
  ```
@@ -1,5 +1,3 @@
1
- require 'time'
2
-
3
1
  module Informo
4
2
  ##
5
3
  # This class is used to return information about installed packages
@@ -56,7 +54,7 @@ module Informo
56
54
  ##
57
55
  # returns the installation date of the given package
58
56
  def get_installdate(name)
59
- create_time = Time.at(File.stat(@@pkginfo + "/#{name}.list")).ctime.utc
57
+ create_time = File.stat(@@pkginfo + "/#{name}.list").ctime.utc
60
58
  return create_time
61
59
  end
62
60
  ##
@@ -1,5 +1,5 @@
1
1
  module Informo
2
2
  ##
3
3
  # returns the version of this module
4
- VERSION = '1.0'
4
+ VERSION = '1.01'
5
5
  end
@@ -5,7 +5,7 @@ require 'informo/dpkg' if RUBY_VERSION.to_f >= 1.9
5
5
  class DpkgTest < Test::Unit::TestCase
6
6
  ##
7
7
  # required package for test. this package is requried on every debian/ubuntu system
8
- R_PKG = 'glibc'
8
+ R_PKG = 'at'
9
9
 
10
10
  def test_get_packages
11
11
  dpkg = Informo::Dpkg.new
@@ -16,55 +16,49 @@ class DpkgTest < Test::Unit::TestCase
16
16
  def test_get_version
17
17
  dpkg = Informo::Dpkg.new
18
18
  version = dpkg.get_version(R_PKG)
19
- assert_match '/^\d/', version
19
+ assert_match /^\d/, version
20
20
  end
21
21
 
22
22
  def test_get_architecture
23
23
  dpkg = Informo::Dpkg.new
24
24
  arch = dpkg.get_architecture(R_PKG)
25
- assert_match '/\w+(\d*)?/', arch
25
+ assert_match /\w+(\d*)?/, arch
26
26
  end
27
27
 
28
28
  def test_get_maintainer
29
29
  dpkg = Informo::Dpkg.new
30
30
  maintainer = dpkg.get_maintainer(R_PKG)
31
- assert_match '/\w+/', maintainer
31
+ assert_match /\w+/, maintainer
32
32
  end
33
33
 
34
34
  def test_get_short_desc
35
35
  dpkg = Informo::Dpkg.new
36
36
  desc = dpkg.get_short_description(R_PKG)
37
- assert_match '/\w+/', desc
37
+ assert_match /\w+/, desc
38
38
  end
39
39
 
40
40
  def test_get_desc
41
41
  dpkg = Informo::Dpkg.new
42
42
  desc = dpkg.get_description(R_PKG)
43
- assert_match '/\w+/', desc
43
+ assert_match /\w+/, desc
44
44
  end
45
45
 
46
46
  def test_get_status
47
47
  dpkg = Informo::Dpkg.new
48
48
  status = dpkg.get_status(R_PKG)
49
- assert_match 'ii', status
49
+ assert_equal 'install ok installed', status
50
50
  end
51
51
 
52
52
  def test_get_installdate
53
53
  dpkg = Informo::Dpkg.new
54
54
  installdate = dpkg.get_installdate(R_PKG)
55
- assert_match '/\d+/', installdate
55
+ assert_match /\d+/, installdate
56
56
  end
57
57
 
58
58
  def test_get_all
59
59
  dpkg = Informo::Dpkg.new
60
60
  pkg_details = dpkg.get_all(R_PKG)
61
61
  assert_kind_of Hash, pkg_details
62
- assert_match '/\w+/', pkg_details['name']
63
- assert_match '/^\d/', pkg_details['version']
64
- assert_match '/\w+(\d*)?/', pkg_details['achitecture']
65
- assert_match '/\w+/', pkg_details['maintainer']
66
- assert_match '/\w+/', pkg_details['description']
67
- assert_match 'ii', pkg_details['status']
68
62
  end
69
63
 
70
64
  end
@@ -26,7 +26,7 @@ class MemoryTest < Test::Unit::TestCase
26
26
 
27
27
  def test_slots
28
28
  m = Informo::Memory.new
29
- assert_match /\d+/, m.slots[0]['speed']
29
+ assert_not_nil m.slots[0]['speed']
30
30
  end
31
31
 
32
32
  end
@@ -6,7 +6,7 @@ class ProcessorTest < Test::Unit::TestCase
6
6
 
7
7
  def test_count
8
8
  p = Informo::Processor.new
9
- assert_match /\d+/, p.count
9
+ assert_kind_of Integer, p.count
10
10
  end
11
11
 
12
12
  def test_details
@@ -1,70 +1,65 @@
1
1
  require 'test/unit'
2
- require File.join(File.dirname(__FILE__),"../lib/informo/processor") if RUBY_VERSION.to_f < 1.9
3
- require 'informo/processor' if RUBY_VERSION.to_f >= 1.9
2
+ require File.join(File.dirname(__FILE__),"../lib/informo/rpm") if RUBY_VERSION.to_f < 1.9
3
+ require 'informo/rpm' if RUBY_VERSION.to_f >= 1.9
4
4
 
5
5
  class RPMTest < Test::Unit::TestCase
6
+
6
7
  ##
7
8
  ## required package for test.
8
9
  R_PKG = 'glibc'
9
10
 
10
11
  def test_get_packages
11
12
  rpm = Informo::Rpm.new
12
- packages = rpm_obj.get_packages
13
+ packages = rpm.get_packages
13
14
  assert_not_nil packages[0]
14
15
  end
15
16
 
16
17
  def test_get_version
17
18
  rpm = Informo::Rpm.new
18
19
  version = rpm.get_version(R_PKG)
19
- assert_match '/^\d/', version
20
+ assert_match /^\d/, version
20
21
  end
21
22
 
22
23
  def test_get_architecture
23
24
  rpm = Informo::Rpm.new
24
25
  arch = rpm.get_architecture(R_PKG)
25
- assert_match '/\w+(\d*)?/', arch
26
+ assert_match /\w+(\d*)?/, arch
26
27
  end
27
28
 
28
29
  def test_get_maintainer
29
30
  rpm = Informo::Rpm.new
30
31
  maintainer = rpm.get_maintainer(R_PKG)
31
- assert_match '/\w+/', maintainer
32
+ assert_match /\w+/, maintainer
32
33
  end
33
34
 
34
35
  def test_get_short_desc
35
36
  rpm = Informo::Rpm.new
36
37
  desc = rpm.get_short_description(R_PKG)
37
- assert_match '/\w+/', desc
38
+ assert_match /\w+/, desc
38
39
  end
39
40
 
40
41
  def test_get_desc
41
42
  rpm = Informo::Rpm.new
42
43
  desc = rpm.get_description(R_PKG)
43
- assert_match '/\w+/', desc
44
+ assert_match /\w+/, desc
44
45
  end
45
46
 
46
47
  def test_get_status
47
48
  rpm = Informo::Rpm.new
48
49
  status = rpm.get_status(R_PKG)
49
- assert_match 'ii', status
50
+ assert_nil status
50
51
  end
51
52
 
52
53
  def test_get_installdate
53
54
  rpm = Informo::Rpm.new
54
55
  installdate = rpm.get_installdate(R_PKG)
55
- assert_match '/\d+/', installdate
56
+ assert_not_nil installdate
56
57
  end
57
58
 
58
59
  def test_get_all
59
60
  rpm = Informo::Rpm.new
60
61
  pkg_details = rpm.get_all(R_PKG)
61
62
  assert_kind_of Hash, pkg_details
62
- assert_match '/\w+/', pkg_details['name']
63
- assert_match '/^\d/', pkg_details['version']
64
- assert_match '/\w+(\d*)?/', pkg_details['achitecture']
65
- assert_match '/\w+/', pkg_details['maintainer']
66
- assert_match '/\w+/', pkg_details['description']
67
- assert_match 'ii', pkg_details['status']
68
63
  end
69
64
 
70
65
  end
@@ -6,13 +6,14 @@ class StorageTest < Test::Unit::TestCase
6
6
 
7
7
  def test_drive_count
8
8
  s = Informo::Storage.new
9
- assert_kind_of Integer s.drive_count
9
+ assert_kind_of Integer, s.drive_count
10
10
  end
11
11
 
12
12
  def test_drive_details
13
13
  s = Informo::Storage.new
14
14
  drives = s.drives
15
- assert_match /^\d/, s.drive_details(drives[0]['size'])
15
+ size = s.drive_details(drives[0])['size']
16
+ assert_match /^\d.+/, size
16
17
  end
17
18
 
18
19
  def test_mount_details
@@ -16,7 +16,7 @@ class SystemTest < Test::Unit::TestCase
16
16
 
17
17
  def test_numa
18
18
  s = Informo::System.new
19
- assert_instance_of TrueClass s.numa?
19
+ assert_not_nil s.numa?
20
20
  end
21
21
 
22
22
  def test_kernel
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: informo
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.01'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Briganti