ros-apartment 2.11.0 → 3.0.1

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: 6182f5dcd4e369e6f497295705079b3d0b20d644d8006c5a256d8618eff1a2c3
4
- data.tar.gz: 351be335f73230dd83df3020ba77b33f8e33e297f67c5256210f3e0c0c12e749
3
+ metadata.gz: 0f06dfaa8f3dfb2df11cb16ee69a9d93a6d2d29ea212f8c836aa3df90065beb3
4
+ data.tar.gz: 3c6c900bfc6227c6725c6b92366460a1949c6f9e3a166971adf4b98a3b5de37f
5
5
  SHA512:
6
- metadata.gz: 7714a5182a47cefc6a95d85118278263bf4d326c5441184005a3ef48cf10368cd123602a0e5635547233c12ecb587e107dc72c0a117423dd774054f19767e3ce
7
- data.tar.gz: 6b4247215b4754d031ce248f6e457d1c509157d310964e74cc72f05e8f896215b29341cd892515c9e9803a2f0db6528f180474b0c14cf03384ee1ac4f9693164
6
+ metadata.gz: 26b9175fc8f056ad74ef2a29d163793b1de9da857d77fe7236458688aec5313501aace5eb78a8ab3583483624c873b9684d083102f3e1defbe54a8385f728fa4
7
+ data.tar.gz: 6984614b40488003a64d0ffc45bf16ae68d8f348d1771797cb45085c0fcf57a41d05f62661070bcb1ecf3259db2d2fbc8edf998bdc96f23758704efaebb36e25
data/.rubocop.yml CHANGED
@@ -7,6 +7,7 @@ require:
7
7
 
8
8
  AllCops:
9
9
  Exclude:
10
+ - vendor/bundle/**/*
10
11
  - gemfiles/**/*.gemfile
11
12
  - gemfiles/vendor/**/*
12
13
  - spec/dummy_engine/dummy_engine.gemspec
@@ -30,3 +31,6 @@ Rails/ApplicationRecord:
30
31
 
31
32
  Rails/Output:
32
33
  Enabled: false
34
+
35
+ Style/Documentation:
36
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,24 +1,92 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-06-26 03:25:28 UTC using RuboCop version 0.93.1.
3
+ # on 2024-05-07 18:57:21 UTC using RuboCop version 1.63.4.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Severity, Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/DeprecatedAttributeAssignment:
14
+ Exclude:
15
+ - 'ros-apartment.gemspec'
16
+
17
+ # Offense count: 20
18
+ # Configuration parameters: EnforcedStyle, AllowedGems, Include.
19
+ # SupportedStyles: Gemfile, gems.rb, gemspec
20
+ # Include: **/*.gemspec, **/Gemfile, **/gems.rb
21
+ Gemspec/DevelopmentDependencies:
22
+ Exclude:
23
+ - 'ros-apartment.gemspec'
24
+
25
+ # Offense count: 1
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: Severity, Include.
28
+ # Include: **/*.gemspec
29
+ Gemspec/RequireMFA:
30
+ Exclude:
31
+ - 'ros-apartment.gemspec'
32
+
33
+ # Offense count: 6
34
+ # This cop supports safe autocorrection (--autocorrect).
35
+ Layout/EmptyLineAfterMagicComment:
36
+ Exclude:
37
+ - 'spec/dummy/config/initializers/backtrace_silencers.rb'
38
+ - 'spec/dummy/config/initializers/inflections.rb'
39
+ - 'spec/dummy/config/initializers/mime_types.rb'
40
+ - 'spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb'
41
+ - 'spec/dummy_engine/test/dummy/config/initializers/inflections.rb'
42
+ - 'spec/dummy_engine/test/dummy/config/initializers/mime_types.rb'
43
+
44
+ # Offense count: 3
45
+ # This cop supports safe autocorrection (--autocorrect).
46
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
47
+ Layout/LeadingCommentSpace:
48
+ Exclude:
49
+ - 'ros-apartment.gemspec'
50
+
51
+ # Offense count: 2
52
+ # This cop supports safe autocorrection (--autocorrect).
53
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
54
+ # SupportedStyles: aligned, indented
55
+ Layout/LineEndStringConcatenationIndentation:
56
+ Exclude:
57
+ - 'lib/apartment/custom_console.rb'
58
+
59
+ # Offense count: 3
60
+ # This cop supports safe autocorrection (--autocorrect).
61
+ Layout/SpaceBeforeComment:
62
+ Exclude:
63
+ - 'ros-apartment.gemspec'
64
+
9
65
  # Offense count: 1
