cistern 0.5.6 → 0.5.7

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: 83399a872cc26926353a8186ca5a2eeb5e35694f
4
- data.tar.gz: a63f6fc98003b05aa829e18d976718a3698ba2e7
3
+ metadata.gz: 9db40e93bb01c7cf0fd8c04ae34fc87d1c90ec7a
4
+ data.tar.gz: bc3dce9fd3632ee078fe99e716ab8af79a26a7ff
5
5
  SHA512:
6
- metadata.gz: 2a456bdd5e6b9578d3c56abe014e1dad0d8b1bb3371808198cb683797a95860997f17aabbea453a635462a25f71d0576181b02cb108d7bfd72521f717ea427dc
7
- data.tar.gz: 094d70ac588adbf30f9430845e44ba80209149a96301822302d2f2bc044eb8e02cb2c569b8bd2c275b59adb01c1849331e228b2d664a55290992489b0236f6a5
6
+ metadata.gz: ae821dfb3d91a24edb3e268c7647df00a24e6aa5628592ed311ab97fa3ea90808cc777de0cb98adabcf3dd86bc6e13e8fd2a4e107db55d68868cfae198455cc8
7
+ data.tar.gz: 90a80c9f6ed3a56fe979b9304ec3a82843d0b1984d0bff9bfc6ed9a3b4f1c708a01c78ef2b2f00f02f2f3f46e6e3c061b1c4e8a3615ca614da343a0fda5f44e3
@@ -32,9 +32,22 @@ class Cistern::Service
32
32
  def self.service
33
33
  #{klass.name}
34
34
  end
35
+
36
+ class Real
37
+ end
38
+
39
+ class Mock
40
+ end
35
41
  EOS
36
42
 
37
43
  klass.send(:const_set, :Timeout, Class.new(Cistern::Error))
44
+
45
+ klass::Mock.send(:include, klass::Collections)
46
+ klass::Mock.send(:extend, Cistern::WaitFor)
47
+ klass::Mock.timeout_error = klass::Timeout
48
+ klass::Real.send(:include, klass::Collections)
49
+ klass::Real.send(:extend, Cistern::WaitFor)
50
+ klass::Real.timeout_error = klass::Timeout
38
51
  end
39
52
 
40
53
  def collection_path(collection_path)
@@ -154,12 +167,7 @@ class Cistern::Service
154
167
  validate_options(options)
155
168
  setup_requirements
156
169
 
157
- klass = self.const_get(self.mocking? ? :Mock : :Real)
158
-
159
- klass.send(:include, service::Collections)
160
- klass.send(:extend, Cistern::WaitFor)
161
- klass.timeout_error = service::Timeout
162
- klass.new(options)
170
+ self.const_get(self.mocking? ? :Mock : :Real).new(options)
163
171
  end
164
172
 
165
173
  def reset!
@@ -1,3 +1,3 @@
1
1
  module Cistern
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -2,15 +2,29 @@ require 'timeout'
2
2
 
3
3
  module Cistern
4
4
  module WaitFor
5
- DEFAULT_TIMEOUT = 180 # 3 minutes
6
- DEFAULT_POLL_INTERVAL = 10 # 10 seconds
7
-
8
- def timeout; @timeout || DEFAULT_TIMEOUT; end
9
- def timeout=(timeout); @timeout = timeout; end
10
- def poll_interval; @poll_interval || DEFAULT_POLL_INTERVAL; end
11
- def poll_interval=(poll_interval); @poll_interval = poll_interval; end
12
- def timeout_error=(timeout_error); @timeout_error = timeout_error; end
13
- def timeout_error; @timeout_error || self.const_defined?(:Timeout) && self.const_get(:Timeout) || ::Timeout::Error; end
5
+ def timeout
6
+ @timeout || Cistern.timeout
7
+ end
8
+
9
+ def timeout=(timeout)
10
+ @timeout = timeout
11
+ end
12
+
13
+ def poll_interval
14
+ @poll_interval || Cistern.poll_interval
15
+ end
16
+
17
+ def poll_interval=(poll_interval)
18
+ @poll_interval = poll_interval
19
+ end
20
+
21
+ def timeout_error=(timeout_error)
22
+ @timeout_error = timeout_error
23
+ end
24
+
25
+ def timeout_error
26
+ @timeout_error || self.const_defined?(:Timeout) && self.const_get(:Timeout) || ::Timeout::Error
27
+ end
14
28
 
15
29
  def wait_for(timeout = self.timeout, interval = self.poll_interval, &block)
16
30
  duration = 0
data/lib/cistern.rb CHANGED
@@ -26,3 +26,6 @@ module Cistern
26
26
  @formatter ||= Cistern::Formatter.default
27
27
  end
28
28
  end
29
+
30
+ Cistern.timeout = 180 # 3 minutes
31
+ Cistern.poll_interval = 15 # 15 seconds
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cistern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: API client framework extracted from Fog
14
14
  email: