gesund 0.0.4 → 0.0.5
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 +4 -4
- data/lib/gesund/version.rb +1 -1
- data/spec/lib/gesund/cli_spec.rb +25 -0
- 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: 9ec1a89a0ea157b733c627882094e3cfa86a3489
|
4
|
+
data.tar.gz: 4e7379ccf36fcbfb21ba20590ea5cb2092c264b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd03f74f3495b5f870370880e8ba305f9e7adaa793b06e3a6d0ec8d5fd32cdcf18a2b7b4f13cc4f21fc2bbfc44586727afdd2a526006f419e2b045fb1b750bc9
|
7
|
+
data.tar.gz: fe2f508b127285b0fd0baf60efca950e03284d14256ccadc59438cbe45d39a22be0f2625e2a7aa742d0174b428bf627c5f37f3673fb6b3f2bdd9768ecc007cd2
|
data/Gemfile.lock
CHANGED
data/lib/gesund/cli.rb
CHANGED
@@ -23,10 +23,10 @@ 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
|
-
|
28
|
-
|
29
|
-
|
26
|
+
opts = options.dup
|
27
|
+
gesundfile = File.expand_path(opts.delete(:gesundfile))
|
28
|
+
raise Errno::EACCES, "Can't read file #{gesundfile}" unless File.readable?(gesundfile)
|
29
|
+
checks = Gesund::Dsl.evaluate(gesundfile)
|
30
30
|
Gesund::Output::Rack.start(checks, opts)
|
31
31
|
end
|
32
32
|
|
data/lib/gesund/version.rb
CHANGED
data/spec/lib/gesund/cli_spec.rb
CHANGED
@@ -2,4 +2,29 @@ require "spec_helper"
|
|
2
2
|
require "gesund/cli" # not usually required when requiring gesund
|
3
3
|
|
4
4
|
describe Gesund::CLI do
|
5
|
+
let(:gesundfile) { File.expand_path('Gesundfile') }
|
6
|
+
|
7
|
+
describe "#check" do
|
8
|
+
it "evaluates the supplied gesundfile" do
|
9
|
+
expect(Gesund::Dsl).to receive(:evaluate).with(gesundfile) { ['checks-text'] }
|
10
|
+
expect(Gesund::Output::Text).to receive(:new).with(['checks-text'])
|
11
|
+
subject.check
|
12
|
+
end
|
13
|
+
end
|
14
|
+
context "#http" do
|
15
|
+
it "should raise an error when the Gesundfile is not readable" do
|
16
|
+
expect(File).to receive(:readable?).with(gesundfile) { false }
|
17
|
+
expect { subject.http }.to raise_error(Errno::EACCES, /Can't read file #{gesundfile}/)
|
18
|
+
end
|
19
|
+
describe "gesund file is readable" do
|
20
|
+
before do
|
21
|
+
expect(File).to receive(:readable?).with(gesundfile) { true }
|
22
|
+
end
|
23
|
+
it "evaluates a supplied gesundfile" do
|
24
|
+
expect(Gesund::Dsl).to receive(:evaluate).with(gesundfile) { ['checks-http'] }
|
25
|
+
expect(Gesund::Output::Rack).to receive(:start).with(['checks-http'], {})
|
26
|
+
subject.http
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
5
30
|
end
|