10
66
  Lint/MixedRegexpCaptureTypes:
11
67
  Exclude:
12
68
  - 'lib/apartment/elevators/domain.rb'
13
69
 
14
- # Offense count: 3
15
- # Configuration parameters: IgnoredMethods.
70
+ # Offense count: 1
71
+ # This cop supports safe autocorrection (--autocorrect).
72
+ Lint/RedundantCopDisableDirective:
73
+ Exclude:
74
+ - 'spec/support/config.rb'
75
+
76
+ # Offense count: 2
77
+ # This cop supports unsafe autocorrection (--autocorrect-all).
78
+ Lint/RedundantDirGlobSort:
79
+ Exclude:
80
+ - 'spec/spec_helper.rb'
81
+
82
+ # Offense count: 2
83
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
16
84
  Metrics/AbcSize:
17
85
  Max: 28
18
86
 
19
- # Offense count: 5
20
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
21
- # ExcludedMethods: refine
87
+ # Offense count: 4
88
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
89
+ # AllowedMethods: refine
22
90
  Metrics/BlockLength:
23
91
  Max: 83
24
92
 
@@ -28,26 +96,51 @@ Metrics/ClassLength:
28
96
  Max: 151
29
97
 
30
98
  # Offense count: 6
31
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
99
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
32
100
  Metrics/MethodLength:
33
- Max: 24
101
+ Max: 23
102
+
103
+ # Offense count: 3
104
+ # This cop supports safe autocorrection (--autocorrect).
105
+ # Configuration parameters: EnforcedStyle, BlockForwardingName.
106
+ # SupportedStyles: anonymous, explicit
107
+ Naming/BlockForwarding:
108
+ Exclude:
109
+ - 'lib/apartment/adapters/abstract_adapter.rb'
110
+ - 'lib/apartment/log_subscriber.rb'
111
+
112
+ # Offense count: 1
113
+ # This cop supports safe autocorrection (--autocorrect).
114
+ Performance/RedundantBlockCall:
115
+ Exclude:
116
+ - 'lib/apartment/tasks/task_helper.rb'
117
+
118
+ # Offense count: 1
119
+ # This cop supports safe autocorrection (--autocorrect).
120
+ Performance/StringIdentifierArgument:
121
+ Exclude:
122
+ - 'lib/apartment/railtie.rb'
34
123
 
35
124
  # Offense count: 3
36
125
  RSpec/AnyInstance:
37
126
  Exclude:
38
127
  - 'spec/unit/migrator_spec.rb'
39
128
 
129
+ # Offense count: 4
130
+ # This cop supports unsafe autocorrection (--autocorrect-all).
131
+ RSpec/BeEq:
132
+ Exclude:
133
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
134
+ - 'spec/unit/elevators/first_subdomain_spec.rb'
135
+
40
136
  # Offense count: 2
41
137
  RSpec/BeforeAfterAll:
42
138
  Exclude:
43
- - 'spec/spec_helper.rb'
44
- - 'spec/rails_helper.rb'
45
- - 'spec/support/**/*.rb'
46
139
  - 'spec/adapters/sqlite3_adapter_spec.rb'
47
140
  - 'spec/tasks/apartment_rake_spec.rb'
48
141
 
49
142
  # Offense count: 18
50
- # Configuration parameters: Prefixes.
143
+ # Configuration parameters: Prefixes, AllowedPatterns.
51
144
  # Prefixes: when, with, without
52
145
  RSpec/ContextWording:
53
146
  Exclude:
@@ -58,18 +151,19 @@ RSpec/ContextWording:
58
151
  - 'spec/tasks/apartment_rake_spec.rb'
59
152
  - 'spec/tenant_spec.rb'
60
153
 
61
- # Offense count: 4
154
+ # Offense count: 5
62
155
  # Configuration parameters: IgnoredMetadata.
63
156
  RSpec/DescribeClass:
64
157
  Exclude:
65
158
  - 'spec/integration/apartment_rake_integration_spec.rb'
159
+ - 'spec/integration/connection_handling_spec.rb'
66
160
  - 'spec/integration/query_caching_spec.rb'
67
161
  - 'spec/integration/use_within_an_engine_spec.rb'
68
162
  - 'spec/tasks/apartment_rake_spec.rb'
69
163
 
70
- # Offense count: 12
71
- # Cop supports --auto-correct.
72
- # Configuration parameters: SkipBlocks, EnforcedStyle.
164
+ # Offense count: 6
165
+ # This cop supports unsafe autocorrection (--autocorrect-all).
166
+ # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
73
167
  # SupportedStyles: described_class, explicit
74
168
  RSpec/DescribedClass:
75
169
  Exclude:
@@ -79,25 +173,21 @@ RSpec/DescribedClass:
79
173
  - 'spec/unit/migrator_spec.rb'
80
174
 
81
175
  # Offense count: 5
82
- # Cop supports --auto-correct.
176
+ # This cop supports safe autocorrection (--autocorrect).
83
177
  RSpec/EmptyLineAfterFinalLet:
84
178
  Exclude:
85
179
  - 'spec/adapters/sqlite3_adapter_spec.rb'
86
180
  - 'spec/examples/schema_adapter_examples.rb'
87
181
 
88
182
  # Offense count: 14
89
- # Configuration parameters: Max.
183
+ # Configuration parameters: CountAsOne.
90
184
  RSpec/ExampleLength:
91
- Exclude:
92
- - 'spec/examples/generic_adapter_custom_configuration_example.rb'
93
- - 'spec/examples/generic_adapter_examples.rb'
94
- - 'spec/examples/schema_adapter_examples.rb'
95
- - 'spec/integration/query_caching_spec.rb'
96
- - 'spec/tenant_spec.rb'
185
+ Max: 12
97
186
 
98
- # Offense count: 60
99
- # Cop supports --auto-correct.
100
- # Configuration parameters: CustomTransform, IgnoredWords.
187
+ # Offense count: 58
188
+ # This cop supports safe autocorrection (--autocorrect).
189
+ # Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
190
+ # DisallowedExamples: works
101
191
  RSpec/ExampleWording:
102
192
  Exclude:
103
193
  - 'spec/adapters/sqlite3_adapter_spec.rb'
@@ -111,8 +201,9 @@ RSpec/ExampleWording:
111
201
  - 'spec/tasks/apartment_rake_spec.rb'
112
202
  - 'spec/tenant_spec.rb'
113
203
 
114
- # Offense count: 13
115
- # Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
204
+ # Offense count: 12
205
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
206
+ # Include: **/*_spec*rb*, **/spec/**/*
116
207
  RSpec/FilePath:
117
208
  Exclude:
118
209
  - 'spec/adapters/mysql2_adapter_spec.rb'
@@ -129,7 +220,7 @@ RSpec/FilePath:
129
220
  - 'spec/unit/migrator_spec.rb'
130
221
 
131
222
  # Offense count: 1
132
- # Cop supports --auto-correct.
223
+ # This cop supports safe autocorrection (--autocorrect).
133
224
  # Configuration parameters: EnforcedStyle.
134
225
  # SupportedStyles: implicit, each, example
