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.
Files changed (77) hide show
  1. data/Rakefile +9 -2
  2. data/ar-octopus.gemspec +70 -5
  3. data/lib/octopus/has_and_belongs_to_many_association.rb +1 -5
  4. data/lib/octopus/model.rb +6 -16
  5. data/lib/octopus/proxy.rb +1 -6
  6. data/lib/octopus/scope_proxy.rb +7 -10
  7. data/sample_app/.gitignore +4 -0
  8. data/sample_app/.rspec +1 -0
  9. data/sample_app/Gemfile +22 -0
  10. data/sample_app/Gemfile.lock +149 -0
  11. data/sample_app/README +3 -0
  12. data/sample_app/Rakefile +7 -0
  13. data/sample_app/app/controllers/application_controller.rb +4 -0
  14. data/sample_app/app/helpers/application_helper.rb +2 -0
  15. data/sample_app/app/models/item.rb +2 -0
  16. data/sample_app/app/models/user.rb +2 -0
  17. data/sample_app/app/views/layouts/application.html.erb +14 -0
  18. data/sample_app/autotest/discover.rb +2 -0
  19. data/sample_app/config.ru +4 -0
  20. data/sample_app/config/application.rb +46 -0
  21. data/sample_app/config/boot.rb +13 -0
  22. data/sample_app/config/cucumber.yml +8 -0
  23. data/sample_app/config/database.yml +25 -0
  24. data/sample_app/config/environment.rb +5 -0
  25. data/sample_app/config/environments/development.rb +19 -0
  26. data/sample_app/config/environments/production.rb +46 -0
  27. data/sample_app/config/environments/test.rb +32 -0
  28. data/sample_app/config/initializers/backtrace_silencers.rb +7 -0
  29. data/sample_app/config/initializers/inflections.rb +10 -0
  30. data/sample_app/config/initializers/mime_types.rb +5 -0
  31. data/sample_app/config/initializers/secret_token.rb +7 -0
  32. data/sample_app/config/initializers/session_store.rb +8 -0
  33. data/sample_app/config/locales/en.yml +5 -0
  34. data/sample_app/config/routes.rb +58 -0
  35. data/sample_app/config/shards.yml +28 -0
  36. data/sample_app/db/migrate/20100720172715_create_users.rb +15 -0
  37. data/sample_app/db/migrate/20100720172730_create_items.rb +16 -0
  38. data/sample_app/db/migrate/20100720210335_create_sample_users.rb +11 -0
  39. data/sample_app/db/schema.rb +29 -0
  40. data/sample_app/db/seeds.rb +16 -0
  41. data/sample_app/doc/README_FOR_APP +2 -0
  42. data/sample_app/features/migrate.feature +44 -0
  43. data/sample_app/features/seed.feature +15 -0
  44. data/sample_app/features/step_definitions/seeds_steps.rb +15 -0
  45. data/sample_app/features/step_definitions/web_steps.rb +219 -0
  46. data/sample_app/features/support/env.rb +65 -0
  47. data/sample_app/features/support/paths.rb +33 -0
  48. data/sample_app/lib/tasks/.gitkeep +0 -0
  49. data/sample_app/lib/tasks/cucumber.rake +53 -0
  50. data/sample_app/public/404.html +26 -0
  51. data/sample_app/public/422.html +26 -0
  52. data/sample_app/public/500.html +26 -0
  53. data/sample_app/public/favicon.ico +0 -0
  54. data/sample_app/public/images/rails.png +0 -0
  55. data/sample_app/public/index.html +279 -0
  56. data/sample_app/public/javascripts/application.js +2 -0
  57. data/sample_app/public/javascripts/controls.js +965 -0
  58. data/sample_app/public/javascripts/dragdrop.js +974 -0
  59. data/sample_app/public/javascripts/effects.js +1123 -0
  60. data/sample_app/public/javascripts/prototype.js +4874 -0
  61. data/sample_app/public/javascripts/rails.js +118 -0
  62. data/sample_app/public/robots.txt +5 -0
  63. data/sample_app/public/stylesheets/.gitkeep +0 -0
  64. data/sample_app/script/cucumber +10 -0
  65. data/sample_app/script/rails +6 -0
  66. data/sample_app/spec/models/item_spec.rb +5 -0
  67. data/sample_app/spec/models/user_spec.rb +5 -0
  68. data/sample_app/spec/spec_helper.rb +27 -0
  69. data/sample_app/test/performance/browsing_test.rb +9 -0
  70. data/sample_app/test/test_helper.rb +13 -0
  71. data/sample_app/vendor/plugins/.gitkeep +0 -0
  72. data/spec/config/shards.yml +16 -18
  73. data/spec/database_models.rb +5 -0
  74. data/spec/octopus/model_spec.rb +77 -14
  75. data/spec/octopus/proxy_spec.rb +2 -0
  76. data/spec/octopus/replication_specs.rb +5 -0
  77. 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: 43
4
+ hash: 41
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 26
10
- version: 0.0.26
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 00:00:00 -03:00
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: -1139874873
94
+ hash: 5
95
95
  segments:
96
+ - 2
96
97
  - 3
97
- - 0
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