ros-apartment 2.4.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/.rubocop_todo.yml +1 -1
  4. data/.story_branch.yml +1 -0
  5. data/.travis.yml +13 -30
  6. data/Appraisals +4 -17
  7. data/Gemfile +2 -2
  8. data/Guardfile +3 -1
  9. data/HISTORY.md +90 -0
  10. data/README.md +31 -16
  11. data/Rakefile +34 -22
  12. data/TODO.md +0 -1
  13. data/gemfiles/rails_5_0.gemfile +10 -11
  14. data/gemfiles/rails_5_1.gemfile +10 -11
  15. data/gemfiles/rails_5_2.gemfile +9 -10
  16. data/gemfiles/rails_6_0.gemfile +10 -11
  17. data/gemfiles/rails_master.gemfile +10 -11
  18. data/lib/apartment.rb +31 -13
  19. data/lib/apartment/active_record/connection_handling.rb +17 -0
  20. data/lib/apartment/active_record/internal_metadata.rb +11 -0
  21. data/lib/apartment/active_record/log_subscriber.rb +41 -0
  22. data/lib/apartment/active_record/schema_migration.rb +13 -0
  23. data/lib/apartment/adapters/abstract_adapter.rb +17 -13
  24. data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +9 -4
  25. data/lib/apartment/adapters/mysql2_adapter.rb +2 -0
  26. data/lib/apartment/adapters/postgresql_adapter.rb +33 -4
  27. data/lib/apartment/adapters/sqlite3_adapter.rb +2 -0
  28. data/lib/apartment/console.rb +7 -0
  29. data/lib/apartment/custom_console.rb +23 -7
  30. data/lib/apartment/model.rb +27 -0
  31. data/lib/apartment/railtie.rb +19 -15
  32. data/lib/apartment/tasks/task_helper.rb +35 -0
  33. data/lib/apartment/tenant.rb +16 -5
  34. data/lib/apartment/version.rb +1 -1
  35. data/lib/generators/apartment/install/templates/apartment.rb +5 -0
  36. data/lib/tasks/apartment.rake +16 -37
  37. data/{apartment.gemspec → ros-apartment.gemspec} +12 -6
  38. metadata +16 -213
  39. data/.github/workflows/.rubocop-linter.yml +0 -22
  40. data/spec/adapters/jdbc_mysql_adapter_spec.rb +0 -20
  41. data/spec/adapters/jdbc_postgresql_adapter_spec.rb +0 -39
  42. data/spec/adapters/mysql2_adapter_spec.rb +0 -61
  43. data/spec/adapters/postgresql_adapter_spec.rb +0 -63
  44. data/spec/adapters/sqlite3_adapter_spec.rb +0 -101
  45. data/spec/apartment_spec.rb +0 -13
  46. data/spec/config/database.yml.sample +0 -49
  47. data/spec/dummy/Rakefile +0 -7
  48. data/spec/dummy/app/controllers/application_controller.rb +0 -7
  49. data/spec/dummy/app/helpers/application_helper.rb +0 -4
  50. data/spec/dummy/app/models/application_record.rb +0 -6
  51. data/spec/dummy/app/models/company.rb +0 -5
  52. data/spec/dummy/app/models/user.rb +0 -5
  53. data/spec/dummy/app/views/application/index.html.erb +0 -1
  54. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  55. data/spec/dummy/config.ru +0 -6
  56. data/spec/dummy/config/application.rb +0 -51
  57. data/spec/dummy/config/boot.rb +0 -13
  58. data/spec/dummy/config/database.yml.sample +0 -44
  59. data/spec/dummy/config/environment.rb +0 -7
  60. data/spec/dummy/config/environments/development.rb +0 -29
  61. data/spec/dummy/config/environments/production.rb +0 -53
  62. data/spec/dummy/config/environments/test.rb +0 -36
  63. data/spec/dummy/config/initializers/apartment.rb +0 -6
  64. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -8
  65. data/spec/dummy/config/initializers/inflections.rb +0 -11
  66. data/spec/dummy/config/initializers/mime_types.rb +0 -6
  67. data/spec/dummy/config/initializers/secret_token.rb +0 -9
  68. data/spec/dummy/config/initializers/session_store.rb +0 -10
  69. data/spec/dummy/config/locales/en.yml +0 -5
  70. data/spec/dummy/config/routes.rb +0 -5
  71. data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +0 -39
  72. data/spec/dummy/db/migrate/20111202022214_create_table_books.rb +0 -14
  73. data/spec/dummy/db/migrate/20180415260934_create_public_tokens.rb +0 -13
  74. data/spec/dummy/db/schema.rb +0 -55
  75. data/spec/dummy/db/seeds.rb +0 -5
  76. data/spec/dummy/db/seeds/import.rb +0 -7
  77. data/spec/dummy/public/404.html +0 -26
  78. data/spec/dummy/public/422.html +0 -26
  79. data/spec/dummy/public/500.html +0 -26
  80. data/spec/dummy/public/favicon.ico +0 -0
  81. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  82. data/spec/dummy/script/rails +0 -8
  83. data/spec/dummy_engine/.gitignore +0 -8
  84. data/spec/dummy_engine/Gemfile +0 -15
  85. data/spec/dummy_engine/Rakefile +0 -34
  86. data/spec/dummy_engine/bin/rails +0 -12
  87. data/spec/dummy_engine/config/initializers/apartment.rb +0 -52
  88. data/spec/dummy_engine/dummy_engine.gemspec +0 -24
  89. data/spec/dummy_engine/lib/dummy_engine.rb +0 -6
  90. data/spec/dummy_engine/lib/dummy_engine/engine.rb +0 -6
  91. data/spec/dummy_engine/lib/dummy_engine/version.rb +0 -5
  92. data/spec/dummy_engine/test/dummy/Rakefile +0 -6
  93. data/spec/dummy_engine/test/dummy/config.ru +0 -6
  94. data/spec/dummy_engine/test/dummy/config/application.rb +0 -24
  95. data/spec/dummy_engine/test/dummy/config/boot.rb +0 -7
  96. data/spec/dummy_engine/test/dummy/config/database.yml +0 -25
  97. data/spec/dummy_engine/test/dummy/config/environment.rb +0 -7
  98. data/spec/dummy_engine/test/dummy/config/environments/development.rb +0 -39
  99. data/spec/dummy_engine/test/dummy/config/environments/production.rb +0 -80
  100. data/spec/dummy_engine/test/dummy/config/environments/test.rb +0 -41
  101. data/spec/dummy_engine/test/dummy/config/initializers/assets.rb +0 -10
  102. data/spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
  103. data/spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  104. data/spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb +0 -6
  105. data/spec/dummy_engine/test/dummy/config/initializers/inflections.rb +0 -17
  106. data/spec/dummy_engine/test/dummy/config/initializers/mime_types.rb +0 -5
  107. data/spec/dummy_engine/test/dummy/config/initializers/session_store.rb +0 -5
  108. data/spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb +0 -16
  109. data/spec/dummy_engine/test/dummy/config/locales/en.yml +0 -23
  110. data/spec/dummy_engine/test/dummy/config/routes.rb +0 -58
  111. data/spec/dummy_engine/test/dummy/config/secrets.yml +0 -22
  112. data/spec/examples/connection_adapter_examples.rb +0 -44
  113. data/spec/examples/generic_adapter_custom_configuration_example.rb +0 -93
  114. data/spec/examples/generic_adapter_examples.rb +0 -164
  115. data/spec/examples/schema_adapter_examples.rb +0 -239
  116. data/spec/integration/apartment_rake_integration_spec.rb +0 -107
  117. data/spec/integration/query_caching_spec.rb +0 -83
  118. data/spec/integration/use_within_an_engine_spec.rb +0 -28
  119. data/spec/schemas/v1.rb +0 -15
  120. data/spec/schemas/v2.rb +0 -41
  121. data/spec/schemas/v3.rb +0 -47
  122. data/spec/spec_helper.rb +0 -63
  123. data/spec/support/apartment_helpers.rb +0 -47
  124. data/spec/support/capybara_sessions.rb +0 -15
  125. data/spec/support/config.rb +0 -13
  126. data/spec/support/contexts.rb +0 -54
  127. data/spec/support/requirements.rb +0 -48
  128. data/spec/support/setup.rb +0 -46
  129. data/spec/tasks/apartment_rake_spec.rb +0 -124
  130. data/spec/tenant_spec.rb +0 -194
  131. data/spec/unit/config_spec.rb +0 -111
  132. data/spec/unit/elevators/domain_spec.rb +0 -33
  133. data/spec/unit/elevators/first_subdomain_spec.rb +0 -26
  134. data/spec/unit/elevators/generic_spec.rb +0 -55
  135. data/spec/unit/elevators/host_hash_spec.rb +0 -33
  136. data/spec/unit/elevators/host_spec.rb +0 -89
  137. data/spec/unit/elevators/subdomain_spec.rb +0 -77
  138. data/spec/unit/migrator_spec.rb +0 -78
  139. data/spec/unit/reloader_spec.rb +0 -24
@@ -11,7 +11,15 @@ Gem::Specification.new do |s|
11
11
  s.summary = 'A Ruby gem for managing database multitenancy. Apartment Gem drop in replacement'
12
12
  s.description = 'Apartment allows Rack applications to deal with database multitenancy through ActiveRecord'
13
13
  s.email = ['ryan@influitive.com', 'brad@influitive.com', 'rui.p.baltazar@gmail.com']
14
- s.files = `git ls-files`.split($/)
14
+ # Specify which files should be added to the gem when it is released.
15
+ # The `git ls-files -z` loads the files in the RubyGem that have been
16
+ # added into git.
17
+ s.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject do |f|
19
+ # NOTE: ignore all test related
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ end
15
23
  s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
16
24
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
25
  s.require_paths = ['lib']
@@ -19,16 +27,15 @@ Gem::Specification.new do |s|
19
27
  s.homepage = 'https://github.com/rails-on-services/apartment'
20
28
  s.licenses = ['MIT']
21
29
 
22
- # must be >= 3.1.2 due to bug in prepared_statements
23
- s.add_dependency 'activerecord', '>= 3.1.2', '< 6.1'
30
+ s.add_dependency 'activerecord', '>= 5.0.0', '< 6.1'
24
31
  s.add_dependency 'parallel', '< 2.0'
25
32
  s.add_dependency 'public_suffix', '>= 2.0.5', '< 5.0'
26
33
  s.add_dependency 'rack', '>= 1.3.6', '< 3.0'
27
34
 
28
35
  s.add_development_dependency 'appraisal', '~> 2.2'
29
- s.add_development_dependency 'bundler', '>= 1.3', '< 2.0'
36
+ s.add_development_dependency 'bundler', '>= 1.3', '< 3.0'
30
37
  s.add_development_dependency 'capybara', '~> 2.0'
31
- s.add_development_dependency 'rake', '~> 0.9'
38
+ s.add_development_dependency 'rake', '~> 13.0'
32
39
  s.add_development_dependency 'rspec', '~> 3.4'
33
40
  s.add_development_dependency 'rspec-rails', '~> 3.4'
34
41
 
@@ -38,7 +45,6 @@ Gem::Specification.new do |s|
38
45
  s.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
39
46
  s.add_development_dependency 'jdbc-mysql'
40
47
  s.add_development_dependency 'jdbc-postgres'
41
- s.add_development_dependency 'jruby-openssl'
42
48
  else
43
49
  s.add_development_dependency 'mysql2', '~> 0.5'
44
50
  s.add_development_dependency 'pg', '~> 1.2'
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: 2.4.0
4
+ version: 2.7.1
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: 2020-04-01 00:00:00.000000000 Z
13
+ date: 2020-06-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 3.1.2
21
+ version: 5.0.0
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
24
  version: '6.1'
