riakpb 0.1.6 → 0.2.0

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.
@@ -1,15 +1,15 @@
1
1
  require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
- describe Riak::MapReduce do
3
+ describe Riakpb::MapReduce do
4
4
  before :each do
5
- @client = Riak::Client.new
5
+ @client = Riakpb::Client.new
6
6
  @client.rpc.stub!(:request).and_return(nil)
7
- @mr = Riak::MapReduce.new(@client)
7
+ @mr = Riakpb::MapReduce.new(@client)
8
8
  end
9
9
 
10
10
  it "should require a client" do
11
- lambda { Riak::MapReduce.new }.should raise_error
12
- lambda { Riak::MapReduce.new(@client) }.should_not raise_error
11
+ lambda { Riakpb::MapReduce.new }.should raise_error
12
+ lambda { Riakpb::MapReduce.new(@client) }.should_not raise_error
13
13
  end
14
14
 
15
15
  it "should initialize the inputs and query to empty arrays" do
@@ -19,7 +19,7 @@ describe Riak::MapReduce do
19
19
 
20
20
  it "should yield itself when given a block on initializing" do
21
21
  @mr2 = nil
22
- @mr = Riak::MapReduce.new(@client) do |mr|
22
+ @mr = Riakpb::MapReduce.new(@client) do |mr|
23
23
  @mr2 = mr
24
24
  end
25
25
  @mr2.should == @mr
@@ -41,8 +41,8 @@ describe Riak::MapReduce do
41
41
  end
42
42
 
43
43
  it "should add an object to the inputs by its bucket and key" do
44
- bucket = Riak::Bucket.new(@client, "foo")
45
- key = Riak::Key.new(bucket, "bar")
44
+ bucket = Riakpb::Bucket.new(@client, "foo")
45
+ key = Riakpb::Key.new(bucket, "bar")
46
46
  @mr.add(key)
47
47
  @mr.inputs.should == [["foo", "bar"]]
48
48
  end
@@ -53,7 +53,7 @@ describe Riak::MapReduce do
53
53
  end
54
54
 
55
55
  it "should use a bucket name as the single input" do
56
- @mr.add(Riak::Bucket.new(@client, "foo"))
56
+ @mr.add(Riakpb::Bucket.new(@client, "foo"))
57
57
  @mr.inputs.should == "foo"
58
58
  @mr.add("docs")
59
59
  @mr.inputs.should == "docs"
@@ -114,7 +114,7 @@ describe Riak::MapReduce do
114
114
  @mr.query.should have(1).items
115
115
  phase = @mr.query.first
116
116
  phase.type.should == :link
117
- # phase.function.should be_kind_of(Riak::WalkSpec)
117
+ # phase.function.should be_kind_of(Riakpb::WalkSpec)
118
118
  phase.function[:tag].should == "next"
119
119
  end
120
120
 
@@ -123,7 +123,7 @@ describe Riak::MapReduce do
123
123
  @mr.query.should have(1).items
124
124
  phase = @mr.query.first
125
125
  phase.type.should == :link
126
- # phase.function.should be_kind_of(Riak::WalkSpec)
126
+ # phase.function.should be_kind_of(Riakpb::WalkSpec)
127
127
  phase.function[:bucket].should == "foo"
128
128
  phase.keep.should be_true
129
129
  end
@@ -135,7 +135,7 @@ describe Riak::MapReduce do
135
135
  end
136
136
 
137
137
  it "should map phases to their JSON equivalents" do
138
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => "function(){}")
138
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => "function(){}")
139
139
  @mr.query << phase
140
140
  @mr.to_json.should include('"source":"function(){}"')
141
141
  @mr.to_json.should include('"query":[{"map":{')
@@ -175,11 +175,11 @@ describe Riak::MapReduce do
175
175
  end
176
176
 
177
177
  it "should interpret failed requests with JSON content-types as map reduce errors" do
178
- @http.stub!(:post).and_raise(Riak::FailedRequest.new(:post, 200, 500, {"content-type" => ["application/json"]}, '{"error":"syntax error"}'))
179
- lambda { @mr.run }.should raise_error(Riak::MapReduceError)
178
+ @http.stub!(:post).and_raise(Riakpb::FailedRequest.new(:post, 200, 500, {"content-type" => ["application/json"]}, '{"error":"syntax error"}'))
179
+ lambda { @mr.run }.should raise_error(Riakpb::MapReduceError)
180
180
  begin
181
181
  @mr.run
182
- rescue Riak::MapReduceError => mre
182
+ rescue Riakpb::MapReduceError => mre
183
183
  mre.message.should == '{"error":"syntax error"}'
184
184
  else
185
185
  fail "No exception raised!"
@@ -187,66 +187,66 @@ describe Riak::MapReduce do
187
187
  end
188
188
 
189
189
  it "should re-raise non-JSON error responses" do
