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 +4 -4
- data/README.md +6 -3
- data/lib/informo/dpkg.rb +1 -3
- data/lib/informo/version.rb +1 -1
- data/test/test_dpkg.rb +8 -14
- data/test/test_memory.rb +1 -1
- data/test/test_processor.rb +1 -1
- data/test/test_rpm.rb +11 -16
- data/test/test_storage.rb +3 -2
- data/test/test_system.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37ab54aa64d49dcb158ca64729c160eaac47b25e
|
4
|
+
data.tar.gz: 615cafc714ee0b9bed1a4676302e81036bb9dc68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
```
|
data/lib/informo/dpkg.rb
CHANGED
@@ -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 =
|
57
|
+
create_time = File.stat(@@pkginfo + "/#{name}.list").ctime.utc
|
60
58
|
return create_time
|
61
59
|
end
|
62
60
|
##
|
data/lib/informo/version.rb
CHANGED
data/test/test_dpkg.rb
CHANGED
@@ -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 = '
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
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
|
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
|
data/test/test_memory.rb
CHANGED
data/test/test_processor.rb
CHANGED
data/test/test_rpm.rb
CHANGED
@@ -1,70 +1,65 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require File.join(File.dirname(__FILE__),"../lib/informo/
|
3
|
-
require 'informo/
|
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 =
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
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
|
-
|
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
|
data/test/test_storage.rb
CHANGED
@@ -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
|
-
|
15
|
+
size = s.drive_details(drives[0])['size']
|
16
|
+
assert_match /^\d.+/, size
|
16
17
|
end
|
17
18
|
|
18
19
|
def test_mount_details
|
data/test/test_system.rb
CHANGED