ar-octopus 0.2.0 → 0.2.1
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.
- data/Gemfile +2 -1
- data/Gemfile.lock +2 -0
- data/Rakefile +1 -1
- data/ar-octopus.gemspec +2 -2
- data/lib/octopus/model.rb +0 -8
- data/lib/octopus/scope_proxy.rb +1 -0
- data/spec/octopus/model_spec.rb +2 -1
- data/spec/octopus/scope_proxy_spec.rb +4 -0
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -43,6 +43,7 @@ GEM
|
|
43
43
|
rack (>= 1.0.0)
|
44
44
|
rack-test (0.5.4)
|
45
45
|
rack (>= 1.0)
|
46
|
+
rake (0.8.7)
|
46
47
|
rspec (2.0.0.beta.19)
|
47
48
|
rspec-core (= 2.0.0.beta.19)
|
48
49
|
rspec-expectations (= 2.0.0.beta.19)
|
@@ -65,5 +66,6 @@ DEPENDENCIES
|
|
65
66
|
jeweler (>= 1.4)
|
66
67
|
mysql (>= 2.8.1)
|
67
68
|
pg (>= 0.9.0)
|
69
|
+
rake (>= 0.8.7)
|
68
70
|
rspec (= 2.0.0.beta.19)
|
69
71
|
sqlite3-ruby (>= 1.3.1)
|
data/Rakefile
CHANGED
@@ -37,7 +37,7 @@ begin
|
|
37
37
|
gem.add_development_dependency "jeweler", ">= 1.4"
|
38
38
|
gem.add_development_dependency "actionpack", ">= 2.3"
|
39
39
|
gem.add_dependency('activerecord', '>= 2.3')
|
40
|
-
gem.version = "0.2.
|
40
|
+
gem.version = "0.2.1"
|
41
41
|
end
|
42
42
|
Jeweler::GemcutterTasks.new
|
43
43
|
rescue LoadError
|
data/ar-octopus.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ar-octopus}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Thiago Pradi", "Mike Perham"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-31}
|
13
13
|
s.description = %q{This gem allows you to use sharded databases with ActiveRecord. this also provides a interface for replication and for running migrations with multiples shards.}
|
14
14
|
s.email = %q{tchandy@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/octopus/model.rb
CHANGED
@@ -3,9 +3,6 @@ module Octopus::Model
|
|
3
3
|
base.send(:include, InstanceMethods)
|
4
4
|
base.extend(ClassMethods)
|
5
5
|
base.hijack_connection()
|
6
|
-
class << base
|
7
|
-
alias_method_chain(:establish_connection, :octopus)
|
8
|
-
end
|
9
6
|
end
|
10
7
|
|
11
8
|
module SharedMethods
|
@@ -88,11 +85,6 @@ module Octopus::Model
|
|
88
85
|
def sharded_model()
|
89
86
|
write_inheritable_attribute(:sharded, true)
|
90
87
|
end
|
91
|
-
|
92
|
-
def establish_connection_with_octopus(spec=nil)
|
93
|
-
write_inheritable_attribute(:establish_connection, true)
|
94
|
-
establish_connection_without_octopus(spec)
|
95
|
-
end
|
96
88
|
end
|
97
89
|
end
|
98
90
|
|
data/lib/octopus/scope_proxy.rb
CHANGED
data/spec/octopus/model_spec.rb
CHANGED
@@ -173,7 +173,8 @@ describe Octopus::Model do
|
|
173
173
|
|
174
174
|
describe "AR basic methods" do
|
175
175
|
it "establish_connection" do
|
176
|
-
|
176
|
+
pending("TODO")
|
177
|
+
# CustomConnection.connection.current_database.should == "octopus_shard2"
|
177
178
|
end
|
178
179
|
|
179
180
|
it "increment" do
|
@@ -12,4 +12,8 @@ describe Octopus::ScopeProxy do
|
|
12
12
|
User.using(:brazil).where(:name => "Thiago").using(:canada).where(:number => 4).using(:brazil).order(:number).all.should == []
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
it "should raise a exception when trying to send a query to a shard that don't exists" do
|
17
|
+
lambda { User.where(:name => "Thiago").using(:dont_exists).all }.should raise_exception("Nonexistent Shard Name: dont_exists")
|
18
|
+
end
|
15
19
|
end
|
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: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
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-10-
|
19
|
+
date: 2010-10-31 00:00:00 -02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|