dbhijacker 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Gemfile.lock +16 -25
- data/{hijacker.gemspec → dbhijacker.gemspec} +12 -20
- data/example_root_schema.rb +1 -0
- data/lib/hijacker/database.rb +5 -5
- data/lib/hijacker.rb +4 -1
- data/spec/hijacker/middleware_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- metadata +107 -127
- data/VERSION +0 -1
- data/init.rb +0 -2
- data/install.rb +0 -1
- data/uninstall.rb +0 -1
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dbhijacker (0.7.
|
4
|
+
dbhijacker (0.7.3)
|
5
5
|
rails (>= 2.3.14)
|
6
6
|
|
7
7
|
GEM
|
@@ -17,12 +17,9 @@ GEM
|
|
17
17
|
activeresource (2.3.18)
|
18
18
|
activesupport (= 2.3.18)
|
19
19
|
activesupport (2.3.18)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rbx-require-relative (> 0.0.4)
|
24
|
-
rack (1.1.3)
|
25
|
-
rack-test (0.6.1)
|
20
|
+
diff-lcs (1.2.3)
|
21
|
+
rack (1.1.6)
|
22
|
+
rack-test (0.6.2)
|
26
23
|
rack (>= 1.0)
|
27
24
|
rails (2.3.18)
|
28
25
|
actionmailer (= 2.3.18)
|
@@ -31,31 +28,25 @@ GEM
|
|
31
28
|
activeresource (= 2.3.18)
|
32
29
|
activesupport (= 2.3.18)
|
33
30
|
rake (>= 0.8.3)
|
34
|
-
rake (0.9.
|
35
|
-
|
36
|
-
|
37
|
-
rspec-
|
38
|
-
rspec-
|
39
|
-
|
40
|
-
rspec-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
ruby-debug (0.10.4)
|
45
|
-
columnize (>= 0.1)
|
46
|
-
ruby-debug-base (~> 0.10.4.0)
|
47
|
-
ruby-debug-base (0.10.4)
|
48
|
-
linecache (>= 0.3)
|
49
|
-
sqlite3 (1.3.5)
|
31
|
+
rake (0.9.6)
|
32
|
+
rspec (2.13.0)
|
33
|
+
rspec-core (~> 2.13.0)
|
34
|
+
rspec-expectations (~> 2.13.0)
|
35
|
+
rspec-mocks (~> 2.13.0)
|
36
|
+
rspec-core (2.13.1)
|
37
|
+
rspec-expectations (2.13.0)
|
38
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
39
|
+
rspec-mocks (2.13.1)
|
40
|
+
sqlite3 (1.3.7)
|
50
41
|
|
51
42
|
PLATFORMS
|
52
43
|
ruby
|
53
44
|
|
54
45
|
DEPENDENCIES
|
46
|
+
bundler (~> 1.3)
|
55
47
|
dbhijacker!
|
56
48
|
rack (~> 1.1.0)
|
57
49
|
rack-test (~> 0.6.1)
|
58
50
|
rake (~> 0.9.2)
|
59
|
-
rspec (~> 2.8
|
60
|
-
ruby-debug (~> 0.10.4)
|
51
|
+
rspec (~> 2.8)
|
61
52
|
sqlite3 (~> 1.3.5)
|
@@ -3,34 +3,34 @@
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{dbhijacker}
|
5
5
|
s.homepage = "https://github.com/crystalcommerce/hijacker"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.8.0"
|
7
7
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
8
|
s.authors = ["Michael Xavier", "Donald Plummer", "Woody Peterson"]
|
10
9
|
s.date = %q{2012-03-21}
|
11
10
|
s.description = %q{Allows a single Rails appliation to access many different databases}
|
12
11
|
s.email = %q{developers@crystalcommerce.com}
|
12
|
+
|
13
13
|
s.add_dependency("rails", ">= 2.3.14")
|
14
|
-
|
15
|
-
s.add_development_dependency
|
16
|
-
s.add_development_dependency
|
17
|
-
s.add_development_dependency
|
18
|
-
s.add_development_dependency
|
19
|
-
s.add_development_dependency
|
14
|
+
|
15
|
+
s.add_development_dependency "bundler", "~> 1.3"
|
16
|
+
s.add_development_dependency "rake", "~> 0.9.2"
|
17
|
+
s.add_development_dependency "rack-test", "~> 0.6.1"
|
18
|
+
s.add_development_dependency "rack", "~> 1.1.0"
|
19
|
+
s.add_development_dependency "rspec", "~> 2.8"
|
20
|
+
s.add_development_dependency "sqlite3", "~> 1.3.5"
|
21
|
+
|
20
22
|
s.extra_rdoc_files = [
|
21
23
|
"README.rdoc"
|
22
24
|
]
|
25
|
+
|
23
26
|
s.files = %w{
|
24
27
|
Gemfile
|
25
28
|
Gemfile.lock
|
26
29
|
MIT-LICENSE
|
27
30
|
README.rdoc
|
28
31
|
Rakefile
|
29
|
-
VERSION
|
30
32
|
example_root_schema.rb
|
31
|
-
|
32
|
-
init.rb
|
33
|
-
install.rb
|
33
|
+
dbhijacker.gemspec
|
34
34
|
lib/dbhijacker.rb
|
35
35
|
lib/hijacker.rb
|
36
36
|
lib/hijacker/active_record_ext.rb
|
@@ -46,11 +46,9 @@ Gem::Specification.new do |s|
|
|
46
46
|
spec/hijacker_spec.rb
|
47
47
|
spec/spec_helper.rb
|
48
48
|
tasks/hijacker_tasks.rake
|
49
|
-
uninstall.rb
|
50
49
|
}
|
51
50
|
s.rdoc_options = ["--charset=UTF-8"]
|
52
51
|
s.require_paths = ["lib"]
|
53
|
-
s.rubygems_version = %q{1.8.15}
|
54
52
|
s.summary = %q{One application, multiple client databases}
|
55
53
|
s.test_files = %w{
|
56
54
|
spec/hijacker/alias_spec.rb
|
@@ -60,10 +58,4 @@ Gem::Specification.new do |s|
|
|
60
58
|
spec/hijacker_spec.rb
|
61
59
|
spec/spec_helper.rb
|
62
60
|
}
|
63
|
-
|
64
|
-
if s.respond_to?(:specification_version)
|
65
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
66
|
-
s.specification_version = 3
|
67
|
-
end
|
68
61
|
end
|
69
|
-
|
data/example_root_schema.rb
CHANGED
data/lib/hijacker/database.rb
CHANGED
@@ -56,10 +56,10 @@ class Hijacker::Database < ActiveRecord::Base
|
|
56
56
|
def self.find_master_for(client)
|
57
57
|
@masters ||= {}
|
58
58
|
@masters[client] ||= self.connection.select_values(
|
59
|
-
"SELECT master.database
|
60
|
-
FROM `databases` AS master, `databases` AS sister
|
61
|
-
WHERE sister.database = #{ActiveRecord::Base.connection.quote(client)}
|
62
|
-
AND sister.master_id = master.id"
|
59
|
+
"SELECT master.database "\
|
60
|
+
"FROM `databases` AS master, `databases` AS sister "\
|
61
|
+
"WHERE sister.database = #{ActiveRecord::Base.connection.quote(client)} "\
|
62
|
+
"AND sister.master_id = master.id"
|
63
63
|
).first
|
64
64
|
end
|
65
65
|
|
@@ -68,7 +68,7 @@ class Hijacker::Database < ActiveRecord::Base
|
|
68
68
|
master = self.find_master_for(client)
|
69
69
|
sister = master.nil? ? nil : client
|
70
70
|
master ||= client
|
71
|
-
|
71
|
+
|
72
72
|
return master, sister
|
73
73
|
end
|
74
74
|
|
data/lib/hijacker.rb
CHANGED
@@ -230,8 +230,11 @@ private
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def self.connection_config(database)
|
233
|
+
hostname = database.host.hostname
|
234
|
+
port = database.host.port || root_config['port']
|
233
235
|
root_config.merge('database' => database.name,
|
234
|
-
'host' =>
|
236
|
+
'host' => hostname,
|
237
|
+
'port' => port)
|
235
238
|
end
|
236
239
|
end
|
237
240
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'active_support'
|
3
3
|
require 'active_support/test_case'
|
4
|
-
require 'ruby-debug'
|
5
|
-
|
6
4
|
require 'active_record'
|
7
5
|
|
8
|
-
RAILS_ENV="test"
|
6
|
+
RAILS_ENV = "test"
|
9
7
|
ENV['RAILS_ENV'] = 'test'
|
8
|
+
|
10
9
|
$:.unshift '../lib'
|
10
|
+
|
11
11
|
ActiveRecord::Base.configurations = {
|
12
12
|
"root" => {
|
13
13
|
:adapter => 'sqlite3',
|
metadata
CHANGED
@@ -1,155 +1,144 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbhijacker
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
hash: 7
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 2
|
10
|
-
version: 0.7.2
|
5
|
+
version: 0.8.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Michael Xavier
|
14
9
|
- Donald Plummer
|
15
10
|
- Woody Peterson
|
16
11
|
autorequire:
|
17
12
|
bindir: bin
|
18
13
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- !ruby/object:Gem::Dependency
|
23
|
-
name: rails
|
14
|
+
date: 2012-03-21 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
24
17
|
prerelease: false
|
25
|
-
|
18
|
+
type: :runtime
|
19
|
+
name: rails
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
21
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 31
|
31
|
-
segments:
|
32
|
-
- 2
|
33
|
-
- 3
|
34
|
-
- 14
|
22
|
+
requirements:
|
23
|
+
- - ! '>='
|
24
|
+
- !ruby/object:Gem::Version
|
35
25
|
version: 2.3.14
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
26
|
+
requirement: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 2.3.14
|
32
|
+
- !ruby/object:Gem::Dependency
|
40
33
|
prerelease: false
|
41
|
-
|
34
|
+
type: :development
|
35
|
+
name: bundler
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.3'
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
42
43
|
none: false
|
43
|
-
requirements:
|
44
|
+
requirements:
|
44
45
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
prerelease: false
|
50
|
+
type: :development
|
51
|
+
name: rake
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
51
57
|
version: 0.9.2
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.9.2
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
prerelease: false
|
52
66
|
type: :development
|
53
|
-
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
67
|
name: rack-test
|
56
|
-
|
57
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
69
|
none: false
|
59
|
-
requirements:
|
70
|
+
requirements:
|
60
71
|
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 5
|
63
|
-
segments:
|
64
|
-
- 0
|
65
|
-
- 6
|
66
|
-
- 1
|
72
|
+
- !ruby/object:Gem::Version
|
67
73
|
version: 0.6.1
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.6.1
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
prerelease: false
|
68
82
|
type: :development
|
69
|
-
version_requirements: *id003
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
83
|
name: rack
|
72
|
-
|
73
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
85
|
none: false
|
75
|
-
requirements:
|
86
|
+
requirements:
|
76
87
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
hash: 19
|
79
|
-
segments:
|
80
|
-
- 1
|
81
|
-
- 1
|
82
|
-
- 0
|
88
|
+
- !ruby/object:Gem::Version
|
83
89
|
version: 1.1.0
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.1.0
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
prerelease: false
|
84
98
|
type: :development
|
85
|
-
version_requirements: *id004
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
99
|
name: rspec
|
88
|
-
|
89
|
-
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ~>
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '2.8'
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
90
107
|
none: false
|
91
|
-
requirements:
|
108
|
+
requirements:
|
92
109
|
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
- 8
|
98
|
-
- 0
|
99
|
-
version: 2.8.0
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '2.8'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
prerelease: false
|
100
114
|
type: :development
|
101
|
-
version_requirements: *id005
|
102
|
-
- !ruby/object:Gem::Dependency
|
103
115
|
name: sqlite3
|
104
|
-
|
105
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
117
|
none: false
|
107
|
-
requirements:
|
118
|
+
requirements:
|
108
119
|
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
hash: 17
|
111
|
-
segments:
|
112
|
-
- 1
|
113
|
-
- 3
|
114
|
-
- 5
|
120
|
+
- !ruby/object:Gem::Version
|
115
121
|
version: 1.3.5
|
116
|
-
|
117
|
-
version_requirements: *id006
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
name: ruby-debug
|
120
|
-
prerelease: false
|
121
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
122
|
+
requirement: !ruby/object:Gem::Requirement
|
122
123
|
none: false
|
123
|
-
requirements:
|
124
|
+
requirements:
|
124
125
|
- - ~>
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
- 10
|
130
|
-
- 4
|
131
|
-
version: 0.10.4
|
132
|
-
type: :development
|
133
|
-
version_requirements: *id007
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 1.3.5
|
134
128
|
description: Allows a single Rails appliation to access many different databases
|
135
129
|
email: developers@crystalcommerce.com
|
136
130
|
executables: []
|
137
|
-
|
138
131
|
extensions: []
|
139
|
-
|
140
|
-
extra_rdoc_files:
|
132
|
+
extra_rdoc_files:
|
141
133
|
- README.rdoc
|
142
|
-
files:
|
134
|
+
files:
|
143
135
|
- Gemfile
|
144
136
|
- Gemfile.lock
|
145
137
|
- MIT-LICENSE
|
146
138
|
- README.rdoc
|
147
139
|
- Rakefile
|
148
|
-
- VERSION
|
149
140
|
- example_root_schema.rb
|
150
|
-
-
|
151
|
-
- init.rb
|
152
|
-
- install.rb
|
141
|
+
- dbhijacker.gemspec
|
153
142
|
- lib/dbhijacker.rb
|
154
143
|
- lib/hijacker.rb
|
155
144
|
- lib/hijacker/active_record_ext.rb
|
@@ -165,41 +154,32 @@ files:
|
|
165
154
|
- spec/hijacker_spec.rb
|
166
155
|
- spec/spec_helper.rb
|
167
156
|
- tasks/hijacker_tasks.rake
|
168
|
-
- uninstall.rb
|
169
157
|
homepage: https://github.com/crystalcommerce/hijacker
|
170
158
|
licenses: []
|
171
|
-
|
172
159
|
post_install_message:
|
173
|
-
rdoc_options:
|
160
|
+
rdoc_options:
|
174
161
|
- --charset=UTF-8
|
175
|
-
require_paths:
|
162
|
+
require_paths:
|
176
163
|
- lib
|
177
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
178
165
|
none: false
|
179
|
-
requirements:
|
180
|
-
- -
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
|
183
|
-
|
184
|
-
- 0
|
185
|
-
version: "0"
|
186
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ! '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
171
|
none: false
|
188
|
-
requirements:
|
189
|
-
- -
|
190
|
-
- !ruby/object:Gem::Version
|
191
|
-
|
192
|
-
segments:
|
193
|
-
- 0
|
194
|
-
version: "0"
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
195
176
|
requirements: []
|
196
|
-
|
197
177
|
rubyforge_project:
|
198
|
-
rubygems_version: 1.8.
|
178
|
+
rubygems_version: 1.8.25
|
199
179
|
signing_key:
|
200
180
|
specification_version: 3
|
201
181
|
summary: One application, multiple client databases
|
202
|
-
test_files:
|
182
|
+
test_files:
|
203
183
|
- spec/hijacker/alias_spec.rb
|
204
184
|
- spec/hijacker/database_spec.rb
|
205
185
|
- spec/hijacker/host_spec.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.0
|
data/init.rb
DELETED
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|