litmus_paper 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,9 +8,15 @@ module LitmusPaper
8
8
 
9
9
  def available?
10
10
  Timeout.timeout(@timeout) do
11
- system @command
11
+ output = %x[#{@command}]
12
+ unless $CHILD_STATUS.success?
13
+ LitmusPaper.logger.info("Available check to #{@command} failed with status #{$CHILD_STATUS.exitstatus}")
14
+ LitmusPaper.logger.info("Failed output #{output}")
15
+ end
16
+ $CHILD_STATUS.success?
12
17
  end
13
18
  rescue Timeout::Error
19
+ LitmusPaper.logger.info("Available check to '#{@command}' timed out")
14
20
  false
15
21
  end
16
22
 
@@ -1,3 +1,3 @@
1
1
  module LitmusPaper
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
data/lib/litmus_paper.rb CHANGED
@@ -3,6 +3,7 @@ require 'net/http'
3
3
  require 'net/https'
4
4
  require 'uri'
5
5
  require 'forwardable'
6
+ require 'English'
6
7
 
7
8
  # Ruby’s stock DNS resolution, by default, blocks the entire Ruby VM from
8
9
  # processing while the lookup is happening, because it calls out to the native
@@ -16,6 +16,14 @@ describe LitmusPaper::Dependency::Script do
16
16
  check = LitmusPaper::Dependency::Script.new("sleep 10", :timeout => 1)
17
17
  check.should_not be_available
18
18
  end
19
+
20
+ it "can handle pipes" do
21
+ check = LitmusPaper::Dependency::Script.new("ls | grep lib")
22
+ check.should be_available
23
+
24
+ check = LitmusPaper::Dependency::Script.new("ls | grep missing")
25
+ check.should_not be_available
26
+ end
19
27
  end
20
28
 
21
29
  describe "to_s" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litmus_paper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 0
10
- version: 0.7.0
9
+ - 1
10
+ version: 0.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Braintreeps
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-19 00:00:00 -06:00
18
+ date: 2012-11-20 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency