motel-activerecord 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d63d3217db37313c2fdf0ea05beddecf96829775
4
- data.tar.gz: 51ec95575f6533064f49b0fd1938682108120e2c
3
+ metadata.gz: cf8d15a90723e29a1cfd4fb21f02d210036bb734
4
+ data.tar.gz: 22560e25d8808e51fbe7e3b2d3c043505f2201a5
5
5
  SHA512:
6
- metadata.gz: 3fdd2eb7bf0b8673feae3601c02081ab91bbc52eed684ec1cee07cda7f1a7c09ec1e50345ce0167e6dba11dea7786936503ffcf17b99d1f588014730f4eb65e5
7
- data.tar.gz: bf6799396a47d73b5c0fb00c7b47f70d833c84223c9504ba006874ea31f4a732484f133ad39b6afa14e114e1e61a635836522601cabef6d5d212eb284a0db517
6
+ metadata.gz: 8256b2e4a4465f010539b44511201a01091ffce29355079ef03e94cfc2088a7701976cf88da044a37d571fa4810340db86c465e45c81b463999548b17dad4a0d
7
+ data.tar.gz: 69df363fa7a2d08471cc4ea2ff6a4fe59ed74497ecad0ba1527c75c2d477761a8d2bb09f6b6a02073a9abb0bc2daf669c7c24c1f24ca06049789f1ee81cfad9b
data/README.md CHANGED
@@ -26,8 +26,13 @@ gem 'motel-activerecord'
26
26
  and run `bundle install` from your shell.
27
27
 
28
28
  # Supported Ruby and Rails versions
29
+
29
30
  The gem motel-activerecord supports MRI Ruby 2.0 or greater and Rails 4.0 or greater.
