ar-octopus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkdn +49 -0
- data/Rakefile +106 -0
- data/VERSION +1 -0
- data/doc/api.textile +98 -0
- data/doc/features.textile +74 -0
- data/doc/libraries.textile +70 -0
- data/doc/shards.yml +76 -0
- data/lib/octopus.rb +30 -0
- data/lib/octopus/controller.rb +2 -0
- data/lib/octopus/migration.rb +41 -0
- data/lib/octopus/model.rb +57 -0
- data/lib/octopus/proxy.rb +195 -0
- data/spec/config/shards.yml +76 -0
- data/spec/database_connection.rb +6 -0
- data/spec/database_models.rb +23 -0
- data/spec/migrations/1_create_users_on_master.rb +9 -0
- data/spec/migrations/2_create_users_on_canada.rb +11 -0
- data/spec/migrations/3_create_users_on_both_shards.rb +11 -0
- data/spec/migrations/4_create_users_on_shards_of_a_group.rb +11 -0
- data/spec/migrations/5_create_users_on_multiples_groups.rb +11 -0
- data/spec/migrations/6_raise_exception_with_invalid_shard_name.rb +11 -0
- data/spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb +11 -0
- data/spec/migrations/8_raise_exception_with_invalid_group_name.rb +11 -0
- data/spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb +11 -0
- data/spec/octopus/controller_spec.rb +7 -0
- data/spec/octopus/migration_spec.rb +79 -0
- data/spec/octopus/model_spec.rb +122 -0
- data/spec/octopus/octopus_spec.rb +15 -0
- data/spec/octopus/proxy_spec.rb +112 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +27 -0
- metadata +123 -0
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
MIGRATIONS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), 'migrations'))
|
2
|
+
require 'spec'
|
3
|
+
require 'spec/autorun'
|
4
|
+
require "database_connection"
|
5
|
+
require 'octopus'
|
6
|
+
|
7
|
+
Spec::Runner.configure do |config|
|
8
|
+
config.mock_with :rspec
|
9
|
+
|
10
|
+
config.before(:each) do
|
11
|
+
Octopus.stub!(:directory).and_return(File.dirname(__FILE__))
|
12
|
+
require "database_models"
|
13
|
+
clean_all_shards()
|
14
|
+
end
|
15
|
+
|
16
|
+
config.after(:each) do
|
17
|
+
clean_all_shards()
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def clean_all_shards()
|
22
|
+
ActiveRecord::Base.using(:master).connection.shards.keys.each do |shard_symbol|
|
23
|
+
['schema_migrations', 'users', 'clients', 'cats', 'items'].each do |tables|
|
24
|
+
ActiveRecord::Base.using(shard_symbol).connection.execute("DELETE FROM #{tables};")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ar-octopus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Thiago Pradi
|
13
|
+
- Mike Perham
|
14
|
+
- Amit Agarwal
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-06-11 00:00:00 -03:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: rspec
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 2
|
32
|
+
- 9
|
33
|
+
version: 1.2.9
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
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.
|
37
|
+
email: tchandy@gmail.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- README.mkdn
|
44
|
+
files:
|
45
|
+
- README.mkdn
|
46
|
+
- Rakefile
|
47
|
+
- VERSION
|
48
|
+
- doc/api.textile
|
49
|
+
- doc/features.textile
|
50
|
+
- doc/libraries.textile
|
51
|
+
- doc/shards.yml
|
52
|
+
- lib/octopus.rb
|
53
|
+
- lib/octopus/controller.rb
|
54
|
+
- lib/octopus/migration.rb
|
55
|
+
- lib/octopus/model.rb
|
56
|
+
- lib/octopus/proxy.rb
|
57
|
+
- spec/config/shards.yml
|
58
|
+
- spec/database_connection.rb
|
59
|
+
- spec/database_models.rb
|
60
|
+
- spec/migrations/1_create_users_on_master.rb
|
61
|
+
- spec/migrations/2_create_users_on_canada.rb
|
62
|
+
- spec/migrations/3_create_users_on_both_shards.rb
|
63
|
+
- spec/migrations/4_create_users_on_shards_of_a_group.rb
|
64
|
+
- spec/migrations/5_create_users_on_multiples_groups.rb
|
65
|
+
- spec/migrations/6_raise_exception_with_invalid_shard_name.rb
|
66
|
+
- spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb
|
67
|
+
- spec/migrations/8_raise_exception_with_invalid_group_name.rb
|
68
|
+
- spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb
|
69
|
+
- spec/octopus/controller_spec.rb
|
70
|
+
- spec/octopus/migration_spec.rb
|
71
|
+
- spec/octopus/model_spec.rb
|
72
|
+
- spec/octopus/octopus_spec.rb
|
73
|
+
- spec/octopus/proxy_spec.rb
|
74
|
+
- spec/spec.opts
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/tchandy/octopus
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.3.6
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Easy Database Sharding for ActiveRecord
|
106
|
+
test_files:
|
107
|
+
- spec/database_connection.rb
|
108
|
+
- spec/database_models.rb
|
109
|
+
- spec/migrations/1_create_users_on_master.rb
|
110
|
+
- spec/migrations/2_create_users_on_canada.rb
|
111
|
+
- spec/migrations/3_create_users_on_both_shards.rb
|
112
|
+
- spec/migrations/4_create_users_on_shards_of_a_group.rb
|
113
|
+
- spec/migrations/5_create_users_on_multiples_groups.rb
|
114
|
+
- spec/migrations/6_raise_exception_with_invalid_shard_name.rb
|
115
|
+
- spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb
|
116
|
+
- spec/migrations/8_raise_exception_with_invalid_group_name.rb
|
117
|
+
- spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb
|
118
|
+
- spec/octopus/controller_spec.rb
|
119
|
+
- spec/octopus/migration_spec.rb
|
120
|
+
- spec/octopus/model_spec.rb
|
121
|
+
- spec/octopus/octopus_spec.rb
|
122
|
+
- spec/octopus/proxy_spec.rb
|
123
|
+
- spec/spec_helper.rb
|