ruby_doozer 0.5.0 → 0.6.0

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: d5d47ee0a6102bf34e1c122195959b683d1675a5
4
- data.tar.gz: 6ffff10b2c3fc0081eb883bca20a8ea0eb9a8203
3
+ metadata.gz: 6d35c5108fdd5c6d848eba0575c8950f7112f67a
4
+ data.tar.gz: feab4e9400b886c736d5813ed362f14b0af171a1
5
5
  SHA512:
6
- metadata.gz: ee567d9875f26659295fbffcc7a492702168c5063889f8c7492786f916241f295c5b9b667e3be0db26d5736eb8c4fb7b912401e237db891c20e43bec33d08b76
7
- data.tar.gz: 5e4a09132f67ae2b43c5b839897eb4925b66168c606f2013687c19da464bde398e6d15e02a4a8f3319f0eee84cc1da1c6b108197930427a47534189cac0304be
6
+ metadata.gz: c13324138a81aeb313ea82361d1047309f751b0820a476c5d5e4ae5ee404856e5609e75c7eeb2db49f3cfb8fbff59644f6de357e02b984fda12544bb28c4155e
7
+ data.tar.gz: 37d8d12800d7a96ef2372a85be8f68c2df716e3f9f29c515d1b100c96bb7bc99cab677a4223c5dbdf013f17a4099f66c871b2d61a62316117d52b92a242a02ca
@@ -4,7 +4,7 @@ GEM
4
4
  activesupport (3.2.13)
5
5
  i18n (= 0.6.1)
6
6
  multi_json (~> 1.0)
7
- atomic (1.0.1)
7
+ atomic (1.0.2)
8
8
  bourne (1.4.0)
9
9
  mocha (~> 0.13.2)
10
10
  gene_pool (1.3.0)
@@ -14,17 +14,17 @@ GEM
14
14
  metaclass (~> 0.0.1)
15
15
  multi_json (1.7.2)
16
16
  rake (10.0.4)
17
- resilient_socket (0.4.0)
18
- semantic_logger
17
+ resilient_socket (0.5.0)
18
+ semantic_logger (>= 2.1)
19
19
  ruby_protobuf (0.4.11)
20
- semantic_logger (2.0.0)
21
- sync_attr
22
- thread_safe
20
+ semantic_logger (2.1.0)
21
+ sync_attr (>= 0.1.1)
22
+ thread_safe (>= 0.1.0)
23
23
  shoulda (3.4.0)
24
24
  shoulda-context (~> 1.0, >= 1.0.1)
25
25
  shoulda-matchers (~> 1.0, >= 1.4.1)
26
- shoulda-context (1.0.2)
27
- shoulda-matchers (1.5.4)
26
+ shoulda-context (1.1.0)
27
+ shoulda-matchers (1.5.6)
28
28
  activesupport (>= 3.0.0)
29
29
  bourne (~> 1.3)
30
30
  sync_attr (0.1.1)
data/README.md CHANGED
@@ -26,8 +26,8 @@ calls can be enabled as follows:
26
26
  require 'rubygems'
27
27
  require 'ruby_doozer'
28
28
 
29
- SemanticLogger::Logger.default_level = :trace
30
- SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('doozer.log')
29
+ SemanticLogger.default_level = :info
30
+ SemanticLogger.add_appender('doozer.log')
31
31
 
32
32
  client = RubyDoozer::Client.new(:server => '127.0.0.1:8046')
33
33
  client.set('/test/foo', 'value')
@@ -50,7 +50,8 @@ to the new servers:
50
50
  require 'rubygems'
51
51
  require 'ruby_doozer'
52
52
 
53
- SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('registry.log')
53
+ SemanticLogger.default_level = :info
54
+ SemanticLogger.add_appender('registry.log')
54
55
 
55
56
  region = "Development"
56
57
  application = "sprites"
@@ -94,7 +95,8 @@ As a result Registry#on_update callbacks will only be called for existing data
94
95
  require 'rubygems'
95
96
  require 'ruby_doozer'
96
97
 
97
- SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('registry.log')
98
+ SemanticLogger.default_level = :info
99
+ SemanticLogger.add_appender('registry.log')
98
100
 
99
101
  region = "Development"
100
102
  application = "sprites"