190
- @http.stub!(:post).and_raise(Riak::FailedRequest.new(:post, 200, 500, {"content-type" => ["text/plain"]}, 'Oops, you bwoke it.'))
191
- lambda { @mr.run }.should raise_error(Riak::FailedRequest)
190
+ @http.stub!(:post).and_raise(Riakpb::FailedRequest.new(:post, 200, 500, {"content-type" => ["text/plain"]}, 'Oops, you bwoke it.'))
191
+ lambda { @mr.run }.should raise_error(Riakpb::FailedRequest)
192
192
  end
193
193
  end
194
194
  =end
195
195
  end
196
196
 
197
- describe Riak::MapReduce::Phase do
197
+ describe Riakpb::MapReduce::Phase do
198
198
  before :each do
199
199
  @fun = "function(v,_,_){ return v['values'][0]['data']; }"
200
200
  end
201
201
 
202
202
  it "should initialize with a type and a function" do
203
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => @fun, :language => "javascript")
203
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => @fun, :language => "javascript")
204
204
  phase.type.should == :map
205
205
  phase.function.should == @fun
206
206
  phase.language.should == "javascript"
207
207
  end
208
208
 
209
209
  it "should initialize with a type and an MF" do
210
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => ["module", "function"], :language => "erlang")
210
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => ["module", "function"], :language => "erlang")
211
211
  phase.type.should == :map
212
212
  phase.function.should == ["module", "function"]
213
213
  phase.language.should == "erlang"
214
214
  end
215
215
 
216
216
  it "should initialize with a type and a bucket/key" do
217
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => {:bucket => "funs", :key => "awesome_map"}, :language => "javascript")
217
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => {:bucket => "funs", :key => "awesome_map"}, :language => "javascript")
218
218
  phase.type.should == :map
219
219
  phase.function.should == {:bucket => "funs", :key => "awesome_map"}
220
220
  phase.language.should == "javascript"
221
221
  end
222
222
 
223
223
  it "should assume the language is erlang when the function is an array" do
224
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => ["module", "function"])
224
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => ["module", "function"])
225
225
  phase.language.should == "erlang"
226
226
  end
227
227
 
228
228
  it "should assume the language is javascript when the function is a string" do
229
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => @fun)
229
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => @fun)
230
230
  phase.language.should == "javascript"
231
231
  end
232
232
 
233
233
  it "should assume the language is javascript when the function is a hash" do
234
- phase = Riak::MapReduce::Phase.new(:type => :map, :function => {:bucket => "jobs", :key => "awesome_map"})
234
+ phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => {:bucket => "jobs", :key => "awesome_map"})
235
235
  phase.language.should == "javascript"
236
236
  end
237
237
 
238
238
  it "should accept a WalkSpec for the function when a link phase" do
239
- # phase = Riak::MapReduce::Phase.new(:type => :link, :function => Riak::WalkSpec.new({}))
240
- # phase.function.should be_kind_of(Riak::WalkSpec)
239
+ # phase = Riakpb::MapReduce::Phase.new(:type => :link, :function => Riakpb::WalkSpec.new({}))
240
+ # phase.function.should be_kind_of(Riakpb::WalkSpec)
241
241
  end
242
242
 
243
243
  it "should raise an error if a WalkSpec is given for a phase type other than :link" do
244
- # lambda { Riak::MapReduce::Phase.new(:type => :map, :function => Riak::WalkSpec.new({})) }.should raise_error(ArgumentError)
244
+ # lambda { Riakpb::MapReduce::Phase.new(:type => :map, :function => Riakpb::WalkSpec.new({})) }.should raise_error(ArgumentError)
245
245
  end
246
246
 
247
247
  describe "converting to JSON for the job" do
248
248
  before :each do
249
- @phase = Riak::MapReduce::Phase.new(:type => :map, :function => "")
249
+ @phase = Riakpb::MapReduce::Phase.new(:type => :map, :function => "")
250
250
  end
251
251
 
252
252
  [:map, :reduce].each do |type|
@@ -276,8 +276,8 @@ describe Riak::MapReduce::Phase do
276
276
  end
277
277
 
278
278
  it "should include the function name when the function is not a lambda" do
279
- @phase.function = "Riak.mapValues"
280
- @phase.to_json.should include('"name":"Riak.mapValues"')
279
+ @phase.function = "Riakpb.mapValues"
280
+ @phase.to_json.should include('"name":"Riakpb.mapValues"')
281
281
  @phase.to_json.should_not include('"source"')
282
282
  end
283
283
 
@@ -1,4 +1,4 @@
1
1
  require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
- describe Riak::Client::Rpc do
4
- end # Riak::Client::Rpc
3
+ describe Riakpb::Client::Rpc do
4
+ end # Riakpb::Client::Rpc
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 6
9
- version: 0.1.6
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Gonyea
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-08 00:00:00 -07:00
17
+ date: 2010-07-09 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: 0.4.4
62
62
  type: :runtime
63
63
  version_requirements: *id003
64
- description: riakpb is a protocol buffer client for Riak--the distributed database by Basho.
64
+ description: riakpb is a protocol buffer client for Riakpb--the distributed database by Basho.
65
65
  email: me@inherentlylame.com
