gesund 0.0.5 → 0.0.6
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/Gemfile.lock +1 -1
- data/lib/gesund/cli.rb +8 -2
- data/lib/gesund/version.rb +1 -1
- data/spec/lib/gesund/cli_spec.rb +9 -1
- data/spec/lib/gesund/version_spec.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: 5e28d68c032337e62cdeef2496e97e3985989fba
|
4
|
+
data.tar.gz: 156cf02c7bab3935794b707bb7796448b8faccc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ec43f142c703802f8d70e0a8afb24e3a6443a71e0702f6f579aea783805a5e55f0b03be72a045953674b7f902228e36c41fbe763d50e6265c73e20b93fbf60b
|
7
|
+
data.tar.gz: 74b3c92d6bb955260306fe7d20ade368dd8cfa579b74536cb7a482929244e590d8e0d5cd089ddd14aa12ac66689bae6907446cc9fc5b7f674259a583bf906305
|
data/Gemfile.lock
CHANGED
data/lib/gesund/cli.rb
CHANGED
@@ -23,8 +23,14 @@ module Gesund
|
|
23
23
|
option :warn, :type => :boolean, :default => true, :desc => 'turn on warnings'
|
24
24
|
desc "http", "Starts a web server that answers to requests with results of checks from Gesundfile"
|
25
25
|
def http
|
26
|
-
opts =
|
27
|
-
|
26
|
+
opts = { # defaults
|
27
|
+
'port' => 9998,
|
28
|
+
'host' => '0.0.0.0',
|
29
|
+
'daemonize' => false,
|
30
|
+
'debug' => false,
|
31
|
+
'warn' => true
|
32
|
+
}.merge(options.to_hash)
|
33
|
+
gesundfile = File.expand_path(opts.delete('gesundfile'))
|
28
34
|
raise Errno::EACCES, "Can't read file #{gesundfile}" unless File.readable?(gesundfile)
|
29
35
|
checks = Gesund::Dsl.evaluate(gesundfile)
|
30
36
|
Gesund::Output::Rack.start(checks, opts)
|
data/lib/gesund/version.rb
CHANGED
data/spec/lib/gesund/cli_spec.rb
CHANGED
@@ -12,6 +12,14 @@ describe Gesund::CLI do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
context "#http" do
|
15
|
+
let(:default_opts) do
|
16
|
+
{ 'port' => 9998,
|
17
|
+
'host' => '0.0.0.0',
|
18
|
+
'daemonize' => false,
|
19
|
+
'debug' => false,
|
20
|
+
'warn' => true
|
21
|
+
}
|
22
|
+
end
|
15
23
|
it "should raise an error when the Gesundfile is not readable" do
|
16
24
|
expect(File).to receive(:readable?).with(gesundfile) { false }
|
17
25
|
expect { subject.http }.to raise_error(Errno::EACCES, /Can't read file #{gesundfile}/)
|
@@ -22,7 +30,7 @@ describe Gesund::CLI do
|
|
22
30
|
end
|
23
31
|
it "evaluates a supplied gesundfile" do
|
24
32
|
expect(Gesund::Dsl).to receive(:evaluate).with(gesundfile) { ['checks-http'] }
|
25
|
-
expect(Gesund::Output::Rack).to receive(:start).with(['checks-http'],
|
33
|
+
expect(Gesund::Output::Rack).to receive(:start).with(['checks-http'], default_opts)
|
26
34
|
subject.http
|
27
35
|
end
|
28
36
|
end
|