@@ -28,7 +28,7 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 3.1.2
31
+ version: 5.0.0
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '6.1'
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '1.3'
110
110
  - - "<"
111
111
  - !ruby/object:Gem::Version
112
- version: '2.0'
112
+ version: '3.0'
113
113
  type: :development
114
114
  prerelease: false
115
115
  version_requirements: !ruby/object:Gem::Requirement
@@ -119,7 +119,7 @@ dependencies:
119
119
  version: '1.3'
120
120
  - - "<"
121
121
  - !ruby/object:Gem::Version
122
- version: '2.0'
122
+ version: '3.0'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: capybara
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +140,14 @@ dependencies:
140
140
  requirements:
141
141
  - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: '0.9'
143
+ version: '13.0'
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: '0.9'
150
+ version: '13.0'
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: rspec
153
153
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +229,6 @@ extensions: []
229
229
  extra_rdoc_files: []
230
230
  files:
231
231
  - ".github/ISSUE_TEMPLATE.md"
232
- - ".github/workflows/.rubocop-linter.yml"
233
232
  - ".gitignore"
234
233
  - ".pryrc"
235
234
  - ".rspec"
@@ -244,7 +243,6 @@ files:
244
243
  - README.md
245
244
  - Rakefile
246
245
  - TODO.md
247
- - apartment.gemspec
248
246
  - docker-compose.yml
249
247
  - gemfiles/rails_4_2.gemfile
250
248
  - gemfiles/rails_5_0.gemfile
@@ -253,6 +251,10 @@ files:
253
251
  - gemfiles/rails_6_0.gemfile
254
252
  - gemfiles/rails_master.gemfile
255
253
  - lib/apartment.rb
254
+ - lib/apartment/active_record/connection_handling.rb
255
+ - lib/apartment/active_record/internal_metadata.rb
256
+ - lib/apartment/active_record/log_subscriber.rb
257
+ - lib/apartment/active_record/schema_migration.rb
256
258
  - lib/apartment/adapters/abstract_adapter.rb
257
259
  - lib/apartment/adapters/abstract_jdbc_adapter.rb
258
260
  - lib/apartment/adapters/jdbc_mysql_adapter.rb
@@ -271,116 +273,18 @@ files:
271
273
  - lib/apartment/elevators/host_hash.rb
272
274
  - lib/apartment/elevators/subdomain.rb
273
275
  - lib/apartment/migrator.rb
276
+ - lib/apartment/model.rb
274
277
  - lib/apartment/railtie.rb
275
278
  - lib/apartment/reloader.rb
276
279
  - lib/apartment/tasks/enhancements.rb
280
+ - lib/apartment/tasks/task_helper.rb
277
281
  - lib/apartment/tenant.rb
278
282
  - lib/apartment/version.rb
279
283
  - lib/generators/apartment/install/USAGE
280
284
  - lib/generators/apartment/install/install_generator.rb
281
285
  - lib/generators/apartment/install/templates/apartment.rb
282
286
  - lib/tasks/apartment.rake