66
66
  executables: []
67
67
 
@@ -76,13 +76,13 @@ files:
76
76
  - lib/riak/client/rpc.rb
77
77
  - lib/riak/client.rb
78
78
  - lib/riak/client_pb.rb
79
+ - lib/riak/content.rb
79
80
  - lib/riak/failed_exchange.rb
80
81
  - lib/riak/failed_request.rb
81
82
  - lib/riak/i18n.rb
82
83
  - lib/riak/key.rb
83
84
  - lib/riak/locale/en.yml
84
85
  - lib/riak/map_reduce.rb
85
- - lib/riak/riak_content.rb
86
86
  - lib/riak/sibling_error.rb
87
87
  - lib/riak/util/decode.rb
88
88
  - lib/riak/util/encode.rb
@@ -93,15 +93,14 @@ files:
93
93
  - Manifest.txt
94
94
  - Rakefile
95
95
  - README.rdoc
96
- - riakpb.gemspec
97
96
  - script/console
98
97
  - script/destroy
99
98
  - script/generate
100
99
  - spec/riak/bucket_spec.rb
101
100
  - spec/riak/client_spec.rb
101
+ - spec/riak/content_spec.rb
102
102
  - spec/riak/key_spec.rb
103
103
  - spec/riak/map_reduce_spec.rb
104
- - spec/riak/riak_content_spec.rb
105
104
  - spec/riak/rpc_spec.rb
106
105
  - spec/spec_helper.rb
107
106
  has_rdoc: true
@@ -133,12 +132,12 @@ rubyforge_project:
133
132
  rubygems_version: 1.3.6
134
133
  signing_key:
135
134
  specification_version: 3
136
- summary: riakpb is a protocol buffer client for Riak--the distributed database by Basho.
135
+ summary: riakpb is a protocol buffer client for Riakpb--the distributed database by Basho.
137
136
  test_files:
138
137
  - spec/riak/bucket_spec.rb
139
138
  - spec/riak/client_spec.rb
139
+ - spec/riak/content_spec.rb
140
140
  - spec/riak/key_spec.rb
141
141
  - spec/riak/map_reduce_spec.rb
142
- - spec/riak/riak_content_spec.rb
143
142
  - spec/riak/rpc_spec.rb
144
143
  - spec/spec_helper.rb
data/riakpb.gemspec DELETED
@@ -1,37 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{riakpb}
5
- s.version = "0.1.6"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Scott Gonyea"]
9
- s.date = %q{2010-07-08}
10
- s.description = %q{riakpb is a protocol buffer client for Riak--the distributed database by Basho.}
11
- s.email = %q{me@inherentlylame.com}
12
- s.files = ["goog.csv", "History.txt", "lib/riak/bucket.rb", "lib/riak/client/rpc.rb", "lib/riak/client.rb", "lib/riak/client_pb.rb", "lib/riak/failed_exchange.rb", "lib/riak/failed_request.rb", "lib/riak/i18n.rb", "lib/riak/key.rb", "lib/riak/locale/en.yml", "lib/riak/map_reduce.rb", "lib/riak/riak_content.rb", "lib/riak/sibling_error.rb", "lib/riak/util/decode.rb", "lib/riak/util/encode.rb", "lib/riak/util/message_code.rb", "lib/riak/util/translation.rb", "lib/riak.rb", "load_stocks.rb", "Manifest.txt", "Rakefile", "README.rdoc", "riakpb.gemspec", "script/console", "script/destroy", "script/generate", "spec/riak/bucket_spec.rb", "spec/riak/client_spec.rb", "spec/riak/key_spec.rb", "spec/riak/map_reduce_spec.rb", "spec/riak/riak_content_spec.rb", "spec/riak/rpc_spec.rb", "spec/spec_helper.rb"]
13
- s.homepage = %q{http://github.com/aitrus/riak-pbclient}
14
- s.require_paths = ["lib"]
15
- s.rubygems_version = %q{1.3.6}
16
- s.summary = %q{riakpb is a protocol buffer client for Riak--the distributed database by Basho.}
17
- s.test_files = ["spec/riak/bucket_spec.rb", "spec/riak/client_spec.rb", "spec/riak/key_spec.rb", "spec/riak/map_reduce_spec.rb", "spec/riak/riak_content_spec.rb", "spec/riak/rpc_spec.rb", "spec/spec_helper.rb"]
18
-
19
- if s.respond_to? :specification_version then
20
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
21
- s.specification_version = 3
22
-
23
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
24
- s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.9"])
25
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
26
- s.add_runtime_dependency(%q<protobuf>, [">= 0.4.4"])
27
- else
28
- s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.9"])
29
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
30
- s.add_dependency(%q<protobuf>, [">= 0.4.4"])
31
- end
32
- else
33
- s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.9"])
34
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
35
- s.add_dependency(%q<protobuf>, [">= 0.4.4"])
36
- end
37
- end