135
226
  RSpec/HookArgument:
@@ -137,13 +228,20 @@ RSpec/HookArgument:
137
228
  - 'spec/support/setup.rb'
138
229
 
139
230
  # Offense count: 4
140
- # Cop supports --auto-correct.
231
+ # This cop supports safe autocorrection (--autocorrect).
141
232
  RSpec/HooksBeforeExamples:
142
233
  Exclude:
143
234
  - 'spec/adapters/sqlite3_adapter_spec.rb'
144
235
  - 'spec/examples/schema_adapter_examples.rb'
145
236
 
146
- # Offense count: 18
237
+ # Offense count: 4
238
+ # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
239
+ RSpec/IndexedLet:
240
+ Exclude:
241
+ - 'spec/examples/schema_adapter_examples.rb'
242
+ - 'spec/support/contexts.rb'
243
+
244
+ # Offense count: 16
147
245
  # Configuration parameters: AssignmentOnly.
148
246
  RSpec/InstanceVariable:
149
247
  Exclude:
@@ -153,18 +251,13 @@ RSpec/InstanceVariable:
153
251
  - 'spec/integration/use_within_an_engine_spec.rb'
154
252
  - 'spec/tasks/apartment_rake_spec.rb'
155
253
 
156
- # Offense count: 1
157
- # Cop supports --auto-correct.
158
- RSpec/LeadingSubject:
159
- Exclude:
160
-
161
254
  # Offense count: 2
162
255
  RSpec/LeakyConstantDeclaration:
163
256
  Exclude:
164
257
  - 'spec/examples/generic_adapters_callbacks_examples.rb'
165
258
  - 'spec/unit/elevators/generic_spec.rb'
166
259
 
167
- # Offense count: 35
260
+ # Offense count: 27
168
261
  # Configuration parameters: EnforcedStyle.
169
262
  # SupportedStyles: have_received, receive
170
263
  RSpec/MessageSpies:
@@ -180,12 +273,22 @@ RSpec/MessageSpies:
180
273
  - 'spec/unit/elevators/subdomain_spec.rb'
181
274
  - 'spec/unit/migrator_spec.rb'
182
275
 
183
- # Offense count: 29
276
+ # Offense count: 11
277
+ # This cop supports safe autocorrection (--autocorrect).
278
+ # Configuration parameters: EnforcedStyle.
279
+ # SupportedStyles: hash, symbol
280
+ RSpec/MetadataStyle:
281
+ Exclude:
282
+ - 'spec/examples/schema_adapter_examples.rb'
283
+ - 'spec/support/contexts.rb'
284
+
285
+ # Offense count: 27
184
286
  RSpec/MultipleExpectations:
185
- Max: 4
287
+ Max: 6
186
288
 
187
- # Offense count: 47
188
- # Configuration parameters: IgnoreSharedExamples.
289
+ # Offense count: 46
290
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
291
+ # SupportedStyles: always, named_only
189
292
  RSpec/NamedSubject:
190
293
  Exclude:
191
294
  - 'spec/adapters/mysql2_adapter_spec.rb'
@@ -194,31 +297,69 @@ RSpec/NamedSubject:
194
297
  - 'spec/support/requirements.rb'
195
298
  - 'spec/tenant_spec.rb'
196
299
 
197
- # Offense count: 24
300
+ # Offense count: 22
301
+ # Configuration parameters: AllowedGroups.
198
302
  RSpec/NestedGroups:
199
303
  Max: 5
200
304
 
201
- # Offense count: 6
202
- # Cop supports --auto-correct.
203
- # Configuration parameters: EnforcedStyle.
204
- # SupportedStyles: and_return, block
205
- RSpec/ReturnFromStub:
305
+ # Offense count: 1
306
+ # Configuration parameters: AllowedPatterns.
307
+ # AllowedPatterns: ^expect_, ^assert_
308
+ RSpec/NoExpectationExample:
206
309
  Exclude:
207
- - 'spec/integration/apartment_rake_integration_spec.rb'
310
+ - 'spec/tenant_spec.rb'
311
+
312
+ # Offense count: 12
313
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
314
+ # Include: **/*_spec.rb
315
+ RSpec/SpecFilePathFormat:
316
+ Exclude:
317
+ - 'spec/adapters/mysql2_adapter_spec.rb'
318
+ - 'spec/adapters/postgresql_adapter_spec.rb'
319
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
320
+ - 'spec/tenant_spec.rb'
321
+ - 'spec/unit/config_spec.rb'
322
+ - 'spec/unit/elevators/domain_spec.rb'
323
+ - 'spec/unit/elevators/first_subdomain_spec.rb'
324
+ - 'spec/unit/elevators/generic_spec.rb'
325
+ - 'spec/unit/elevators/host_hash_spec.rb'
326
+ - 'spec/unit/elevators/host_spec.rb'
327
+ - 'spec/unit/elevators/subdomain_spec.rb'
208
328
  - 'spec/unit/migrator_spec.rb'
209
329
 
210
- # Offense count: 4
330
+ # Offense count: 2
211
331
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
212
332
  RSpec/VerifiedDoubles:
213
333
  Exclude:
214
334
  - 'spec/integration/apartment_rake_integration_spec.rb'
215
335
  - 'spec/unit/elevators/first_subdomain_spec.rb'
216
336
 
217
- # Offense count: 17
337
+ # Offense count: 2
338
+ # This cop supports safe autocorrection (--autocorrect).
339
+ Rails/IndexWith:
340
+ Exclude:
341
+ - 'lib/apartment.rb'
342
+ - 'spec/unit/config_spec.rb'
343
+
344
+ # Offense count: 7
345
+ # This cop supports unsafe autocorrection (--autocorrect-all).
346
+ Rails/Pluck:
347
+ Exclude:
348
+ - 'spec/adapters/jdbc_mysql_adapter_spec.rb'
349
+ - 'spec/adapters/jdbc_postgresql_adapter_spec.rb'
350
+ - 'spec/adapters/mysql2_adapter_spec.rb'
351
+ - 'spec/adapters/postgresql_adapter_spec.rb'
352
+
353
+ # Offense count: 1
354
+ # This cop supports unsafe autocorrection (--autocorrect-all).
355
+ Security/IoMethods:
356
+ Exclude:
357
+ - 'spec/support/config.rb'
358
+
359
+ # Offense count: 16
360
+ # Configuration parameters: AllowedConstants.
218
361
  Style/Documentation:
219
362
  Exclude:
220
- - 'spec/**/*'
221
- - 'test/**/*'
222
363
  - 'lib/apartment/adapters/jdbc_mysql_adapter.rb'
223
364
  - 'lib/apartment/adapters/postgis_adapter.rb'
224
365
  - 'lib/apartment/adapters/postgresql_adapter.rb'
@@ -231,3 +372,65 @@ Style/Documentation:
231
372
  - 'lib/apartment/tasks/enhancements.rb'
232
373
  - 'lib/apartment/tasks/task_helper.rb'
233
374
  - 'lib/generators/apartment/install/install_generator.rb'
