checkson 0.1 → 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 +4 -4
- data/lib/checkson.rb +1 -2
- data/lib/checkson/check.rb +4 -0
- data/lib/checkson/checks/base.rb +1 -1
- data/lib/checkson/config.rb +2 -1
- data/lib/checkson/context.rb +6 -0
- data/lib/checkson/ui.rb +24 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2222386bd03c3421453df6fc47a6d91343a68a4e10f2eb33a5ca3108c9f39147
|
4
|
+
data.tar.gz: d234523870e13a2bdd163b101a0f82e270205e80929c013adda59d4d9a51b388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1255ff0bc3a4e7393c82a0a404b17090397fe5956a7e389d0069d66790bfe262418baf197871f667e69e47843d10fc3c1fae0b514d49a7f91547b8688ce074b5
|
7
|
+
data.tar.gz: b52e63e8fc994b9d5310c12c315830ec58e0bf2537d8fbd0d3f45a2881ce41a35f9284e1e7b46baeb25257cf6fb581c13d59f991ac12c914c88f67cc4193c15e
|
data/lib/checkson.rb
CHANGED
data/lib/checkson/checks/base.rb
CHANGED
data/lib/checkson/config.rb
CHANGED
data/lib/checkson/context.rb
CHANGED
@@ -6,6 +6,7 @@ module Checkson
|
|
6
6
|
def initialize(&block)
|
7
7
|
@kass = nil
|
8
8
|
@params = {}
|
9
|
+
@help = []
|
9
10
|
instance_eval(&block)
|
10
11
|
end
|
11
12
|
|
@@ -16,5 +17,10 @@ module Checkson
|
|
16
17
|
def set(key, value)
|
17
18
|
@params[key.to_sym] = value
|
18
19
|
end
|
20
|
+
|
21
|
+
def help(message = nil)
|
22
|
+
@help << message if message
|
23
|
+
@help
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
data/lib/checkson/ui.rb
CHANGED
@@ -8,17 +8,22 @@ module Checkson
|
|
8
8
|
def initialize
|
9
9
|
set_default_options
|
10
10
|
parse_options
|
11
|
-
|
11
|
+
start_checks
|
12
12
|
end
|
13
13
|
|
14
14
|
protected
|
15
15
|
|
16
|
-
def
|
16
|
+
def winsize
|
17
|
+
require 'io/console'
|
18
|
+
IO.console.winsize
|
19
|
+
end
|
20
|
+
|
21
|
+
def start_checks
|
17
22
|
@config = Checkson::Config.new(@opts[:config])
|
18
23
|
@config.checks.each do |check|
|
19
24
|
c = check.klass.new(check.params)
|
20
25
|
c.check
|
21
|
-
|
26
|
+
output c, check
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
@@ -41,6 +46,22 @@ module Checkson
|
|
41
46
|
end.parse!
|
42
47
|
end
|
43
48
|
|
49
|
+
def output(sym, check)
|
50
|
+
status_column = winsize[1] / 3 * 2
|
51
|
+
print check.description
|
52
|
+
case sym.status
|
53
|
+
when :ok
|
54
|
+
puts "\033[#{status_column}G\033[1;32mOK\033[0m"
|
55
|
+
when :failed
|
56
|
+
puts "\033[#{status_column}G\033[1;31mFAILED\033[0m"
|
57
|
+
unless check.help.empty?
|
58
|
+
check.help.each do |message|
|
59
|
+
puts "--> #{message}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
44
65
|
def die(msg)
|
45
66
|
warn(msg)
|
46
67
|
exit 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple framework for checking node facts
|
14
14
|
email: florian@fsrv.xyz
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- README.md
|
21
21
|
- bin/checkson
|
22
22
|
- lib/checkson.rb
|
23
|
+
- lib/checkson/check.rb
|
23
24
|
- lib/checkson/checks/base.rb
|
24
25
|
- lib/checkson/checks/shell.rb
|
25
26
|
- lib/checkson/config.rb
|