283
- - spec/adapters/jdbc_mysql_adapter_spec.rb
284
- - spec/adapters/jdbc_postgresql_adapter_spec.rb
285
- - spec/adapters/mysql2_adapter_spec.rb
286
- - spec/adapters/postgresql_adapter_spec.rb
287
- - spec/adapters/sqlite3_adapter_spec.rb
288
- - spec/apartment_spec.rb
289
- - spec/config/database.yml.sample
290
- - spec/dummy/Rakefile
291
- - spec/dummy/app/controllers/application_controller.rb
292
- - spec/dummy/app/helpers/application_helper.rb
293
- - spec/dummy/app/models/application_record.rb
294
- - spec/dummy/app/models/company.rb
295
- - spec/dummy/app/models/user.rb
296
- - spec/dummy/app/views/application/index.html.erb
297
- - spec/dummy/app/views/layouts/application.html.erb
298
- - spec/dummy/config.ru
299
- - spec/dummy/config/application.rb
300
- - spec/dummy/config/boot.rb
301
- - spec/dummy/config/database.yml.sample
302
- - spec/dummy/config/environment.rb
303
- - spec/dummy/config/environments/development.rb
304
- - spec/dummy/config/environments/production.rb
305
- - spec/dummy/config/environments/test.rb
306
- - spec/dummy/config/initializers/apartment.rb
307
- - spec/dummy/config/initializers/backtrace_silencers.rb
308
- - spec/dummy/config/initializers/inflections.rb
309
- - spec/dummy/config/initializers/mime_types.rb
310
- - spec/dummy/config/initializers/secret_token.rb
311
- - spec/dummy/config/initializers/session_store.rb
312
- - spec/dummy/config/locales/en.yml
313
- - spec/dummy/config/routes.rb
314
- - spec/dummy/db/migrate/20110613152810_create_dummy_models.rb
315
- - spec/dummy/db/migrate/20111202022214_create_table_books.rb
316
- - spec/dummy/db/migrate/20180415260934_create_public_tokens.rb
317
- - spec/dummy/db/schema.rb
318
- - spec/dummy/db/seeds.rb
319
- - spec/dummy/db/seeds/import.rb
320
- - spec/dummy/db/test.sqlite3
321
- - spec/dummy/public/404.html
322
- - spec/dummy/public/422.html
323
- - spec/dummy/public/500.html
324
- - spec/dummy/public/favicon.ico
325
- - spec/dummy/public/stylesheets/.gitkeep
326
- - spec/dummy/script/rails
327
- - spec/dummy_engine/.gitignore
328
- - spec/dummy_engine/Gemfile
329
- - spec/dummy_engine/Rakefile
330
- - spec/dummy_engine/bin/rails
331
- - spec/dummy_engine/config/initializers/apartment.rb
332
- - spec/dummy_engine/dummy_engine.gemspec
333
- - spec/dummy_engine/lib/dummy_engine.rb
334
- - spec/dummy_engine/lib/dummy_engine/engine.rb
335
- - spec/dummy_engine/lib/dummy_engine/version.rb
336
- - spec/dummy_engine/test/dummy/Rakefile
337
- - spec/dummy_engine/test/dummy/config.ru
338
- - spec/dummy_engine/test/dummy/config/application.rb
339
- - spec/dummy_engine/test/dummy/config/boot.rb
340
- - spec/dummy_engine/test/dummy/config/database.yml
341
- - spec/dummy_engine/test/dummy/config/environment.rb
342
- - spec/dummy_engine/test/dummy/config/environments/development.rb
343
- - spec/dummy_engine/test/dummy/config/environments/production.rb
344
- - spec/dummy_engine/test/dummy/config/environments/test.rb
345
- - spec/dummy_engine/test/dummy/config/initializers/assets.rb
346
- - spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb
347
- - spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb
348
- - spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb
349
- - spec/dummy_engine/test/dummy/config/initializers/inflections.rb
350
- - spec/dummy_engine/test/dummy/config/initializers/mime_types.rb
351
- - spec/dummy_engine/test/dummy/config/initializers/session_store.rb
352
- - spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb
353
- - spec/dummy_engine/test/dummy/config/locales/en.yml
354
- - spec/dummy_engine/test/dummy/config/routes.rb
355
- - spec/dummy_engine/test/dummy/config/secrets.yml
356
- - spec/examples/connection_adapter_examples.rb
357
- - spec/examples/generic_adapter_custom_configuration_example.rb
358
- - spec/examples/generic_adapter_examples.rb
359
- - spec/examples/schema_adapter_examples.rb
360
- - spec/integration/apartment_rake_integration_spec.rb
361
- - spec/integration/query_caching_spec.rb
362
- - spec/integration/use_within_an_engine_spec.rb
363
- - spec/schemas/v1.rb
364
- - spec/schemas/v2.rb
365
- - spec/schemas/v3.rb
366
- - spec/spec_helper.rb
367
- - spec/support/apartment_helpers.rb
368
- - spec/support/capybara_sessions.rb
369
- - spec/support/config.rb
370
- - spec/support/contexts.rb
371
- - spec/support/requirements.rb
372
- - spec/support/setup.rb
373
- - spec/tasks/apartment_rake_spec.rb
374
- - spec/tenant_spec.rb
375
- - spec/unit/config_spec.rb
376
- - spec/unit/elevators/domain_spec.rb
377
- - spec/unit/elevators/first_subdomain_spec.rb
378
- - spec/unit/elevators/generic_spec.rb
379
- - spec/unit/elevators/host_hash_spec.rb
380
- - spec/unit/elevators/host_spec.rb
381
- - spec/unit/elevators/subdomain_spec.rb
382
- - spec/unit/migrator_spec.rb
383
- - spec/unit/reloader_spec.rb
287
+ - ros-apartment.gemspec
384
288
  homepage: https://github.com/rails-on-services/apartment