375
+
376
+ # Offense count: 4
377
+ # This cop supports safe autocorrection (--autocorrect).
378
+ # Configuration parameters: AllowedVars.
379
+ Style/FetchEnvVar:
380
+ Exclude:
381
+ - 'lib/apartment/adapters/postgresql_adapter.rb'
382
+
383
+ # Offense count: 3
384
+ # This cop supports safe autocorrection (--autocorrect).
385
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
386
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
387
+ # SupportedShorthandSyntax: always, never, either, consistent
388
+ Style/HashSyntax:
389
+ Exclude:
390
+ - 'lib/apartment/active_record/connection_handling.rb'
391
+ - 'spec/integration/connection_handling_spec.rb'
392
+
393
+ # Offense count: 1
394
+ # This cop supports unsafe autocorrection (--autocorrect-all).
395
+ # Configuration parameters: EnforcedStyle, Autocorrect.
396
+ # SupportedStyles: module_function, extend_self, forbidden
397
+ Style/ModuleFunction:
398
+ Exclude:
399
+ - 'lib/apartment/migrator.rb'
400
+
401
+ # Offense count: 4
402
+ # This cop supports safe autocorrection (--autocorrect).
403
+ Style/RedundantConstantBase:
404
+ Exclude:
405
+ - 'spec/apartment_spec.rb'
406
+ - 'spec/dummy/config.ru'
407
+ - 'spec/dummy_engine/test/dummy/config.ru'
408
+ - 'spec/dummy_engine/test/dummy/config/environments/production.rb'
409
+
410
+ # Offense count: 1
411
+ # This cop supports safe autocorrection (--autocorrect).
412
+ Style/RedundantParentheses:
413
+ Exclude:
414
+ - 'lib/apartment.rb'
415
+
416
+ # Offense count: 1
417
+ # This cop supports safe autocorrection (--autocorrect).
418
+ Style/RedundantRegexpArgument:
419
+ Exclude:
420
+ - 'lib/apartment/tasks/enhancements.rb'
421
+
422
+ # Offense count: 3
423
+ # This cop supports unsafe autocorrection (--autocorrect-all).
424
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
425
+ # AllowedMethods: present?, blank?, presence, try, try!
426
+ Style/SafeNavigation:
427
+ Exclude:
428
+ - 'lib/apartment/migrator.rb'
429
+ - 'lib/tasks/apartment.rake'
430
+
431
+ # Offense count: 2
432
+ # This cop supports safe autocorrection (--autocorrect).
433
+ Style/SuperWithArgsParentheses:
434
+ Exclude:
435
+ - 'lib/apartment/adapters/sqlite3_adapter.rb'
436
+ - 'lib/apartment/elevators/host_hash.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 3.1.4
data/Appraisals CHANGED
@@ -1,28 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'rails-5-2' do
4
- gem 'rails', '~> 5.2.0'
5
- platforms :jruby do
6
- gem 'activerecord-jdbc-adapter', '~> 52.0'
7
- gem 'activerecord-jdbcpostgresql-adapter', '~> 52.0'
8
- gem 'activerecord-jdbcmysql-adapter', '~> 52.0'
9
- end
10
- end
11
-
12
- appraise 'rails-6-0' do
13
- gem 'rails', '~> 6.0.0'
3
+ appraise 'rails-6-1' do
4
+ gem 'rails', '~> 6.1.0'
14
5
  platforms :ruby do
15
6
  gem 'sqlite3', '~> 1.4'
16
7
  end
17
8
  platforms :jruby do
18
- gem 'activerecord-jdbc-adapter', '~> 60.0'
19
- gem 'activerecord-jdbcpostgresql-adapter', '~> 60.0'
20
- gem 'activerecord-jdbcmysql-adapter', '~> 60.0'
9
+ gem 'activerecord-jdbc-adapter', '~> 61.0'
10
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 61.0'
11
+ gem 'activerecord-jdbcmysql-adapter', '~> 61.0'
21
12
  end
22
13
  end
23
14
 
24
- appraise 'rails-6-1' do
25
- gem 'rails', '~> 6.1.0'
15
+ appraise 'rails-7-0' do
16
+ gem 'rails', '~> 7.0.0'
26
17
  platforms :ruby do
27
18
  gem 'sqlite3', '~> 1.4'
28
19
  end
@@ -33,10 +24,10 @@ appraise 'rails-6-1' do
33
24
  end
34
25
  end
35
26
 
36
- appraise 'rails-7-0' do
37
- gem 'rails', '~> 7.0.0'
27
+ appraise 'rails-7-1' do
28
+ gem 'rails', '~> 7.1.0'
38
29
  platforms :ruby do
