gesund 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c31ddd62325ecea471dc6327c57dc78511045fe
4
- data.tar.gz: 804cce6293fdac061676f97404d60c6e500c14a0
3
+ metadata.gz: 9ec1a89a0ea157b733c627882094e3cfa86a3489
4
+ data.tar.gz: 4e7379ccf36fcbfb21ba20590ea5cb2092c264b7
5
5
  SHA512:
6
- metadata.gz: 3889e58bb2ccf066b00b01edb88e2eba233a55359ae161e85004c58ccd94ecfca0192fad68d35fd970a3f4b4a44340e17bc0cbd24de96799efe10976b7a2cc27
7
- data.tar.gz: 4a22688827c4a36b0e326d39a5b477f73c5928f6c0f79baa90f9951c05c27d19a3ffcd1af42c855d52bf01a6651601c93bc8ec4bb49bd8b1cbf95fbd97c72403
6
+ metadata.gz: dd03f74f3495b5f870370880e8ba305f9e7adaa793b06e3a6d0ec8d5fd32cdcf18a2b7b4f13cc4f21fc2bbfc44586727afdd2a526006f419e2b045fb1b750bc9
7
+ data.tar.gz: fe2f508b127285b0fd0baf60efca950e03284d14256ccadc59438cbe45d39a22be0f2625e2a7aa742d0174b428bf627c5f37f3673fb6b3f2bdd9768ecc007cd2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gesund (0.0.4)
4
+ gesund (0.0.5)
5
5
  rack
6
6
  thor
7
7
 
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 = {}.merge(options)
27
- if gesundfile = opts.delete(:gesundfile)
28
- checks = Gesund::Dsl.evaluate(File.expand_path(gesundfile))
29
- end
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
 
@@ -1,3 +1,3 @@
1
1
  module Gesund
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  describe Gesund::VERSION do
2
- it { should == "0.0.4" }
2
+ it { should == "0.0.5" }
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gesund
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Zislis