roulette 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -36,6 +36,11 @@ class Roulette
36
36
  store_index = val % stores.count
37
37
  self.stores[store_index]
38
38
  end
39
+
40
+ def each
41
+ EachStore.new(stores)
42
+ end
39
43
  end
40
44
 
41
45
  require 'roulette/transaction'
46
+ require 'roulette/each_store'
@@ -0,0 +1,13 @@
1
+ class Roulette::EachStore
2
+ attr_accessor :stores
3
+
4
+ def initialize(stores)
5
+ self.stores = stores
6
+ end
7
+
8
+ def method_missing(method_name, *args, &blk)
9
+ stores.collect do |store|
10
+ store.send method_name, *args
11
+ end
12
+ end
13
+ end
Binary file
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roulette}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Schneems"]
12
- s.date = %q{2011-07-14}
12
+ s.date = %q{2011-07-27}
13
13
  s.description = %q{
14
14
  Super easy pre-sharding for your ruby NOSQL store. Presharding is used to naively scale your data-stores horizontally.
15
15
  }
@@ -26,13 +26,16 @@ Gem::Specification.new do |s|
26
26
  "VERSION",
27
27
  "autotest/discover.rb",
28
28
  "lib/roulette.rb",
29
+ "lib/roulette/each_store.rb",
29
30
  "lib/roulette/transaction.rb",
30
31
  "license.txt",
31
32
  "pkg/roulette-.gem",
32
33
  "pkg/roulette-0.0.1.gem",
33
34
  "pkg/roulette-0.0.2.gem",
34
35
  "pkg/roulette-0.0.3.gem",
36
+ "pkg/roulette-0.0.4.gem",
35
37
  "roulette.gemspec",
38
+ "spec/roulette/each_store_spec.rb",
36
39
  "spec/roulette/transaction_spec.rb",
37
40
  "spec/roulette_spec.rb",
38
41
  "spec/spec_helper.rb"
@@ -43,6 +46,7 @@ Gem::Specification.new do |s|
43
46
  s.rubygems_version = %q{1.6.2}
44
47
  s.summary = %q{Pre-Sharding so simple you'll shoot yourself :p}
45
48
  s.test_files = [
49
+ "spec/roulette/each_store_spec.rb",
46
50
  "spec/roulette/transaction_spec.rb",
47
51
  "spec/roulette_spec.rb",
48
52
  "spec/spec_helper.rb"
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ class FakeKeyValueStore
3
+
4
+ end
5
+
6
+ describe Roulette::EachStore do
7
+ before do
8
+ @key = "key"
9
+ @args = [@key, "value"]
10
+ @stores = [FakeKeyValueStore.new, FakeKeyValueStore.new]
11
+ end
12
+
13
+ describe '#new' do
14
+ it "keeps stores" do
15
+ each_store = Roulette::EachStore.new(@stores)
16
+ each_store.stores.should eq(@stores)
17
+ end
18
+ end
19
+
20
+ describe "#method_missing" do
21
+ it "sends any method to all stores" do
22
+ fired_method = :sadd
23
+ @stores.each do |store|
24
+ store.should_receive(fired_method).with(@args)
25
+ end
26
+ Roulette::EachStore.new(@stores).send fired_method, *@args
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: roulette
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Schneems
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-14 00:00:00 -05:00
13
+ date: 2011-07-27 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -85,13 +85,16 @@ files:
85
85
  - VERSION
86
86
  - autotest/discover.rb
87
87
  - lib/roulette.rb
88
+ - lib/roulette/each_store.rb
88
89
  - lib/roulette/transaction.rb
89
90
  - license.txt
90
91
  - pkg/roulette-.gem
91
92
  - pkg/roulette-0.0.1.gem
92
93
  - pkg/roulette-0.0.2.gem
93
94
  - pkg/roulette-0.0.3.gem
95
+ - pkg/roulette-0.0.4.gem
94
96
  - roulette.gemspec
97
+ - spec/roulette/each_store_spec.rb
95
98
  - spec/roulette/transaction_spec.rb
96
99
  - spec/roulette_spec.rb
97
100
  - spec/spec_helper.rb
@@ -109,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
112
  requirements:
110
113
  - - ">="
111
114
  - !ruby/object:Gem::Version
112
- hash: 2462504679129108896
115
+ hash: 144438247222523994
113
116
  segments:
114
117
  - 0
115
118
  version: "0"
@@ -127,6 +130,7 @@ signing_key:
127
130
  specification_version: 3
128
131
  summary: Pre-Sharding so simple you'll shoot yourself :p
129
132
  test_files:
133
+ - spec/roulette/each_store_spec.rb
130
134
  - spec/roulette/transaction_spec.rb
131
135
  - spec/roulette_spec.rb
132
136
  - spec/spec_helper.rb