30
-
31
+
32
+ # SemVer
33
+
34
+ This gem is based on the [Semantic Versioning](http://semver.org/).
35
+
31
36
  # Configuration
32
37
 
33
38
  ## Use with Rails
@@ -69,10 +74,10 @@ are showed below:
69
74
  | sockect | String |
70
75
  | port | Integer |
71
76
  | pool | Integer |
72
- | host | Integer |
73
- | username | Integer |
74
- | password | Integer |
75
- | database | Integer |
77
+ | host | String |
78
+ | username | String |
79
+ | password | String |
80
+ | database | String |
76
81
  | url | String |
77
82
 
78
83
 
@@ -113,6 +118,7 @@ Note: The methods like `add_tenant`, `update_tenant` and
113
118
  `delete_tenant` dosen't store permanently tenants.
114
119
 
115
120
  ### Use rake task
121
+
116
122
  Set the `TENANT` environment variable to run the rake task on a
117
123
  specific tenant.
118
124
 
@@ -156,10 +162,10 @@ config.motel.nonexistent_tenant_page = 'new_path'
156
162
  ### Specifying the source of tenants
157
163
 
158
164
  You can set the source of the tenants in the same way as with Rails,
159
- use the method `tenants_source_configurations` of `ActiveRecord::Base.motel`:
165
+ use the method `tenants_source_configurations` of `Motel::Manager`:
160
166
 
161
167
  ```ruby
162
- ActiveRecord::Base.motel.tenants_source_configurations({
168
+ Motel::Manager.tenants_source_configurations({
163
169
  source: :database,
164
170
  source_spec: { adapter: 'sqlite3', database: 'db/tenants.sqlite3' },
165
171
  table_name: 'tenant'
@@ -169,66 +175,79 @@ ActiveRecord::Base.motel.tenants_source_configurations({
169
175
  # Available methods
170
176
 
171
177
  Set a tenats source configurations
178
+
172
179
  ```ruby
173
- ActiveRecord::Base.motel.tenants_source_configurations(config)
180
+ Motel::Manager.tenants_source_configurations(config)
174
181
  ```
175
182
 
176
183
  Set the admission criteria for the middleware
184
+
177
185
  ```ruby
178
- ActiveRecord::Base.motel.admission_criteria
186
+ Motel::Manager.admission_criteria
179
187
  ```
180
188
 
181
189
  Set a default tenant
190
+
182
191
  ```ruby
183
- ActiveRecord::Base.motel.default_tenant
192
+ Motel::Manager.default_tenant
184
193
  ```
185
194
 
186
195
  Set the html page to show if tenant doesn't exist
196
+
187
197
  ```ruby
188
- ActiveRecord::Base.motel.nonexistent_tenant_page
198
+ Motel::Manager.nonexistent_tenant_page
189
199
  ```
190
200
 
191
201
  Set a current tenant
202
+
192
203
  ```ruby
193
- ActiveRecord::Base.motel.current_tenant
204
+ Motel::Manager.current_tenant
194
205
  ```
195
206
 
196
207
  Retrieve the connection details of all tenants
208
+
197
209
  ```ruby
198
- ActiveRecord::Base.motel.tenants
210
+ Motel::Manager.tenants
199
211
  ```
200
212
 
201
213
  Retrieve a tenant
214
+
202
215
  ```ruby
203
- ActiveRecord::Base.motel.tenant(name)
216
+ Motel::Manager.tenant(name)
204
217
  ```
205
218
 
206
219
  Determine if a tenant exists
220
+
207
221
  ```ruby
208
- ActiveRecord::Base.motel.tenant?(name)
222
+ Motel::Manager.tenant?(name)
209
223
  ```
210
224
 
211
225
  Add tenant
226
+
212
227
  ```ruby
213
- ActiveRecord::Base.motel.add_tenant(name, spec)
228
+ Motel::Manager.add_tenant(name, spec)
214
229
  ```
215
230
 
216
231
  Update tenant
232
+
217
233
  ```ruby
218
- ActiveRecord::Base.motel.update_tenant(name, spec)
234
+ Motel::Manager.update_tenant(name, spec)
219
235
  ```
220
236
 
221
237
  Delete tenant
238
+
222
239
  ```ruby
223
- ActiveRecord::Base.motel.delete_tenant(name)
240
+ Motel::Manager.delete_tenant(name)
224
241
  ```
225
242
 
226
243
  Retrieve the names of the tenants of active connections
244
+
227
245
  ```ruby
228
- ActiveRecord::Base.motel.active_tenants
246
+ Motel::Manager.active_tenants
229
247
  ```
230
248
 
231
249
  Determine the tenant to use for the connection
250
+
232
251
  ```ruby
233
- ActiveRecord::Base.motel.determines_tenant
252
+ Motel::Manager.determines_tenant
234
253
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 2.0.0
data/lib/motel/lobby.rb CHANGED
@@ -14,17 +14,17 @@ module Motel
14
14
  name = tenant_name(request)
15
15
 
16
16
  if name
17
- if ActiveRecord::Base.motel.tenant?(name)
18
- ActiveRecord::Base.motel.current_tenant = name
17
+ if Motel::Manager.tenant?(name)
18
+ Motel::Manager.current_tenant = name
19
19
  @app.call(env)
20
20
  else
21
- path = ActiveRecord::Base.motel.nonexistent_tenant_page
21
+ path = Motel::Manager.nonexistent_tenant_page
22
22
  file = File.expand_path(path) if path
23
23
  body = (File.exists?(file.to_s)) ? File.read(file) : "Nonexistent #{name} tenant"
24
24
  [404, {"Content-Type" => "text/html", "Content-Length" => body.size.to_s}, [body]]
25
25
  end
26
26
  else
27
- ActiveRecord::Base.motel.current_tenant = nil
27
+ Motel::Manager.current_tenant = nil
28
28
  @app.call(env)
29
29
  end
30
30
  end
@@ -32,8 +32,8 @@ module Motel
32
32
  private
33
33
 
34
34
  def tenant_name(request)
35
- if ActiveRecord::Base.motel.admission_criteria
36
- regex = Regexp.new(ActiveRecord::Base.motel.admission_criteria)
35
+ if Motel::Manager.admission_criteria
36
+ regex = Regexp.new(Motel::Manager.admission_criteria)
37
37
  name = request.path.match(regex)
38
38
  name[1] if name
39
39
  else
@@ -4,16 +4,14 @@ module Motel
4
4
 
5
5
  included do
6
6
 
7
- mattr_accessor :motel, instance_writer: false
8
7
  self.default_connection_handler = ConnectionAdapters::ConnectionHandler.new
9
- self.motel = Manager
10
8
 
11
9
  end
12
10
 
13
11
  module ClassMethods
14
12
 
15
13
  def establish_connection(config)
16
- resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(motel.tenants)
14
+ resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(Motel::Manager.tenants)
17
15
  spec = resolver.spec(config)
18
16
  connection_handler.establish_connection (ENV['TENANT'] || self.name), spec
19
17
  end
@@ -39,7 +37,7 @@ module Motel
39
37
  end
40
38
 
41
39
  def current_tenant
42
- motel.determines_tenant or raise Motel::NoCurrentTenantError
40
+ Motel::Manager.determines_tenant or raise Motel::NoCurrentTenantError
43
41
  end
44
42
 
45
43
  end
data/lib/motel/railtie.rb CHANGED
@@ -39,7 +39,7 @@ module Motel
39
39
  end
40
40
 
41
41
  initializer "motel.configure_middleware" do |app|
42
- unless Rails.application.config.motel.disable_middleware
42
+ if !Rails.application.config.motel.disable_middleware && (Rails.env != 'test')
43
43
  app.config.middleware.insert_before ActiveRecord::Migration::CheckPending, Lobby
44
44
  end
45
45
  end
@@ -49,7 +49,7 @@ module Motel
49
49
 
50
50
  ActiveSupport.on_load(:active_record) do
51
51
  ActionDispatch::Reloader.send(hook) do
52
- if ActiveRecord::Base.motel.active_tenants.any?
52
+ if Motel::Manager.active_tenants.any?
53
53
  ActiveRecord::Base.clear_reloadable_connections!
54
54
  ActiveRecord::Base.clear_cache!
55
55
  end
@@ -77,7 +77,7 @@ describe Motel::ConnectionAdapters::ConnectionSpecification::Resolver do
77
77
  context 'string as a url' do
78
78
 
79
79
  before(:all) do
80
- @url = 'mysql2://foo:foobar_password@localhost:3306/foobar'
80
+ @url = 'sqlite3://foo:foobar_password@localhost:3306/foobar'
81
81
  end
82
82
 
83
83
  it 'returns an instance of ConnectionSpecification' do
@@ -87,7 +87,7 @@ describe Motel::ConnectionAdapters::ConnectionSpecification::Resolver do
87
87
  end
88
88
 
89
89
  it 'spec of connection specifications contains a correct adapter' do
90
- expect(@resolver.spec(@url).config[:adapter]).to eq 'mysql2'
90
+ expect(@resolver.spec(@url).config[:adapter]).to eq 'sqlite3'
91
91
  end
92
92
 
93
93
  it 'spec of connection specifications contains a correct username' do
@@ -13,13 +13,13 @@ describe Motel::Lobby do
13
13
  end
14
14
 
15
15
  before(:all) do
16
- ActiveRecord::Base.motel.add_tenant('foo', FOO_SPEC)
16
+ Motel::Manager.add_tenant('foo', FOO_SPEC)
17
17
  end
18
18
 
19
19
  after(:all) do
20
- ActiveRecord::Base.motel.delete_tenant('foo')
21
- ActiveRecord::Base.motel.admission_criteria = nil #sets default
22
- ActiveRecord::Base.motel.nonexistent_tenant_page = nil #sets default
20
+ Motel::Manager.delete_tenant('foo')
21
+ Motel::Manager.admission_criteria = nil #sets default
22
+ Motel::Manager.nonexistent_tenant_page = nil #sets default
23
23
  end
24
24
 
25
25
  describe '#call' do
@@ -27,7 +27,7 @@ describe Motel::Lobby do
27
27
  context 'default admission criteria' do
28
28
 
29
29
  before(:all) do
30
- ActiveRecord::Base.motel.admission_criteria = nil
30
+ Motel::Manager.admission_criteria = nil
31
31
  end
32
32
 
33
33
  context 'url match' do
@@ -41,7 +41,7 @@ describe Motel::Lobby do
41
41
  it 'sets the current tenant' do
42
42
  request @url
43
43
 
44
- expect(ActiveRecord::Base.motel.current_tenant).to eq 'foo'
44
+ expect(Motel::Manager.current_tenant).to eq 'foo'
45
45
  end
46
46
 
47
47
  it 'response is ok' do
@@ -67,7 +67,7 @@ describe Motel::Lobby do
67
67
  context 'with default nonexistent tenant message' do
68
68
 
69
69
  it 'returns default message on body' do
70
- ActiveRecord::Base.motel.nonexistent_tenant_page = nil
70
+ Motel::Manager.nonexistent_tenant_page = nil
71
71
  request @url
72
72
 
73
73
  expect(last_response.body).to eq "Nonexistent bar tenant"
@@ -83,7 +83,7 @@ describe Motel::Lobby do
83
83
  file.write(message)
84
84
  file.close
85
85
 
86
- ActiveRecord::Base.motel.nonexistent_tenant_page = file.path
86
+ Motel::Manager.nonexistent_tenant_page = file.path
87
87
  request @url
88
88
 
89
89
  expect(last_response.body).to eq message
@@ -102,7 +102,7 @@ describe Motel::Lobby do
102
102
  context 'specifying admission criteria' do
103
103
 
104
104
  before(:all) do
105
- ActiveRecord::Base.motel.admission_criteria = 'tenants\/(\w*)'
105
+ Motel::Manager.admission_criteria = 'tenants\/(\w*)'
106
106
  end
107
107
 
108
108
  context 'url match' do
@@ -116,7 +116,7 @@ describe Motel::Lobby do
116
116
  it 'sets the current tenant' do
117
117
  request @url
118
118
 
119
- expect(ActiveRecord::Base.motel.current_tenant).to eq 'foo'
119
+ expect(Motel::Manager.current_tenant).to eq 'foo'
120
120
  end
121
121
 
122
122
  it 'response is ok' do
@@ -138,7 +138,7 @@ describe Motel::Lobby do
138
138
  it 'sets null the current tenant' do
139
139
  request @url
140
140
 
141
- expect(ActiveRecord::Base.motel.current_tenant).to be_nil
141
+ expect(Motel::Manager.current_tenant).to be_nil
142
142
  end
143
143
 
144
144
  it 'response is ok' do
@@ -3,21 +3,21 @@ require 'spec_helper'
3
3
  describe ActiveRecord::Base do
4
4
 
5
5
  before(:all) do
6
- ActiveRecord::Base.motel.tenants_source_configurations({source: :default})
7
- ActiveRecord::Base.motel.add_tenant('foo', FOO_SPEC)
8
- ActiveRecord::Base.motel.add_tenant('bar', BAR_SPEC)
6
+ Motel::Manager.tenants_source_configurations({source: :default})
7
+ Motel::Manager.add_tenant('foo', FOO_SPEC)
8
+ Motel::Manager.add_tenant('bar', BAR_SPEC)
9
9
  end
10
10
 
11
11
  after(:all) do
12
- ActiveRecord::Base.motel.delete_tenant('foo')
13
- ActiveRecord::Base.motel.delete_tenant('bar')
12
+ Motel::Manager.delete_tenant('foo')
13
+ Motel::Manager.delete_tenant('bar')
14
14
  end
15
15
 
16
16
  after(:each) do
17
17
  ActiveRecord::Base.connection_handler.active_tenants do |tenant|
18
18
  ActiveRecord::Base.connection_handler.remove_connection(tenant)
19
19
  end
20
- ActiveRecord::Base.motel.current_tenant = nil
20
+ Motel::Manager.current_tenant = nil
21
21
  end
22
22
 
23
23
  describe '.establish_connection' do
@@ -35,7 +35,7 @@ describe ActiveRecord::Base do
35
35
  context 'current tenant established' do
36
36
 
37
37
  it 'returns a connection pool of current tenant' do
38
- ActiveRecord::Base.motel.current_tenant = 'foo'
38
+ Motel::Manager.current_tenant = 'foo'
39
39
  pool = ActiveRecord::Base.connection_handler.establish_connection('foo')
40
40
 
41
41
  expect(ActiveRecord::Base.connection_pool).to eq pool
@@ -46,7 +46,7 @@ describe ActiveRecord::Base do
46
46
  context 'current tenant not established' do
47
47
 
48
48
  it 'rises an error' do
49
- ActiveRecord::Base.motel.current_tenant = nil
49
+ Motel::Manager.current_tenant = nil
50
50
  expect{ActiveRecord::Base.connection_pool}.to raise_error Motel::NoCurrentTenantError
51
51
  end
52
52
 
@@ -59,7 +59,7 @@ describe ActiveRecord::Base do
59
59
  context 'current tenant established' do
60
60
 
61
61
  it 'returns a connection of current tenant' do
62
- ActiveRecord::Base.motel.current_tenant = 'foo'
62
+ Motel::Manager.current_tenant = 'foo'
63
63
  pool = ActiveRecord::Base.connection_handler.establish_connection('foo')
64
64
 
65
65
  expect(ActiveRecord::Base.retrieve_connection).to eq pool.connection
@@ -70,7 +70,7 @@ describe ActiveRecord::Base do
70
70
  context 'current tenant not established' do
71
71
 
72
72
  it 'rises an error' do
73
- ActiveRecord::Base.motel.current_tenant = nil
73
+ Motel::Manager.current_tenant = nil
74
74
  expect{ActiveRecord::Base.retrieve_connection}.to raise_error Motel::NoCurrentTenantError
75
75
  end
76
76
 
@@ -87,12 +87,12 @@ describe ActiveRecord::Base do
87
87
  context 'current tenant established' do
88
88
 
89
89
  it 'returns true' do
90
- ActiveRecord::Base.motel.current_tenant = 'foo'
90
+ Motel::Manager.current_tenant = 'foo'
91
91
  expect(ActiveRecord::Base.connected?).to be_true
92
92
  end
93
93
 
94
94
  it 'returns false' do
95
- ActiveRecord::Base.motel.current_tenant = 'bar'
95
+ Motel::Manager.current_tenant = 'bar'
96
96
  expect(ActiveRecord::Base.connected?).to be_false
97
97
  end
98
98
 
@@ -101,7 +101,7 @@ describe ActiveRecord::Base do
101
101
  context 'current tenant not established' do
102
102
 
103
103
  it 'rises an error' do
104
- ActiveRecord::Base.motel.current_tenant = nil
104
+ Motel::Manager.current_tenant = nil
105
105
  expect{ActiveRecord::Base.connected?}.to raise_error Motel::NoCurrentTenantError
106
106
  end
107
107
 
@@ -115,7 +115,7 @@ describe ActiveRecord::Base do
115
115
 
116
116
  it 'removes connection' do
117
117
  ActiveRecord::Base.connection_handler.establish_connection('foo')
118
- ActiveRecord::Base.motel.current_tenant = 'foo'
118
+ Motel::Manager.current_tenant = 'foo'
119
119
  ActiveRecord::Base.remove_connection
120
120
  expect(ActiveRecord::Base.connection_handler.active_tenants).not_to include('foo')
121
121
  end
@@ -125,7 +125,7 @@ describe ActiveRecord::Base do
125
125
  context 'current tenant not established' do
126
126
 
127
127
  it 'rises an error' do
128
- ActiveRecord::Base.motel.current_tenant = nil
128
+ Motel::Manager.current_tenant = nil
129
129
  expect{ActiveRecord::Base.remove_connection}.to raise_error Motel::NoCurrentTenantError
130
130
  end
131
131
 
@@ -146,7 +146,7 @@ describe ActiveRecord::Base do
146
146
  context 'tenant enviroment variable or current tenant or default tenant are set' do
147
147
 
148
148
  it 'returns the current tenant' do
149
- ActiveRecord::Base.motel.current_tenant = 'foo'
149
+ Motel::Manager.current_tenant = 'foo'
150
150
 
151
151
  expect(ActiveRecord::Base.current_tenant).to eq 'foo'
152
152
  end
@@ -156,7 +156,7 @@ describe ActiveRecord::Base do
156
156
  context 'no tenant has been established' do
157
157
 
158
158
  it 'rises an error' do
159
- ActiveRecord::Base.motel.current_tenant = nil
159
+ Motel::Manager.current_tenant = nil
160
160
 
161
161
  expect{ActiveRecord::Base.current_tenant}.to raise_error Motel::NoCurrentTenantError
162
162
  end
File without changes
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motel-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Martínez Valdelamar
@@ -14,64 +14,72 @@ dependencies:
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
- - - <=
21
- - !ruby/object:Gem::Version
22
- version: '5.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - '>='
24
+ - - ~>
28
25
  - !ruby/object:Gem::Version
29
26
  version: '4.0'
30
- - - <=
31
- - !ruby/object:Gem::Version
32
- version: '5.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: activesupport
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - '>='
31
+ - - ~>
38
32
  - !ruby/object:Gem::Version
39
- version: '0'
33
+ version: '4.0'
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - '>='
38
+ - - ~>
45
39
  - !ruby/object:Gem::Version
46
- version: '0'
40
+ version: '4.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: redis
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
- - - '>='
45
+ - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: 3.0.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
- - - '>='
52
+ - - ~>
59
53
  - !ruby/object:Gem::Version
60
- version: '0'
54
+ version: 3.0.0
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: rspec
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - '>='
59
+ - - ~>
66
60
  - !ruby/object:Gem::Version
67
- version: '0'
61
+ version: 1.3.0
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
- - - '>='
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
73
74
  - !ruby/object:Gem::Version
74
- version: '0'
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
75
83
  description: ActiveRecord extension to use connections to multiple databases
76
84
  email: dimarva.90@gmail.com
77
85
  executables: []
@@ -79,31 +87,33 @@ extensions: []
79
87
  extra_rdoc_files: []
80
88
  files:
81
89
  - lib/motel-activerecord.rb
82
- - lib/motel/version.rb
83
- - lib/motel/lobby.rb
90
+ - lib/motel/manager.rb
91
+ - lib/motel/sources.rb
92
+ - lib/motel/railtie.rb
93
+ - lib/motel/sources/database.rb
94
+ - lib/motel/sources/default.rb
95
+ - lib/motel/sources/redis.rb
84
96
  - lib/motel/errors.rb
97
+ - lib/motel/version.rb
98
+ - lib/motel/connection_adapters.rb
99
+ - lib/motel/multi_tenant.rb
100
+ - lib/motel/connection_adapters/connection_specification/resolver.rb
85
101
  - lib/motel/connection_adapters/connection_specification.rb
86
102
  - lib/motel/connection_adapters/connection_handler.rb
87
- - lib/motel/connection_adapters/connection_specification/resolver.rb
88
- - lib/motel/multi_tenant.rb
89
- - lib/motel/connection_adapters.rb
90
- - lib/motel/sources.rb
91
- - lib/motel/sources/redis.rb
92
- - lib/motel/sources/default.rb
93
- - lib/motel/sources/database.rb
94
- - lib/motel/railtie.rb
95
- - lib/motel/manager.rb
103
+ - lib/motel/lobby.rb
96
104
  - VERSION
97
105
  - README.md
98
- - spec/lib/motel/multi_tenant_spec.rb
99
- - spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
100
- - spec/lib/motel/connection_adapters/connection_handler_spec.rb
101
- - spec/lib/motel/sources/database_spec.rb
106
+ - spec/tmp/foo.sqlite3
107
+ - spec/tmp/tenants.sqlite3
108
+ - spec/spec_helper.rb
102
109
  - spec/lib/motel/sources/default_spec.rb
110
+ - spec/lib/motel/sources/database_spec.rb
103
111
  - spec/lib/motel/sources/redis_spec.rb
112
+ - spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
113
+ - spec/lib/motel/connection_adapters/connection_handler_spec.rb
114
+ - spec/lib/motel/multi_tenant_spec.rb
104
115
  - spec/lib/motel/lobby_spec.rb
105
116
  - spec/lib/motel/manager_spec.rb
106
- - spec/spec_helper.rb
107
117
  homepage: https://github.com/dimarval/motel-activerecord
108
118
  licenses:
109
119
  - MIT
@@ -114,9 +124,9 @@ require_paths:
114
124
  - lib
115
125
  required_ruby_version: !ruby/object:Gem::Requirement
116
126
  requirements:
117
- - - '>='
127
+ - - ~>
118
128
  - !ruby/object:Gem::Version
119
- version: '0'
129
+ version: '2.0'
120
130
  required_rubygems_version: !ruby/object:Gem::Requirement
121
131
  requirements:
122
132
  - - '>='
@@ -129,12 +139,14 @@ signing_key:
129
139
  specification_version: 4
130
140
  summary: Multi-tenant gem
131
141
  test_files:
132
- - spec/lib/motel/multi_tenant_spec.rb
133
- - spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
134
- - spec/lib/motel/connection_adapters/connection_handler_spec.rb
135
- - spec/lib/motel/sources/database_spec.rb
142
+ - spec/tmp/foo.sqlite3
143
+ - spec/tmp/tenants.sqlite3
144
+ - spec/spec_helper.rb
136
145
  - spec/lib/motel/sources/default_spec.rb
146
+ - spec/lib/motel/sources/database_spec.rb
137
147
  - spec/lib/motel/sources/redis_spec.rb
148
+ - spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
149
+ - spec/lib/motel/connection_adapters/connection_handler_spec.rb
150
+ - spec/lib/motel/multi_tenant_spec.rb
138
151
  - spec/lib/motel/lobby_spec.rb
139
152
  - spec/lib/motel/manager_spec.rb
140
- - spec/spec_helper.rb