39
- gem 'sqlite3', '~> 1.4'
30
+ gem 'sqlite3', '~> 1.6'
40
31
  end
41
32
  platforms :jruby do
42
33
  gem 'activerecord-jdbc-adapter', '~> 61.0'
data/CHANGELOG.md CHANGED
@@ -1,8 +1,10 @@
1
- # Changelog
1
+ # Changelog [DEPRECATED]
2
2
 
3
- ## [Unreleased](https://github.com/rails-on-services/apartment/tree/HEAD)
3
+ Changes are now being tracked in the [releases](https://github.com/rails-on-services/apartment/releases) section of the repository.
4
4
 
5
- [Full Changelog](https://github.com/rails-on-services/apartment/compare/v2.8.0...HEAD)
5
+ ## [v2.8.1](https://github.com/rails-on-services/apartment/tree/v2.8.1) (2020-12-17)
6
+
7
+ [Full Changelog](https://github.com/rails-on-services/apartment/compare/v2.8.0...v2.8.1)
6
8
 
7
9
  **Implemented enhancements:**
8
10
 
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Apartment
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/ros-apartment.svg)](https://badge.fury.io/rb/apartment)
3
+ [![Gem Version](https://badge.fury.io/rb/ros-apartment.svg)](https://badge.fury.io/rb/ros-apartment)
4
4
  [![Code Climate](https://api.codeclimate.com/v1/badges/b0dc327380bb8438f991/maintainability)](https://codeclimate.com/github/rails-on-services/apartment/maintainability)
5
- [![Build Status](https://travis-ci.org/rails-on-services/apartment.svg?branch=development)](https://travis-ci.org/rails-on-services/apartment)
6
5
 
7
6
  *Multitenancy for Rails and ActiveRecord*
8
7
 
@@ -68,7 +67,7 @@ you need to create a new tenant, you can run the following command:
68
67
  Apartment::Tenant.create('tenant_name')
69
68
  ```
70
69
 
71
- If you're using the [prepend environment](https://github.com/influitive/apartment#handling-environments) config option or you AREN'T using Postgresql Schemas, this will create a tenant in the following format: "#{environment}\_tenant_name".
70
+ If you're using the [prepend environment](https://github.com/rails-on-services/apartment#handling-environments) config option or you AREN'T using Postgresql Schemas, this will create a tenant in the following format: "#{environment}\_tenant_name".
72
71
  In the case of a sqlite database, this will be created in your 'db/' folder. With
73
72
  other databases, the tenant will be created as a new DB within the system.
74
73
 
@@ -275,7 +274,7 @@ In the examples above, we show the Apartment middleware being appended to the Ra
275
274
  Rails.application.config.middleware.use Apartment::Elevators::Subdomain
276
275
  ```
277
276
 
278
- By default, the Subdomain middleware switches into a Tenant based on the subdomain at the beginning of the request, and when the request is finished, it switches back to the "public" Tenant. This happens in the [Generic](https://github.com/influitive/apartment/blob/development/lib/apartment/elevators/generic.rb#L22) elevator, so all elevators that inherit from this elevator will operate as such.
277
+ By default, the Subdomain middleware switches into a Tenant based on the subdomain at the beginning of the request, and when the request is finished, it switches back to the "public" Tenant. This happens in the [Generic](https://github.com/rails-on-services/apartment/blob/development/lib/apartment/elevators/generic.rb#L22) elevator, so all elevators that inherit from this elevator will operate as such.
279
278
 
280
279
  It's also good to note that Apartment switches back to the "public" tenant any time an error is raised in your application.
281
280
 
@@ -531,7 +530,7 @@ You can then migrate your tenants using the normal rake task:
531
530
  rake db:migrate
532
531
  ```
533
532
 
534
- This just invokes `Apartment::Tenant.migrate(#{tenant_name})` for each tenant name supplied
533
+ This just invokes `Apartment::Migrator.migrate(#{tenant_name})` for each tenant name supplied
535
534
  from `Apartment.tenant_names`
536
535
 
537
536
  Note that you can disable the default migrating of all tenants with `db:migrate` by setting
data/Rakefile CHANGED
@@ -132,22 +132,8 @@ def my_config
132
132
  config['mysql']
133
133
  end
134
134
 
135
- def activerecord_below_5_2?
136
- ActiveRecord.version.release < Gem::Version.new('5.2.0')
137
- end
138
-
139
- def activerecord_below_6_0?
140
- ActiveRecord.version.release < Gem::Version.new('6.0.0')
141
- end
142
-
143
135
  def migrate
144
- if activerecord_below_5_2?
145
- ActiveRecord::Migrator.migrate('spec/dummy/db/migrate')
146
- elsif activerecord_below_6_0?
147
- ActiveRecord::MigrationContext.new('spec/dummy/db/migrate').migrate
148
- else
149
- # TODO: Figure out if there is any other possibility that can/should be
150
- # passed here as the second argument for the migration context
151
- ActiveRecord::MigrationContext.new('spec/dummy/db/migrate', ActiveRecord::SchemaMigration).migrate
152
- end
136
+ # TODO: Figure out if there is any other possibility that can/should be
137
+ # passed here as the second argument for the migration context
138
+ ActiveRecord::MigrationContext.new('spec/dummy/db/migrate', ActiveRecord::SchemaMigration).migrate
153
139
  end
@@ -1,16 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ActiveRecord
4
- # This is monkeypatching activerecord to ensure that whenever a new connection is established it
3
+ module ActiveRecord # :nodoc:
4
+ # This is monkeypatching Active Record to ensure that whenever a new connection is established it
5
5
  # switches to the same tenant as before the connection switching. This problem is more evident when
6
6
  # using read replica in Rails 6
7
7
  module ConnectionHandling
8
- def connected_to_with_tenant(database: nil, role: nil, prevent_writes: false, &blk)
9
- current_tenant = Apartment::Tenant.current
8
+ if ActiveRecord.version.release <= Gem::Version.new('6.2')
9
+ def connected_to_with_tenant(database: nil, role: nil, prevent_writes: false, &blk)
10
+ current_tenant = Apartment::Tenant.current
10
11
 
11
- connected_to_without_tenant(database: database, role: role, prevent_writes: prevent_writes) do
12
- Apartment::Tenant.switch!(current_tenant)
13
- yield(blk)
12
+ connected_to_without_tenant(database: database, role: role, prevent_writes: prevent_writes) do
13
+ Apartment::Tenant.switch!(current_tenant)
14
+ yield(blk)
15
+ end
16
+ end
17
+ else
18
+ def connected_to_with_tenant(role: nil, prevent_writes: false, &blk)
19
+ current_tenant = Apartment::Tenant.current
20
+
21
+ connected_to_without_tenant(role: role, prevent_writes: prevent_writes) do
22
+ Apartment::Tenant.switch!(current_tenant)
23
+ yield(blk)
24
+ end
14
25
  end
15
26
  end
16
27
 
@@ -8,6 +8,10 @@
8
8
  module Apartment::PostgreSqlAdapterPatch
9
9
  def default_sequence_name(table, _column)
10
10
  res = super
11
+
12
+ # for JDBC driver, if rescued in super_method, trim leading and trailing quotes
13
+ res.delete!('"') if defined?(JRUBY_VERSION)
14
+
11
15
  schema_prefix = "#{Apartment::Tenant.current}."
12
16
  default_tenant_prefix = "#{Apartment::Tenant.default_tenant}."
13
17
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecord
4
- class SchemaMigration < ActiveRecord::Base # :nodoc:
4
+ class SchemaMigration # :nodoc:
5
5
  class << self
6
6
  def table_exists?
7
7
  connection.table_exists?(table_name)