ar-octopus 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +9 -2
- data/ar-octopus.gemspec +70 -5
- data/lib/octopus/has_and_belongs_to_many_association.rb +1 -5
- data/lib/octopus/model.rb +6 -16
- data/lib/octopus/proxy.rb +1 -6
- data/lib/octopus/scope_proxy.rb +7 -10
- data/sample_app/.gitignore +4 -0
- data/sample_app/.rspec +1 -0
- data/sample_app/Gemfile +22 -0
- data/sample_app/Gemfile.lock +149 -0
- data/sample_app/README +3 -0
- data/sample_app/Rakefile +7 -0
- data/sample_app/app/controllers/application_controller.rb +4 -0
- data/sample_app/app/helpers/application_helper.rb +2 -0
- data/sample_app/app/models/item.rb +2 -0
- data/sample_app/app/models/user.rb +2 -0
- data/sample_app/app/views/layouts/application.html.erb +14 -0
- data/sample_app/autotest/discover.rb +2 -0
- data/sample_app/config.ru +4 -0
- data/sample_app/config/application.rb +46 -0
- data/sample_app/config/boot.rb +13 -0
- data/sample_app/config/cucumber.yml +8 -0
- data/sample_app/config/database.yml +25 -0
- data/sample_app/config/environment.rb +5 -0
- data/sample_app/config/environments/development.rb +19 -0
- data/sample_app/config/environments/production.rb +46 -0
- data/sample_app/config/environments/test.rb +32 -0
- data/sample_app/config/initializers/backtrace_silencers.rb +7 -0
- data/sample_app/config/initializers/inflections.rb +10 -0
- data/sample_app/config/initializers/mime_types.rb +5 -0
- data/sample_app/config/initializers/secret_token.rb +7 -0
- data/sample_app/config/initializers/session_store.rb +8 -0
- data/sample_app/config/locales/en.yml +5 -0
- data/sample_app/config/routes.rb +58 -0
- data/sample_app/config/shards.yml +28 -0
- data/sample_app/db/migrate/20100720172715_create_users.rb +15 -0
- data/sample_app/db/migrate/20100720172730_create_items.rb +16 -0
- data/sample_app/db/migrate/20100720210335_create_sample_users.rb +11 -0
- data/sample_app/db/schema.rb +29 -0
- data/sample_app/db/seeds.rb +16 -0
- data/sample_app/doc/README_FOR_APP +2 -0
- data/sample_app/features/migrate.feature +44 -0
- data/sample_app/features/seed.feature +15 -0
- data/sample_app/features/step_definitions/seeds_steps.rb +15 -0
- data/sample_app/features/step_definitions/web_steps.rb +219 -0
- data/sample_app/features/support/env.rb +65 -0
- data/sample_app/features/support/paths.rb +33 -0
- data/sample_app/lib/tasks/.gitkeep +0 -0
- data/sample_app/lib/tasks/cucumber.rake +53 -0
- data/sample_app/public/404.html +26 -0
- data/sample_app/public/422.html +26 -0
- data/sample_app/public/500.html +26 -0
- data/sample_app/public/favicon.ico +0 -0
- data/sample_app/public/images/rails.png +0 -0
- data/sample_app/public/index.html +279 -0
- data/sample_app/public/javascripts/application.js +2 -0
- data/sample_app/public/javascripts/controls.js +965 -0
- data/sample_app/public/javascripts/dragdrop.js +974 -0
- data/sample_app/public/javascripts/effects.js +1123 -0
- data/sample_app/public/javascripts/prototype.js +4874 -0
- data/sample_app/public/javascripts/rails.js +118 -0
- data/sample_app/public/robots.txt +5 -0
- data/sample_app/public/stylesheets/.gitkeep +0 -0
- data/sample_app/script/cucumber +10 -0
- data/sample_app/script/rails +6 -0
- data/sample_app/spec/models/item_spec.rb +5 -0
- data/sample_app/spec/models/user_spec.rb +5 -0
- data/sample_app/spec/spec_helper.rb +27 -0
- data/sample_app/test/performance/browsing_test.rb +9 -0
- data/sample_app/test/test_helper.rb +13 -0
- data/sample_app/vendor/plugins/.gitkeep +0 -0
- data/spec/config/shards.yml +16 -18
- data/spec/database_models.rb +5 -0
- data/spec/octopus/model_spec.rb +77 -14
- data/spec/octopus/proxy_spec.rb +2 -0
- data/spec/octopus/replication_specs.rb +5 -0
- metadata +72 -8
@@ -19,6 +19,11 @@ describe "when the database is replicated" do
|
|
19
19
|
u1.save()
|
20
20
|
Cat.using(:slave4).first.name.should == "Slave Cat"
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should allow to send some queries to a selected slave" do
|
24
|
+
Cat.using(:slave4).create!([{:name => "Slave Cat 1"}, {:name => "Slave Cat 2"}])
|
25
|
+
Cat.using(:slave4).count.should == 2
|
26
|
+
end
|
22
27
|
|
23
28
|
it "should send read queries to slaves, when you have a replicated model, using a round robin algorithm" do
|
24
29
|
u = Cat.create!(:name => "master")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-octopus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 27
|
10
|
+
version: 0.0.27
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thiago Pradi
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-07-
|
19
|
+
date: 2010-07-23 00:00:00 -03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -91,12 +91,11 @@ dependencies:
|
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
hash:
|
94
|
+
hash: 5
|
95
95
|
segments:
|
96
|
+
- 2
|
96
97
|
- 3
|
97
|
-
|
98
|
-
- 0beta
|
99
|
-
version: 3.0.0beta
|
98
|
+
version: "2.3"
|
100
99
|
type: :runtime
|
101
100
|
version_requirements: *id005
|
102
101
|
description: This gem allows you to use sharded databases with ActiveRecord. this also provides a interface for replication and for running migrations with multiples shards.
|
@@ -131,6 +130,71 @@ files:
|
|
131
130
|
- lib/octopus/rails3/persistence.rb
|
132
131
|
- lib/octopus/scope_proxy.rb
|
133
132
|
- rails/init.rb
|
133
|
+
- sample_app/.gitignore
|
134
|
+
- sample_app/.rspec
|
135
|
+
- sample_app/Gemfile
|
136
|
+
- sample_app/Gemfile.lock
|
137
|
+
- sample_app/README
|
138
|
+
- sample_app/Rakefile
|
139
|
+
- sample_app/app/controllers/application_controller.rb
|
140
|
+
- sample_app/app/helpers/application_helper.rb
|
141
|
+
- sample_app/app/models/item.rb
|
142
|
+
- sample_app/app/models/user.rb
|
143
|
+
- sample_app/app/views/layouts/application.html.erb
|
144
|
+
- sample_app/autotest/discover.rb
|
145
|
+
- sample_app/config.ru
|
146
|
+
- sample_app/config/application.rb
|
147
|
+
- sample_app/config/boot.rb
|
148
|
+
- sample_app/config/cucumber.yml
|
149
|
+
- sample_app/config/database.yml
|
150
|
+
- sample_app/config/environment.rb
|
151
|
+
- sample_app/config/environments/development.rb
|
152
|
+
- sample_app/config/environments/production.rb
|
153
|
+
- sample_app/config/environments/test.rb
|
154
|
+
- sample_app/config/initializers/backtrace_silencers.rb
|
155
|
+
- sample_app/config/initializers/inflections.rb
|
156
|
+
- sample_app/config/initializers/mime_types.rb
|
157
|
+
- sample_app/config/initializers/secret_token.rb
|
158
|
+
- sample_app/config/initializers/session_store.rb
|
159
|
+
- sample_app/config/locales/en.yml
|
160
|
+
- sample_app/config/routes.rb
|
161
|
+
- sample_app/config/shards.yml
|
162
|
+
- sample_app/db/migrate/20100720172715_create_users.rb
|
163
|
+
- sample_app/db/migrate/20100720172730_create_items.rb
|
164
|
+
- sample_app/db/migrate/20100720210335_create_sample_users.rb
|
165
|
+
- sample_app/db/schema.rb
|
166
|
+
- sample_app/db/seeds.rb
|
167
|
+
- sample_app/doc/README_FOR_APP
|
168
|
+
- sample_app/features/migrate.feature
|
169
|
+
- sample_app/features/seed.feature
|
170
|
+
- sample_app/features/step_definitions/seeds_steps.rb
|
171
|
+
- sample_app/features/step_definitions/web_steps.rb
|
172
|
+
- sample_app/features/support/env.rb
|
173
|
+
- sample_app/features/support/paths.rb
|
174
|
+
- sample_app/lib/tasks/.gitkeep
|
175
|
+
- sample_app/lib/tasks/cucumber.rake
|
176
|
+
- sample_app/public/404.html
|
177
|
+
- sample_app/public/422.html
|
178
|
+
- sample_app/public/500.html
|
179
|
+
- sample_app/public/favicon.ico
|
180
|
+
- sample_app/public/images/rails.png
|
181
|
+
- sample_app/public/index.html
|
182
|
+
- sample_app/public/javascripts/application.js
|
183
|
+
- sample_app/public/javascripts/controls.js
|
184
|
+
- sample_app/public/javascripts/dragdrop.js
|
185
|
+
- sample_app/public/javascripts/effects.js
|
186
|
+
- sample_app/public/javascripts/prototype.js
|
187
|
+
- sample_app/public/javascripts/rails.js
|
188
|
+
- sample_app/public/robots.txt
|
189
|
+
- sample_app/public/stylesheets/.gitkeep
|
190
|
+
- sample_app/script/cucumber
|
191
|
+
- sample_app/script/rails
|
192
|
+
- sample_app/spec/models/item_spec.rb
|
193
|
+
- sample_app/spec/models/user_spec.rb
|
194
|
+
- sample_app/spec/spec_helper.rb
|
195
|
+
- sample_app/test/performance/browsing_test.rb
|
196
|
+
- sample_app/test/test_helper.rb
|
197
|
+
- sample_app/vendor/plugins/.gitkeep
|
134
198
|
- spec/config/shards.yml
|
135
199
|
- spec/database_connection.rb
|
136
200
|
- spec/database_models.rb
|