riak-client 0.9.0 → 0.9.1

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.
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'rack', '>=1.0'
8
8
  gem 'rake'
9
9
  gem 'bundler'
10
10
  gem 'excon', "~>0.5.7"
11
- gem 'beefcake', '~>0.2.0'
11
+ gem 'beefcake', '~>0.3.1'
12
12
 
13
13
  platforms :mri do
14
14
  gem 'curb', '>=0.6'
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ gemspec = Gem::Specification.new do |gem|
16
16
  gem.add_development_dependency "excon", "~>0.5.7"
17
17
  gem.add_dependency "i18n", ">=0.4.0"
18
18
  gem.add_dependency "builder", "~>2.1.2"
19
- gem.add_dependency "beefcake", "~>0.2.0"
19
+ gem.add_dependency "beefcake", "~>0.3.0"
20
20
 
21
21
  files = FileList["**/*"]
22
22
  # Editor and O/S files
@@ -17,19 +17,21 @@ module Riak
17
17
  class Client
18
18
  class BeefcakeProtobuffsBackend
19
19
  module ObjectMethods
20
+ ENCODING = "Riak".respond_to?(:encoding)
21
+
20
22
  # Returns RpbPutReq
21
23
  def dump_object(robject)
22
- pbuf = RpbPutReq.new(:bucket => robject.bucket.name)
23
- pbuf.key = robject.key || generate_key
24
- pbuf.vclock = Base64.decode64(robject.vclock) if robject.vclock
25
- pbuf.content = RpbContent.new(:value => robject.raw_data,
26
- :content_type => robject.content_type,
24
+ pbuf = RpbPutReq.new(:bucket => maybe_encode(robject.bucket.name))
25
+ pbuf.key = maybe_encode(robject.key ||= generate_key)
26
+ pbuf.vclock = maybe_encode Base64.decode64(robject.vclock) if robject.vclock
27
+ pbuf.content = RpbContent.new(:value => maybe_encode(robject.raw_data),
28
+ :content_type => maybe_encode(robject.content_type),
27
29
  :links => robject.links.map {|l| encode_link(l) }.compact)
28
30
 
29
31
  pbuf.content.usermeta = robject.meta.map {|k,v| encode_meta(k,v)} if robject.meta.any?
30
- pbuf.content.vtag = robject.etag if robject.etag.present?
31
- if robject.raw_data.respond_to?(:encoding) # 1.9 support
32
- pbuf.content.charset = robject.raw_data.encoding.name
32
+ pbuf.content.vtag = maybe_encode(robject.etag) if robject.etag.present?
33
+ if ENCODING # 1.9 support
34
+ pbuf.content.charset = maybe_encode(robject.raw_data.encoding.name)
33
35
  end
34
36
  pbuf
35
37
  end
@@ -52,7 +54,7 @@ module Riak
52
54
 
53
55
  private
54
56
  def load_content(pbuf, robject)
55
- if pbuf.value.respond_to?(:force_encoding) && pbuf.charset.present?
57
+ if ENCODING && pbuf.charset.present?
56
58
  pbuf.value.force_encoding(pbuf.charset) if Encoding.find(pbuf.charset)
57
59
  end
58
60
  robject.raw_data = pbuf.value
@@ -73,7 +75,9 @@ module Riak
73
75
 
74
76
  def encode_link(link)
75
77
  return nil unless link.key.present?
76
- RpbLink.new(:bucket => link.bucket.to_s, :key => link.key.to_s, :tag => link.tag.to_s)
78
+ RpbLink.new(:bucket => maybe_encode(link.bucket.to_s),
79
+ :key => maybe_encode(link.key.to_s),
80
+ :tag => maybe_encode(link.tag.to_s))
77
81
  end
78
82
 
79
83
  def decode_meta(pbuf, hash)
@@ -82,7 +86,12 @@ module Riak
82
86
 
83
87
  def encode_meta(key,value)
84
88
  return nil unless value.present?
85
- RpbPair.new(:key.to_s, :value => value.to_s)
89
+ RpbPair.new(:key => maybe_encode(key.to_s),
90
+ :value => maybe_encode(value.to_s))
91
+ end
92
+
93
+ def maybe_encode(string)
94
+ ENCODING ? string.encode('BINARY') : string
86
95
  end
87
96
  end
88
97
 
data/riak-client.gemspec CHANGED
@@ -6,13 +6,13 @@ Gem::Specification.new do |s|
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sean Cribbs"]
9
- s.date = %q{2011-04-03}
9
+ s.date = %q{2011-04-07}
10
10
  s.description = %q{riak-client is a rich client for Riak, the distributed database by Basho. It supports the full HTTP interface including storage operations, bucket configuration, link-walking and map-reduce.}
11
11
  s.email = %q{sean@basho.com}
12
12
  s.files = ["erl_src/riak_kv_test_backend.beam", "erl_src/riak_kv_test_backend.erl", "Gemfile", "lib/active_support/cache/riak_store.rb", "lib/riak/bucket.rb", "lib/riak/cache_store.rb", "lib/riak/client/beefcake/messages.rb", "lib/riak/client/beefcake/object_methods.rb", "lib/riak/client/beefcake_protobuffs_backend.rb", "lib/riak/client/curb_backend.rb", "lib/riak/client/excon_backend.rb", "lib/riak/client/http_backend/configuration.rb", "lib/riak/client/http_backend/object_methods.rb", "lib/riak/client/http_backend/request_headers.rb", "lib/riak/client/http_backend/transport_methods.rb", "lib/riak/client/http_backend.rb", "lib/riak/client/net_http_backend.rb", "lib/riak/client/protobuffs_backend.rb", "lib/riak/client/pump.rb", "lib/riak/client.rb", "lib/riak/core_ext/blank.rb", "lib/riak/core_ext/extract_options.rb", "lib/riak/core_ext/slice.rb", "lib/riak/core_ext/stringify_keys.rb", "lib/riak/core_ext/symbolize_keys.rb", "lib/riak/core_ext/to_param.rb", "lib/riak/core_ext.rb", "lib/riak/failed_request.rb", "lib/riak/i18n.rb", "lib/riak/invalid_response.rb", "lib/riak/link.rb", "lib/riak/locale/en.yml", "lib/riak/map_reduce/filter_builder.rb", "lib/riak/map_reduce/phase.rb", "lib/riak/map_reduce.rb", "lib/riak/map_reduce_error.rb", "lib/riak/robject.rb", "lib/riak/search.rb", "lib/riak/test_server.rb", "lib/riak/util/escape.rb", "lib/riak/util/fiber1.8.rb", "lib/riak/util/headers.rb", "lib/riak/util/multipart/stream_parser.rb", "lib/riak/util/multipart.rb", "lib/riak/util/tcp_socket_extensions.rb", "lib/riak/util/translation.rb", "lib/riak/walk_spec.rb", "lib/riak.rb", "Rakefile", "riak-client.gemspec", "spec/fixtures/cat.jpg", "spec/fixtures/multipart-blank.txt", "spec/fixtures/multipart-mapreduce.txt", "spec/fixtures/multipart-with-body.txt", "spec/fixtures/server.cert.crt", "spec/fixtures/server.cert.key", "spec/fixtures/test.pem", "spec/integration/riak/cache_store_spec.rb", "spec/integration/riak/http_backends_spec.rb", "spec/integration/riak/protobuffs_backends_spec.rb", "spec/integration/riak/test_server_spec.rb", "spec/riak/bucket_spec.rb", "spec/riak/client_spec.rb", "spec/riak/curb_backend_spec.rb", "spec/riak/escape_spec.rb", "spec/riak/excon_backend_spec.rb", "spec/riak/headers_spec.rb", "spec/riak/http_backend/configuration_spec.rb", "spec/riak/http_backend/object_methods_spec.rb", "spec/riak/http_backend/transport_methods_spec.rb", "spec/riak/http_backend_spec.rb", "spec/riak/link_spec.rb", "spec/riak/map_reduce/filter_builder_spec.rb", "spec/riak/map_reduce/phase_spec.rb", "spec/riak/map_reduce_spec.rb", "spec/riak/multipart_spec.rb", "spec/riak/net_http_backend_spec.rb", "spec/riak/robject_spec.rb", "spec/riak/search_spec.rb", "spec/riak/stream_parser_spec.rb", "spec/riak/walk_spec_spec.rb", "spec/spec_helper.rb", "spec/support/drb_mock_server.rb", "spec/support/http_backend_implementation_examples.rb", "spec/support/mock_server.rb", "spec/support/mocks.rb", "spec/support/test_server.yml.example", "spec/support/unified_backend_examples.rb"]
13
13
  s.homepage = %q{http://seancribbs.github.com/ripple}
14
14
  s.require_paths = ["lib"]
15
- s.rubygems_version = %q{1.6.1}
15
+ s.rubygems_version = %q{1.7.2}
16
16
  s.summary = %q{riak-client is a rich client for Riak, the distributed database by Basho.}
17
17
  s.test_files = ["lib/riak/walk_spec.rb", "spec/integration/riak/cache_store_spec.rb", "spec/integration/riak/http_backends_spec.rb", "spec/integration/riak/protobuffs_backends_spec.rb", "spec/integration/riak/test_server_spec.rb", "spec/riak/bucket_spec.rb", "spec/riak/client_spec.rb", "spec/riak/curb_backend_spec.rb", "spec/riak/escape_spec.rb", "spec/riak/excon_backend_spec.rb", "spec/riak/headers_spec.rb", "spec/riak/http_backend/configuration_spec.rb", "spec/riak/http_backend/object_methods_spec.rb", "spec/riak/http_backend/transport_methods_spec.rb", "spec/riak/http_backend_spec.rb", "spec/riak/link_spec.rb", "spec/riak/map_reduce/filter_builder_spec.rb", "spec/riak/map_reduce/phase_spec.rb", "spec/riak/map_reduce_spec.rb", "spec/riak/multipart_spec.rb", "spec/riak/net_http_backend_spec.rb", "spec/riak/robject_spec.rb", "spec/riak/search_spec.rb", "spec/riak/stream_parser_spec.rb", "spec/riak/walk_spec_spec.rb"]
18
18
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency(%q<excon>, ["~> 0.5.7"])
28
28
  s.add_runtime_dependency(%q<i18n>, [">= 0.4.0"])
29
29
  s.add_runtime_dependency(%q<builder>, ["~> 2.1.2"])
30
- s.add_runtime_dependency(%q<beefcake>, ["~> 0.2.0"])
30
+ s.add_runtime_dependency(%q<beefcake>, ["~> 0.3.0"])
31
31
  else
32
32
  s.add_dependency(%q<rspec>, ["~> 2.4.0"])
33
33
  s.add_dependency(%q<fakeweb>, [">= 1.2"])
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.add_dependency(%q<excon>, ["~> 0.5.7"])
37
37
  s.add_dependency(%q<i18n>, [">= 0.4.0"])
38
38
  s.add_dependency(%q<builder>, ["~> 2.1.2"])
39
- s.add_dependency(%q<beefcake>, ["~> 0.2.0"])
39
+ s.add_dependency(%q<beefcake>, ["~> 0.3.0"])
40
40
  end
41
41
  else
42
42
  s.add_dependency(%q<rspec>, ["~> 2.4.0"])
@@ -46,6 +46,6 @@ Gem::Specification.new do |s|
46
46
  s.add_dependency(%q<excon>, ["~> 0.5.7"])
47
47
  s.add_dependency(%q<i18n>, [">= 0.4.0"])
48
48
  s.add_dependency(%q<builder>, ["~> 2.1.2"])
49
- s.add_dependency(%q<beefcake>, ["~> 0.2.0"])
49
+ s.add_dependency(%q<beefcake>, ["~> 0.3.0"])
50
50
  end
51
51
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: riak-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.0
5
+ version: 0.9.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sean Cribbs
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-03 00:00:00 -04:00
14
- default_executable:
13
+ date: 2011-04-08 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rspec
@@ -98,7 +97,7 @@ dependencies:
98
97
  requirements:
99
98
  - - ~>
100
99
  - !ruby/object:Gem::Version
101
- version: 0.2.0
100
+ version: 0.3.0
102
101
  type: :runtime
103
102
  version_requirements: *id008
104
103
  description: riak-client is a rich client for Riak, the distributed database by Basho. It supports the full HTTP interface including storage operations, bucket configuration, link-walking and map-reduce.
@@ -198,7 +197,6 @@ files:
198
197
  - spec/support/mocks.rb
199
198
  - spec/support/test_server.yml.example
200
199
  - spec/support/unified_backend_examples.rb
201
- has_rdoc: true
202
200
  homepage: http://seancribbs.github.com/ripple
203
201
  licenses: []
204
202
 
@@ -222,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
220
  requirements: []
223
221
 
224
222
  rubyforge_project:
225
- rubygems_version: 1.6.1
223
+ rubygems_version: 1.7.2
226
224
  signing_key:
227
225
  specification_version: 3
228
226
  summary: riak-client is a rich client for Riak, the distributed database by Basho.