ros-apartment 3.0.4 → 3.1.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
  SHA256:
3
- metadata.gz: d65efc6c04fa15ba20b2cc39f72d586b5dc338e74d7c9ee72efc5a2e4c0442ae
4
- data.tar.gz: ac6292feee7f151d735a7193a5795c37fe139e340bb795595936192752c406ee
3
+ metadata.gz: 2494257d1e615c2ef2e79647f3d5b62762dec8c51af19f2c5fe352b01572e752
4
+ data.tar.gz: 23b24db12c93d35cf10e34e1c71455a6fe05c9afe162dca6de5115212cb052b7
5
5
  SHA512:
6
- metadata.gz: 400c31dce7d56979a3781932cfce1466d56c001c1a37d469f2580a8ac1d7be65de0f6671a6c56fd623a10f9e4cc0b0dc201e14d4b1a354b5bc97d84f3fb21441
7
- data.tar.gz: e27b4ff8f0bce850f733824ce57c766aa2a3e70d048106e260af582c9957e0166e3da6ffd8cd223e3519663a7343e52630c2c391363b6d6a72d312b417ad27f7
6
+ metadata.gz: e13fe607631fe0953b16ec42a64ba162deb3fc1522b70ac09b152acbc47b6bebd63a25cc35a6873a3190304de40166f89e9782ceced0259932116739890526f2
7
+ data.tar.gz: 035b1b87cdf43f463a6895981d63100a238a2a8b3ad0e0b529d74fa261f6138005e0f5aecd425e857d9ba10ee11c613cb8d6b3002cd35484b34b58f4df367e9a
data/.rubocop_todo.yml CHANGED
@@ -207,6 +207,7 @@ RSpec/ExampleWording:
207
207
  RSpec/FilePath:
208
208
  Exclude:
209
209
  - 'spec/adapters/mysql2_adapter_spec.rb'
210
+ - 'spec/adapters/trilogy_adapter_spec.rb'
210
211
  - 'spec/adapters/postgresql_adapter_spec.rb'
211
212
  - 'spec/adapters/sqlite3_adapter_spec.rb'
212
213
  - 'spec/tenant_spec.rb'
@@ -292,6 +293,7 @@ RSpec/MultipleExpectations:
292
293
  RSpec/NamedSubject:
293
294
  Exclude:
294
295
  - 'spec/adapters/mysql2_adapter_spec.rb'
296
+ - 'spec/adapters/trilogy_adapter_spec.rb'
295
297
  - 'spec/adapters/sqlite3_adapter_spec.rb'
296
298
  - 'spec/support/contexts.rb'
297
299
  - 'spec/support/requirements.rb'
@@ -315,6 +317,7 @@ RSpec/NoExpectationExample:
315
317
  RSpec/SpecFilePathFormat:
316
318
  Exclude:
317
319
  - 'spec/adapters/mysql2_adapter_spec.rb'
320
+ - 'spec/adapters/trilogy_adapter_spec.rb'
318
321
  - 'spec/adapters/postgresql_adapter_spec.rb'
319
322
  - 'spec/adapters/sqlite3_adapter_spec.rb'
320
323
  - 'spec/tenant_spec.rb'
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'apartment/adapters/mysql2_adapter'
4
+
5
+ module Apartment
6
+ # Helper module to decide wether to use trilogy adapter or trilogy adapter with schemas
7
+ module Tenant
8
+ def self.trilogy_adapter(config)
9
+ if Apartment.use_schemas
10
+ Adapters::TrilogySchemaAdapter.new(config)
11
+ else
12
+ Adapters::TrilogyAdapter.new(config)
13
+ end
14
+ end
15
+ end
16
+
17
+ module Adapters
18
+ class TrilogyAdapter < Mysql2Adapter
19
+ protected
20
+
21
+ def rescue_from
22
+ Trilogy::Error
23
+ end
24
+ end
25
+
26
+ class TrilogySchemaAdapter < Mysql2SchemaAdapter
27
+ end
28
+ end
29
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Apartment
4
- VERSION = '3.0.4'
4
+ VERSION = '3.1.0'
5
5
  end
@@ -60,5 +60,6 @@ Gem::Specification.new do |s|
60
60
  s.add_development_dependency 'mysql2', '~> 0.5'
61
61
  s.add_development_dependency 'pg', '~> 1.5'
62
62
  s.add_development_dependency 'sqlite3', '< 2.0'
63
+ s.add_development_dependency 'trilogy', '< 3.0'
63
64
  end
64
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ros-apartment
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-05-24 00:00:00.000000000 Z
13
+ date: 2024-05-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -302,6 +302,20 @@ dependencies:
302
302
  - - "<"
303
303
  - !ruby/object:Gem::Version
304
304
  version: '2.0'
305
+ - !ruby/object:Gem::Dependency
306
+ name: trilogy
307
+ requirement: !ruby/object:Gem::Requirement
308
+ requirements:
309
+ - - "<"
310
+ - !ruby/object:Gem::Version
311
+ version: '3.0'
312
+ type: :development
313
+ prerelease: false
314
+ version_requirements: !ruby/object:Gem::Requirement
315
+ requirements:
316
+ - - "<"
317
+ - !ruby/object:Gem::Version
318
+ version: '3.0'
305
319
  description: Apartment allows Rack applications to deal with database multitenancy
306
320
  through ActiveRecord
307
321
  email:
@@ -337,6 +351,7 @@ files:
337
351
  - lib/apartment/adapters/postgis_adapter.rb
338
352
  - lib/apartment/adapters/postgresql_adapter.rb
339
353
  - lib/apartment/adapters/sqlite3_adapter.rb
354
+ - lib/apartment/adapters/trilogy_adapter.rb
340
355
  - lib/apartment/console.rb
341
356
  - lib/apartment/custom_console.rb
342
357
  - lib/apartment/deprecation.rb