385
289
  licenses:
386
290
  - MIT
@@ -404,105 +308,4 @@ rubygems_version: 3.0.3
404
308
  signing_key:
405
309
  specification_version: 4
406
310
  summary: A Ruby gem for managing database multitenancy. Apartment Gem drop in replacement
407
- test_files:
408
- - spec/adapters/jdbc_mysql_adapter_spec.rb
409
- - spec/adapters/jdbc_postgresql_adapter_spec.rb
410
- - spec/adapters/mysql2_adapter_spec.rb
411
- - spec/adapters/postgresql_adapter_spec.rb
412
- - spec/adapters/sqlite3_adapter_spec.rb
413
- - spec/apartment_spec.rb
414
- - spec/config/database.yml.sample
415
- - spec/dummy/Rakefile
416
- - spec/dummy/app/controllers/application_controller.rb
417
- - spec/dummy/app/helpers/application_helper.rb
418
- - spec/dummy/app/models/application_record.rb
419
- - spec/dummy/app/models/company.rb
420
- - spec/dummy/app/models/user.rb
421
- - spec/dummy/app/views/application/index.html.erb
422
- - spec/dummy/app/views/layouts/application.html.erb
423
- - spec/dummy/config.ru
424
- - spec/dummy/config/application.rb
425
- - spec/dummy/config/boot.rb
426
- - spec/dummy/config/database.yml.sample
427
- - spec/dummy/config/environment.rb
428
- - spec/dummy/config/environments/development.rb
429
- - spec/dummy/config/environments/production.rb
430
- - spec/dummy/config/environments/test.rb
431
- - spec/dummy/config/initializers/apartment.rb
432
- - spec/dummy/config/initializers/backtrace_silencers.rb
433
- - spec/dummy/config/initializers/inflections.rb
434
- - spec/dummy/config/initializers/mime_types.rb
435
- - spec/dummy/config/initializers/secret_token.rb
436
- - spec/dummy/config/initializers/session_store.rb
437
- - spec/dummy/config/locales/en.yml
438
- - spec/dummy/config/routes.rb
439
- - spec/dummy/db/migrate/20110613152810_create_dummy_models.rb
440
- - spec/dummy/db/migrate/20111202022214_create_table_books.rb
441
- - spec/dummy/db/migrate/20180415260934_create_public_tokens.rb
442
- - spec/dummy/db/schema.rb
443
- - spec/dummy/db/seeds.rb
444
- - spec/dummy/db/seeds/import.rb
445
- - spec/dummy/db/test.sqlite3
446
- - spec/dummy/public/404.html
447
- - spec/dummy/public/422.html
448
- - spec/dummy/public/500.html
449
- - spec/dummy/public/favicon.ico
450
- - spec/dummy/public/stylesheets/.gitkeep
451
- - spec/dummy/script/rails
452
- - spec/dummy_engine/.gitignore
453
- - spec/dummy_engine/Gemfile
454
- - spec/dummy_engine/Rakefile
455
- - spec/dummy_engine/bin/rails
456
- - spec/dummy_engine/config/initializers/apartment.rb
457
- - spec/dummy_engine/dummy_engine.gemspec
458
- - spec/dummy_engine/lib/dummy_engine.rb
459
- - spec/dummy_engine/lib/dummy_engine/engine.rb
460
- - spec/dummy_engine/lib/dummy_engine/version.rb
461
- - spec/dummy_engine/test/dummy/Rakefile
462
- - spec/dummy_engine/test/dummy/config.ru
463
- - spec/dummy_engine/test/dummy/config/application.rb
464
- - spec/dummy_engine/test/dummy/config/boot.rb
465
- - spec/dummy_engine/test/dummy/config/database.yml
466
- - spec/dummy_engine/test/dummy/config/environment.rb
467
- - spec/dummy_engine/test/dummy/config/environments/development.rb
468
- - spec/dummy_engine/test/dummy/config/environments/production.rb
469
- - spec/dummy_engine/test/dummy/config/environments/test.rb
470
- - spec/dummy_engine/test/dummy/config/initializers/assets.rb
471
- - spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb
472
- - spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb
473
- - spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb
474
- - spec/dummy_engine/test/dummy/config/initializers/inflections.rb
475
- - spec/dummy_engine/test/dummy/config/initializers/mime_types.rb
476
- - spec/dummy_engine/test/dummy/config/initializers/session_store.rb
477
- - spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb
478
- - spec/dummy_engine/test/dummy/config/locales/en.yml
479
- - spec/dummy_engine/test/dummy/config/routes.rb
480
- - spec/dummy_engine/test/dummy/config/secrets.yml
481
- - spec/examples/connection_adapter_examples.rb
482
- - spec/examples/generic_adapter_custom_configuration_example.rb
483
- - spec/examples/generic_adapter_examples.rb
484
- - spec/examples/schema_adapter_examples.rb
485
- - spec/integration/apartment_rake_integration_spec.rb
486
- - spec/integration/query_caching_spec.rb
487
- - spec/integration/use_within_an_engine_spec.rb
488
- - spec/schemas/v1.rb
489
- - spec/schemas/v2.rb
490
- - spec/schemas/v3.rb
491
- - spec/spec_helper.rb
492
- - spec/support/apartment_helpers.rb
493
- - spec/support/capybara_sessions.rb
494
- - spec/support/config.rb
495
- - spec/support/contexts.rb
496
- - spec/support/requirements.rb
497
- - spec/support/setup.rb
498
- - spec/tasks/apartment_rake_spec.rb
499
- - spec/tenant_spec.rb
500
- - spec/unit/config_spec.rb
501
- - spec/unit/elevators/domain_spec.rb
502
- - spec/unit/elevators/first_subdomain_spec.rb
503
- - spec/unit/elevators/generic_spec.rb
504
- - spec/unit/elevators/host_hash_spec.rb
505
- - spec/unit/elevators/host_spec.rb
506
- - spec/unit/elevators/subdomain_spec.rb
507
- - spec/unit/migrator_spec.rb
508
- - spec/unit/reloader_spec.rb
311
+ test_files: []
@@ -1,22 +0,0 @@
1
- name: Rubocop Lint
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
-
8
- runs-on: ubuntu-latest
9
-
10
- container:
11
- image: ruby:2.6.5
12
-
13
- steps:
14
- - uses: actions/checkout@v1
15
- - name: Rubocop Linter
16
- uses: andrewmcodes/rubocop-linter-action@v2.0.0
17
- with:
18
- additional_gems: 'perx-rubocop:0.0.3'
19
- fail_level: 'warning'
20
- version: '0.77.0'
21
- env:
22
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if defined?(JRUBY_VERSION)
4
-
5
- require 'spec_helper'
6
- require 'apartment/adapters/jdbc_mysql_adapter'
7
-
8
- describe Apartment::Adapters::JDBCMysqlAdapter, database: :mysql do
9
- subject { Apartment::Tenant.jdbc_mysql_adapter config.symbolize_keys }
10
-
11
- def tenant_names
12
- ActiveRecord::Base.connection.execute('SELECT schema_name FROM information_schema.schemata').collect { |row| row['schema_name'] }
13
- end
14
-
15
- let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.current_database } }
16
-
17
- it_should_behave_like 'a generic apartment adapter'
18
- it_should_behave_like 'a connection based apartment adapter'
19
- end
20
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if defined?(JRUBY_VERSION)
4
-
5
- require 'spec_helper'
6
- require 'apartment/adapters/jdbc_postgresql_adapter'
7
-
8
- describe Apartment::Adapters::JDBCPostgresqlAdapter, database: :postgresql do
9
- subject { Apartment::Tenant.jdbc_postgresql_adapter config.symbolize_keys }
10
-
11
- context 'using schemas' do
12
- before { Apartment.use_schemas = true }
13
-
14
- # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test
15
- def tenant_names
16
- ActiveRecord::Base.connection.execute('SELECT nspname FROM pg_namespace;').collect { |row| row['nspname'] }
17
- end
18
-
19
- let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.schema_search_path.gsub('"', '') } }
20
-
21
- it_should_behave_like 'a generic apartment adapter'
22
- it_should_behave_like 'a schema based apartment adapter'
23
- end
24
-
25
- context 'using databases' do
26
- before { Apartment.use_schemas = false }
27
-
28
- # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test
29
- def tenant_names
30
- connection.execute('select datname from pg_database;').collect { |row| row['datname'] }
31
- end
32
-
33
- let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.current_database } }
34
-
35
- it_should_behave_like 'a generic apartment adapter'
36
- it_should_behave_like 'a connection based apartment adapter'
37
- end
38
- end
39
- end
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'apartment/adapters/mysql2_adapter'
5
-
6
- describe Apartment::Adapters::Mysql2Adapter, database: :mysql do
7
- unless defined?(JRUBY_VERSION)
8
-
9
- subject(:adapter) { Apartment::Tenant.mysql2_adapter config }
10
-
11
- def tenant_names
12
- ActiveRecord::Base.connection.execute('SELECT schema_name FROM information_schema.schemata').collect { |row| row[0] }
13
- end
14
-
15
- let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.current_database } }
16
-
17
- context 'using - the equivalent of - schemas' do
18
- before { Apartment.use_schemas = true }
19
-
20
- it_should_behave_like 'a generic apartment adapter'
21
-
22
- describe '#default_tenant' do
23
- it 'is set to the original db from config' do
24
- expect(subject.default_tenant).to eq(config[:database])
25
- end
26
- end
27
-
28
- describe '#init' do
29
- include Apartment::Spec::AdapterRequirements
30
-
31
- before do
32
- Apartment.configure do |config|
33
- config.excluded_models = ['Company']
34
- end
35
- end
36
-
37
- after do
38
- # Apartment::Tenant.init creates per model connection.
39
- # Remove the connection after testing not to unintentionally keep the connection across tests.
40
- Apartment.excluded_models.each do |excluded_model|
41
- excluded_model.constantize.remove_connection
42
- end
43
- end
44
-
45
- it 'should process model exclusions' do
46
- Apartment::Tenant.init
47
-
48
- expect(Company.table_name).to eq("#{default_tenant}.companies")
49
- end
50
- end
51
- end
52
-
53
- context 'using connections' do
54
- before { Apartment.use_schemas = false }
55
-
56
- it_should_behave_like 'a generic apartment adapter'
57
- it_should_behave_like 'a generic apartment adapter able to handle custom configuration'
58
- it_should_behave_like 'a connection based apartment adapter'
59
- end
60
- end
61
- end