data/Rakefile CHANGED
@@ -23,10 +23,11 @@ task :gem do |t|
23
23
  spec.files = FileList["./**/*"].exclude(/\.gem$/, /\.log$/,/nbproject/).map{|f| f.sub(/^\.\//, '')}
24
24
  spec.license = "Apache License V2.0"
25
25
  spec.has_rdoc = true
26
- spec.add_dependency 'semantic_logger'
27
- spec.add_dependency 'resilient_socket'
28
- spec.add_dependency 'ruby_protobuf'
29
- spec.add_dependency 'gene_pool'
26
+ spec.add_dependency 'semantic_logger', '>= 2.1'
27
+ spec.add_dependency 'resilient_socket', '>= 0.5.0'
28
+ spec.add_dependency 'ruby_protobuf', '>= 0.4.11'
29
+ spec.add_dependency 'gene_pool', '>= 1.3.0'
30
+ spec.add_dependency 'sync_attr', '>= 1.0.0'
30
31
  end
31
32
  Gem::Package.build gemspec
32
33
  end
@@ -5,7 +5,6 @@ require 'ruby_doozer/msg.pb'
5
5
 
6
6
  module RubyDoozer
7
7
  class Client
8
-
9
8
  include SemanticLogger::Loggable
10
9
 
11
10
  # Create a resilient client connection to a Doozer server
@@ -76,8 +75,10 @@ module RubyDoozer
76
75
  end
77
76
 
78
77
  # Returns just the value at the supplied path, not the revision
78
+ # Returns nil when the key was not found
79
79
  def [](path)
80
- get(path).value
80
+ result = get(path)
81
+ result.rev > 0 ? result.value : nil
81
82
  end
82
83
 
83
84
  # Deletes the file at path if rev is greater than or equal to the file's revision.
@@ -21,7 +21,7 @@ module RubyDoozer
21
21
  # Logging instance for this class
22
22
  include SemanticLogger::Loggable
23
23
 
24
- attr_reader :doozer_config, :doozer_pool, :current_revision
24
+ attr_reader :doozer_config, :doozer_pool, :current_revision, :root_path
25
25
 
26
26
  # Create a Registry instance to manage a path of information within doozer
27
27
  #
@@ -203,13 +203,9 @@ module RubyDoozer
203
203
  # value
204
204
  # New value from doozer
205
205
  #
206
- # old_value
207
- # nil if :cache is false
208
- # otherwise the last value for this path in the local copy of the registry
209
- #
210
206
  # Example:
211
207
  # registry.on_update do |path, value, old_value|
212
- # puts "#{path} was updated to #{value} with previous value #{old_value}"
208
+ # puts "#{path} was updated to #{value}"
213
209
  # end
214
210
  def on_update(path='*', &block)
215
211
  # Start monitoring thread if not already started
@@ -230,13 +226,9 @@ module RubyDoozer
230
226
  # Supplying a path of '*' means all paths
231
227
  # Default: '*'
232
228
  #
233
- # old_value
234
- # nil if :cache is false
235
- # otherwise the last value for this path in the local copy of the registry
236
- #
237
229
  # Example:
238
- # registry.on_delete do |path, old_value|
239
- # puts "#{path} was deleted with previous value #{old_value}"
230
+ # registry.on_delete do |path|
231
+ # puts "#{path} was deleted"
240
232
  # end
241
233
  def on_delete(path='*', &block)
242
234
  # Start monitoring thread if not already started
@@ -1,3 +1,3 @@
1
1
  module RubyDoozer #:nodoc
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -10,10 +10,8 @@ require 'ruby_doozer'
10
10
  # This test assumes that doozerd is running locally on the default port of 8046
11
11
 
12
12
  # Register an appender if one is not already registered
13
- if SemanticLogger::Logger.appenders.size == 0
14
- SemanticLogger::Logger.default_level = :trace
15
- SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('test.log')
16
- end
13
+ SemanticLogger.default_level = :trace
14
+ SemanticLogger.add_appender('test.log') if SemanticLogger.appenders.size == 0
17
15
 
18
16
  # Unit Test for RubyDoozer::Client
19
17
  class CachedRegistryTest < Test::Unit::TestCase
@@ -10,10 +10,8 @@ require 'ruby_doozer/client'
10
10
  # This test assumes that doozerd is running locally on the default port of 8046
11
11
 
12
12
  # Register an appender if one is not already registered
13
- if SemanticLogger::Logger.appenders.size == 0
14
- SemanticLogger::Logger.default_level = :trace
15
- SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('test.log')
16
- end
13
+ SemanticLogger.default_level = :trace
14
+ SemanticLogger.add_appender('test.log') if SemanticLogger.appenders.size == 0
17
15
 
18
16
  # Unit Test for RubyDoozer::Client
19
17
  class ClientTest < Test::Unit::TestCase
@@ -51,6 +49,10 @@ class ClientTest < Test::Unit::TestCase
51
49
  assert @client.current_revision >= 0
52
50
  end
53
51
 
52
+ should "return nil when a key is not found" do
53
+ assert_equal nil, @client['/test/some_bad_key']
54
+ end
55
+
54
56
  context "successfully set and get data" do
55
57
  PATHS.each do |path|
56
58
  should "in #{path}" do
@@ -10,10 +10,8 @@ require 'ruby_doozer'
10
10
  # This test assumes that doozerd is running locally on the default port of 8046
11
11
 
12
12
  # Register an appender if one is not already registered
13
- if SemanticLogger::Logger.appenders.size == 0
14
- SemanticLogger::Logger.default_level = :trace
15
- SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('test.log')
16
- end
13
+ SemanticLogger.default_level = :trace
14
+ SemanticLogger.add_appender('test.log') if SemanticLogger.appenders.size == 0
17
15
 
18
16
  # Unit Test for RubyDoozer::Client
19
17
  class RegistryTest < Test::Unit::TestCase
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_doozer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-01 00:00:00.000000000 Z
11
+ date: 2013-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic_logger
@@ -16,56 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: resilient_socket
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby_protobuf
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.4.11
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.4.11
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: gene_pool
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 1.3.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 1.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: sync_attr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.0
69
83
  description: Ruby Client for doozer
70
84
  email:
71
85
  - reidmo@gmail.com