ros-apartment 2.8.1.rc1 → 2.10.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: f446466c85cecc098b1fec480bd1400bc849ea49ea4f7b5607c1bb3bd46ab6b6
4
- data.tar.gz: ed713631a71b9b9948f942f25f6cb5dba586a41dcdebe40f14fdef6effccf25c
3
+ metadata.gz: 9729bd0cd46375da3b48c1aad59bd2de396f90e9a7cd92d24dafee964988cbc4
4
+ data.tar.gz: 1e0b6a955a15691edcbbb680657d1a65c75c7b49cd93e342d4df7212d29313c5
5
5
  SHA512:
6
- metadata.gz: a7bf926bd676c7025c1567063b1b97eb01993e7d6f4821ff8e103e9b1057791712a8590247191070764fdbbfd17dc70cc54848fee5c5a7e5379315eda4554cb5
7
- data.tar.gz: 86375a0c10ce05b3a2e9c217c9c0e574a643725fcba1f98631165d7e8682f9d840d152238d24370ebc55d2713989ff47d633e35fd7c2cdde171443cbcbc3dd07
6
+ metadata.gz: 9f12f51635a20b87a5a8bddcd00eceac5ccd355699e2932947689a929695b1ad4337528da976a7905c31ed91413ee41eddc6f2ce7aed1d79f7643073b50053fa
7
+ data.tar.gz: 617c702d5f698a3a8b81649f10bb91373ff9fabab4755270ffc2289a44ea7b48b814f939c4363bb23d45a378f1f444963188980ea0acc1e5b76cd7d28207e3f3
@@ -0,0 +1,76 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ build:
5
+ docker:
6
+ - image: circleci/<< parameters.ruby_version >>
7
+ - image: circleci/postgres:9.6.2-alpine
8
+ - image: circleci/mysql:5.7
9
+ environment:
10
+ MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
11
+ parameters:
12
+ ruby_version:
13
+ type: string
14
+ gemfile:
15
+ type: string
16
+ environment:
17
+ BUNDLE_GEMFILE: << parameters.gemfile >>
18
+ steps:
19
+ - checkout
20
+ # Restore Cached Dependencies
21
+ # - restore_cache:
22
+ # keys:
23
+ # - gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "<< parameters.gemfile >>.lock" }}
24
+ # - gem-cache-v1-{{ arch }}-{{ .Branch }}
25
+ # - gem-cache-v1
26
+
27
+ - run: bundle install --path vendor/bundle
28
+
29
+ # - save_cache:
30
+ # key: gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "<< parameters.gemfile >>.lock" }}
31
+ # paths:
32
+ # - vendor/bundle
33
+
34
+ - run:
35
+ name: Install postgres client
36
+ command: sudo apt install -y postgresql-client
37
+
38
+ - run:
39
+ name: Install mysql client
40
+ command: sudo apt install -y default-mysql-client
41
+
42
+ - run:
43
+ name: Configure config database.yml
44
+ command: bundle exec rake db:copy_credentials
45
+
46
+ - run:
47
+ name: wait for postgresql
48
+ command: dockerize -wait tcp://localhost:5432 -timeout 1m
49
+
50
+ - run:
51
+ name: wait for mysql
52
+ command: dockerize -wait tcp://localhost:3306 -timeout 1m
53
+
54
+ - run:
55
+ name: Database Setup
56
+ command: |
57
+ bundle exec rake db:test:prepare
58
+
59
+ - run:
60
+ name: Run tests
61
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o ~/test-results/rspec/rspec.xml
62
+
63
+ - store_test_results:
64
+ path: ~/test-results/rspec/
65
+
66
+ workflows:
67
+ tests:
68
+ jobs:
69
+ - build:
70
+ matrix:
71
+ parameters:
72
+ ruby_version: ["ruby:2.6-buster", "ruby:2.7-buster", "ruby:3.0-buster"]
73
+ gemfile: ["gemfiles/rails_5_2.gemfile", "gemfiles/rails_6_0.gemfile", "gemfiles/rails_6_1.gemfile"]
74
+ exclude:
75
+ - ruby_version: "ruby:3.0-buster"
76
+ gemfile: "gemfiles/rails_5_2.gemfile"
@@ -0,0 +1,22 @@
1
+ name: reviewdog
2
+ on: [push, pull_request]
3
+ jobs:
4
+ rubocop:
5
+ name: runner / rubocop
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - name: Check out code
9
+ uses: actions/checkout@v2
10
+ - name: Read ruby version
11
+ run: echo ::set-output name=RUBY_VERSION::$(cat .ruby-version | cut -f 1,2 -d .)
12
+ id: rv
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: "${{ steps.rv.outputs.RUBY_VERSION }}"
16
+ - uses: reviewdog/action-rubocop@v1
17
+ with:
18
+ filter_mode: nofilter
19
+ reporter: github-check
20
+ rubocop_version: 0.93.1
21
+ github_token: ${{ secrets.github_token }}
22
+ rubocop_extensions: rubocop-performance:1.10.2 rubocop-rails:2.9.1 rubocop-rspec:1.44.1
data/.rubocop.yml CHANGED
@@ -1,91 +1,32 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- AllCops:
4
- Exclude:
5
- - 'gemfiles/**/*.gemfile'
6
- - 'gemfiles/vendor/**/*'
3
+ require:
4
+ - rubocop-rails
5
+ - rubocop-performance
6
+ - rubocop-rspec
7
7
 
8
- Style/WordArray:
8
+ AllCops:
9
9
  Exclude:
10
+ - gemfiles/**/*.gemfile
11
+ - gemfiles/vendor/**/*
12
+ - spec/dummy_engine/dummy_engine.gemspec
10
13
  - spec/schemas/**/*.rb
11
14
 
12
- Style/NumericLiterals:
13
- Exclude:
14
- - spec/schemas/**/*.rb
15
+ NewCops: enable
15
16
 
16
- Layout/EmptyLineAfterMagicComment:
17
+ Gemspec/RequiredRubyVersion:
17
18
  Exclude:
18
- - spec/schemas/**/*.rb
19
+ - 'ros-apartment.gemspec'
19
20
 
20
21
  Metrics/BlockLength:
21
22
  Exclude:
22
23
  - spec/**/*.rb
23
24
 
24
- Layout/EmptyLinesAroundAttributeAccessor:
25
- Enabled: true
26
-
27
- Layout/SpaceAroundMethodCallOperator:
28
- Enabled: true
29
-
30
- Lint/DeprecatedOpenSSLConstant:
31
- Enabled: true
32
-
33
- Lint/DuplicateElsifCondition:
34
- Enabled: true
35
-
36
- Lint/MixedRegexpCaptureTypes:
37
- Enabled: true
38
-
39
- Lint/RaiseException:
40
- Enabled: true
41
-
42
- Lint/StructNewOverride:
43
- Enabled: true
44
-
45
- Style/AccessorGrouping:
46
- Enabled: true
47
-
48
- Style/ArrayCoercion:
49
- Enabled: true
50
-
51
- Style/BisectedAttrAccessor:
52
- Enabled: true
53
-
54
- Style/CaseLikeIf:
55
- Enabled: true
56
-
57
- Style/ExponentialNotation:
58
- Enabled: true
59
-
60
- Style/HashAsLastArrayItem:
61
- Enabled: true
62
-
63
- Style/HashEachMethods:
64
- Enabled: true
65
-
66
- Style/HashLikeCase:
67
- Enabled: true
68
-
69
- Style/HashTransformKeys:
70
- Enabled: true
71
-
72
- Style/HashTransformValues:
73
- Enabled: true
74
-
75
- Style/RedundantAssignment:
76
- Enabled: true
77
-
78
- Style/RedundantFetchBlock:
79
- Enabled: true
80
-
81
- Style/RedundantFileExtensionInRequire:
82
- Enabled: true
83
-
84
- Style/RedundantRegexpCharacterClass:
85
- Enabled: true
25
+ Rails/RakeEnvironment:
26
+ Enabled: false
86
27
 
87
- Style/RedundantRegexpEscape:
88
- Enabled: true
28
+ Rails/ApplicationRecord:
29
+ Enabled: false
89
30
 
90
- Style/SlicingWithRange:
91
- Enabled: true
31
+ Rails/Output:
32
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-07-16 04:15:41 UTC using RuboCop version 0.88.0.
3
+ # on 2021-06-26 03:25:28 UTC using RuboCop version 0.93.1.
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
@@ -11,22 +11,16 @@ Lint/MixedRegexpCaptureTypes:
11
11
  Exclude:
12
12
  - 'lib/apartment/elevators/domain.rb'
13
13
 
14
- # Offense count: 2
15
- # Cop supports --auto-correct.
16
- Lint/NonDeterministicRequireOrder:
17
- Exclude:
18
- - 'spec/spec_helper.rb'
19
-
20
- # Offense count: 7
14
+ # Offense count: 3
21
15
  # Configuration parameters: IgnoredMethods.
22
16
  Metrics/AbcSize:
23
- Max: 33
17
+ Max: 28
24
18
 
25
- # Offense count: 3
19
+ # Offense count: 5
26
20
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
27
21
  # ExcludedMethods: refine
28
22
  Metrics/BlockLength:
29
- Max: 102
23
+ Max: 83
30
24
 
31
25
  # Offense count: 1
32
26
  # Configuration parameters: CountComments, CountAsOne.
@@ -38,6 +32,193 @@ Metrics/ClassLength:
38
32
  Metrics/MethodLength:
39
33
  Max: 24
40
34
 
35
+ # Offense count: 3
36
+ RSpec/AnyInstance:
37
+ Exclude:
38
+ - 'spec/unit/migrator_spec.rb'
39
+
40
+ # Offense count: 2
41
+ RSpec/BeforeAfterAll:
42
+ Exclude:
43
+ - 'spec/spec_helper.rb'
44
+ - 'spec/rails_helper.rb'
45
+ - 'spec/support/**/*.rb'
46
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
47
+ - 'spec/tasks/apartment_rake_spec.rb'
48
+
49
+ # Offense count: 18
50
+ # Configuration parameters: Prefixes.
51
+ # Prefixes: when, with, without
52
+ RSpec/ContextWording:
53
+ Exclude:
54
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
55
+ - 'spec/examples/generic_adapter_custom_configuration_example.rb'
56
+ - 'spec/examples/schema_adapter_examples.rb'
57
+ - 'spec/support/contexts.rb'
58
+ - 'spec/tasks/apartment_rake_spec.rb'
59
+ - 'spec/tenant_spec.rb'
60
+
61
+ # Offense count: 4
62
+ # Configuration parameters: IgnoredMetadata.
63
+ RSpec/DescribeClass:
64
+ Exclude:
65
+ - 'spec/integration/apartment_rake_integration_spec.rb'
66
+ - 'spec/integration/query_caching_spec.rb'
67
+ - 'spec/integration/use_within_an_engine_spec.rb'
68
+ - 'spec/tasks/apartment_rake_spec.rb'
69
+
70
+ # Offense count: 12
71
+ # Cop supports --auto-correct.
72
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
73
+ # SupportedStyles: described_class, explicit
74
+ RSpec/DescribedClass:
75
+ Exclude:
76
+ - 'spec/apartment_spec.rb'
77
+ - 'spec/tenant_spec.rb'
78
+ - 'spec/unit/elevators/host_hash_spec.rb'
79
+ - 'spec/unit/migrator_spec.rb'
80
+ - 'spec/unit/reloader_spec.rb'
81
+
82
+ # Offense count: 5
83
+ # Cop supports --auto-correct.
84
+ RSpec/EmptyLineAfterFinalLet:
85
+ Exclude:
86
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
87
+ - 'spec/examples/schema_adapter_examples.rb'
88
+
89
+ # Offense count: 14
90
+ # Configuration parameters: Max.
91
+ RSpec/ExampleLength:
92
+ Exclude:
93
+ - 'spec/examples/generic_adapter_custom_configuration_example.rb'
94
+ - 'spec/examples/generic_adapter_examples.rb'
95
+ - 'spec/examples/schema_adapter_examples.rb'
96
+ - 'spec/integration/query_caching_spec.rb'
97
+ - 'spec/tenant_spec.rb'
98
+
99
+ # Offense count: 60
100
+ # Cop supports --auto-correct.
101
+ # Configuration parameters: CustomTransform, IgnoredWords.
102
+ RSpec/ExampleWording:
103
+ Exclude:
104
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
105
+ - 'spec/apartment_spec.rb'
106
+ - 'spec/examples/connection_adapter_examples.rb'
107
+ - 'spec/examples/generic_adapter_custom_configuration_example.rb'
108
+ - 'spec/examples/generic_adapter_examples.rb'
109
+ - 'spec/examples/schema_adapter_examples.rb'
110
+ - 'spec/integration/apartment_rake_integration_spec.rb'
111
+ - 'spec/integration/use_within_an_engine_spec.rb'
112
+ - 'spec/tasks/apartment_rake_spec.rb'
113
+ - 'spec/tenant_spec.rb'
114
+
115
+ # Offense count: 13
116
+ # Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
117
+ RSpec/FilePath:
118
+ Exclude:
119
+ - 'spec/adapters/mysql2_adapter_spec.rb'
120
+ - 'spec/adapters/postgresql_adapter_spec.rb'
121
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
122
+ - 'spec/tenant_spec.rb'
123
+ - 'spec/unit/config_spec.rb'
124
+ - 'spec/unit/elevators/domain_spec.rb'
125
+ - 'spec/unit/elevators/first_subdomain_spec.rb'
126
+ - 'spec/unit/elevators/generic_spec.rb'
127
+ - 'spec/unit/elevators/host_hash_spec.rb'
128
+ - 'spec/unit/elevators/host_spec.rb'
129
+ - 'spec/unit/elevators/subdomain_spec.rb'
130
+ - 'spec/unit/migrator_spec.rb'
131
+ - 'spec/unit/reloader_spec.rb'
132
+
133
+ # Offense count: 1
134
+ # Cop supports --auto-correct.
135
+ # Configuration parameters: EnforcedStyle.
136
+ # SupportedStyles: implicit, each, example
137
+ RSpec/HookArgument:
138
+ Exclude:
139
+ - 'spec/support/setup.rb'
140
+
141
+ # Offense count: 4
142
+ # Cop supports --auto-correct.
143
+ RSpec/HooksBeforeExamples:
144
+ Exclude:
145
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
146
+ - 'spec/examples/schema_adapter_examples.rb'
147
+
148
+ # Offense count: 18
149
+ # Configuration parameters: AssignmentOnly.
150
+ RSpec/InstanceVariable:
151
+ Exclude:
152
+ - 'spec/examples/generic_adapter_examples.rb'
153
+ - 'spec/examples/schema_adapter_examples.rb'
154
+ - 'spec/integration/apartment_rake_integration_spec.rb'
155
+ - 'spec/integration/use_within_an_engine_spec.rb'
156
+ - 'spec/tasks/apartment_rake_spec.rb'
157
+
158
+ # Offense count: 1
159
+ # Cop supports --auto-correct.
160
+ RSpec/LeadingSubject:
161
+ Exclude:
162
+ - 'spec/unit/reloader_spec.rb'
163
+
164
+ # Offense count: 2
165
+ RSpec/LeakyConstantDeclaration:
166
+ Exclude:
167
+ - 'spec/examples/generic_adapters_callbacks_examples.rb'
168
+ - 'spec/unit/elevators/generic_spec.rb'
169
+
170
+ # Offense count: 35
171
+ # Configuration parameters: EnforcedStyle.
172
+ # SupportedStyles: have_received, receive
173
+ RSpec/MessageSpies:
174
+ Exclude:
175
+ - 'spec/examples/generic_adapter_custom_configuration_example.rb'
176
+ - 'spec/integration/apartment_rake_integration_spec.rb'
177
+ - 'spec/integration/use_within_an_engine_spec.rb'
178
+ - 'spec/tasks/apartment_rake_spec.rb'
179
+ - 'spec/unit/elevators/domain_spec.rb'
180
+ - 'spec/unit/elevators/generic_spec.rb'
181
+ - 'spec/unit/elevators/host_hash_spec.rb'
182
+ - 'spec/unit/elevators/host_spec.rb'
183
+ - 'spec/unit/elevators/subdomain_spec.rb'
184
+ - 'spec/unit/migrator_spec.rb'
185
+
186
+ # Offense count: 29
187
+ RSpec/MultipleExpectations:
188
+ Max: 4
189
+
190
+ # Offense count: 47
191
+ # Configuration parameters: IgnoreSharedExamples.
192
+ RSpec/NamedSubject:
193
+ Exclude:
194
+ - 'spec/adapters/mysql2_adapter_spec.rb'
195
+ - 'spec/adapters/sqlite3_adapter_spec.rb'
196
+ - 'spec/support/contexts.rb'
197
+ - 'spec/support/requirements.rb'
198
+ - 'spec/tenant_spec.rb'
199
+ - 'spec/unit/reloader_spec.rb'
200
+
201
+ # Offense count: 24
202
+ RSpec/NestedGroups:
203
+ Max: 5
204
+
205
+ # Offense count: 6
206
+ # Cop supports --auto-correct.
207
+ # Configuration parameters: EnforcedStyle.
208
+ # SupportedStyles: and_return, block
209
+ RSpec/ReturnFromStub:
210
+ Exclude:
211
+ - 'spec/integration/apartment_rake_integration_spec.rb'
212
+ - 'spec/unit/migrator_spec.rb'
213
+
214
+ # Offense count: 4
215
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
216
+ RSpec/VerifiedDoubles:
217
+ Exclude:
218
+ - 'spec/integration/apartment_rake_integration_spec.rb'
219
+ - 'spec/unit/elevators/first_subdomain_spec.rb'
220
+ - 'spec/unit/reloader_spec.rb'
221
+
41
222
  # Offense count: 17
42
223
  Style/Documentation:
43
224
  Exclude:
@@ -56,11 +237,3 @@ Style/Documentation:
56
237
  - 'lib/apartment/tasks/enhancements.rb'
57
238
  - 'lib/apartment/tasks/task_helper.rb'
58
239
  - 'lib/generators/apartment/install/install_generator.rb'
59
-
60
- # Offense count: 3
61
- # Cop supports --auto-correct.
62
- Style/IfUnlessModifier:
63
- Exclude:
64
- - 'Rakefile'
65
- - 'lib/apartment.rb'
66
- - 'lib/apartment/tenant.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.3
data/Appraisals CHANGED
@@ -45,14 +45,26 @@ appraise 'rails-6-0' do
45
45
  end
46
46
  end
47
47
 
48
+ appraise 'rails-6-1' do
49
+ gem 'rails', '~> 6.1.0'
50
+ platforms :ruby do
51
+ gem 'sqlite3', '~> 1.4'
52
+ end
53
+ platforms :jruby do
54
+ gem 'activerecord-jdbc-adapter', '~> 61.0'
55
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 61.0'
56
+ gem 'activerecord-jdbcmysql-adapter', '~> 61.0'
57
+ end
58
+ end
59
+
48
60
  appraise 'rails-master' do
49
61
  gem 'rails', git: 'https://github.com/rails/rails.git'
50
62
  platforms :ruby do
51
63
  gem 'sqlite3', '~> 1.4'
52
64
  end
53
65
  platforms :jruby do
54
- gem 'activerecord-jdbc-adapter', '~> 52.0'
55
- gem 'activerecord-jdbcpostgresql-adapter', '~> 52.0'
56
- gem 'activerecord-jdbcmysql-adapter', '~> 52.0'
66
+ gem 'activerecord-jdbc-adapter', '~> 61.0'
67
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 61.0'
68
+ gem 'activerecord-jdbcmysql-adapter', '~> 61.0'
57
69
  end
58
70
  end
data/CHANGELOG.md CHANGED
@@ -9,6 +9,7 @@
9
9
  **Fixed bugs:**
10
10
 
11
11
  - New version raises an error with ActiveSupport::LogSubscriber [#128](https://github.com/rails-on-services/apartment/issues/128)
12
+ - Weird logs when tenant fails to create [#127](<https://github.com/rails-on-services/apartment/issues/127>)
12
13
 
13
14
  **Closed issues:**
14
15
 
data/Gemfile CHANGED
@@ -3,11 +3,3 @@
3
3
  source 'http://rubygems.org'
4
4
 
5
5
  gemspec
6
-
7
- gem 'rails', '>= 3.1.2'
8
- gem 'rubocop'
9
-
10
- group :local do
11
- gem 'guard-rspec', '~> 4.2'
12
- gem 'pry'
13
- end
data/README.md CHANGED
@@ -101,6 +101,16 @@ switched back at the end of the block to what it was before.
101
101
  There is also `switch!` which doesn't take a block, but it's recommended to use `switch`.
102
102
  To return to the default tenant, you can call `switch` with no arguments.
103
103
 
104
+ #### Multiple Tenants
105
+
106
+ When using schemas, you can also pass in a list of schemas if desired. Any tables defined in a schema earlier in the chain will be referenced first, so this is only useful if you have a schema with only some of the tables defined:
107
+
108
+ ```ruby
109
+ Apartment::Tenant.switch(['tenant_1', 'tenant_2']) do
110
+ # ...
111
+ end
112
+ ```
113
+
104
114
  ### Switching Tenants per request
105
115
 
106
116
  You can have Apartment route to the appropriate tenant by adding some Rack middleware.
@@ -351,7 +361,7 @@ Please note that our custom logger inherits from `ActiveRecord::LogSubscriber` s
351
361
 
352
362
  ```ruby
353
363
  Apartment.configure do |config|
354
- active_record_log = true
364
+ config.active_record_log = true
355
365
  end
356
366
  ```
357
367
 
data/Rakefile CHANGED
@@ -47,9 +47,9 @@ namespace :db do
47
47
  rails_db_file = 'spec/dummy/config/database.yml'
48
48
 
49
49
  unless File.exist?(apartment_db_file)
50
- FileUtils.copy(apartment_db_file + '.sample', apartment_db_file, verbose: true)
50
+ FileUtils.copy("#{apartment_db_file}.sample", apartment_db_file, verbose: true)
51
51
  end
52
- FileUtils.copy(rails_db_file + '.sample', rails_db_file, verbose: true) unless File.exist?(rails_db_file)
52
+ FileUtils.copy("#{rails_db_file}.sample", rails_db_file, verbose: true) unless File.exist?(rails_db_file)
53
53
  end
54
54
  end
55
55
 
@@ -65,6 +65,7 @@ namespace :postgres do
65
65
  params << "-U#{pg_config['username']}"
66
66
  params << "-h#{pg_config['host']}" if pg_config['host']
67
67
  params << "-p#{pg_config['port']}" if pg_config['port']
68
+
68
69
  begin
69
70
  `createdb #{params.join(' ')}`
70
71
  rescue StandardError
@@ -0,0 +1,23 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~> 6.1.0"
6
+ gem "rubocop"
7
+
8
+ group :local do
9
+ gem "guard-rspec", "~> 4.2"
10
+ gem "pry"
11
+ end
12
+
13
+ platforms :ruby do
14
+ gem "sqlite3", "~> 1.4"
15
+ end
16
+
17
+ platforms :jruby do
18
+ gem "activerecord-jdbc-adapter", "~> 61.0"
19
+ gem "activerecord-jdbcpostgresql-adapter", "~> 61.0"
20
+ gem "activerecord-jdbcmysql-adapter", "~> 61.0"
21
+ end
22
+
23
+ gemspec path: "../"
@@ -201,11 +201,13 @@ module Apartment
201
201
  # @param {String} tenant: Database name
202
202
  # @param {Boolean} with_database: if true, use the actual tenant's db name
203
203
  # if false, use the default db name from the db
204
+ # rubocop:disable Style/OptionalBooleanParameter
204
205
  def multi_tenantify(tenant, with_database = true)
205
206
  db_connection_config(tenant).tap do |config|
206
207
  multi_tenantify_with_tenant_db_name(config, tenant) if with_database
207
208
  end
208
209
  end
210
+ # rubocop:enable Style/OptionalBooleanParameter
209
211
 
210
212
  def multi_tenantify_with_tenant_db_name(config, tenant)
211
213
  config[:database] = environmentify(tenant)
@@ -38,11 +38,9 @@ module Apartment
38
38
  #
39
39
  def connect_to_new(tenant = nil)
40
40
  return reset if tenant.nil?
41
+ raise ActiveRecord::StatementInvalid, "Could not find schema #{tenant}" unless schema_exists?(tenant)
41
42
 
42
- tenant = tenant.to_s
43
- raise ActiveRecord::StatementInvalid, "Could not find schema #{tenant}" unless tenant_exists?(tenant)
44
-
45
- @current = tenant
43
+ @current = tenant.is_a?(Array) ? tenant.map(&:to_s) : tenant.to_s
46
44
  Apartment.connection.schema_search_path = full_search_path
47
45
  rescue ActiveRecord::StatementInvalid, ActiveRecord::JDBCError
48
46
  raise TenantNotFound, "One of the following schema(s) is invalid: #{full_search_path}"
@@ -72,11 +72,9 @@ module Apartment
72
72
  #
73
73
  def connect_to_new(tenant = nil)
74
74
  return reset if tenant.nil?
75
+ raise ActiveRecord::StatementInvalid, "Could not find schema #{tenant}" unless schema_exists?(tenant)
75
76
 
76
- tenant = tenant.to_s
77
- raise ActiveRecord::StatementInvalid, "Could not find schema #{tenant}" unless tenant_exists?(tenant)
78
-
79
- @current = tenant
77
+ @current = tenant.is_a?(Array) ? tenant.map(&:to_s) : tenant.to_s
80
78
  Apartment.connection.schema_search_path = full_search_path
81
79
 
82
80
  # When the PostgreSQL version is < 9.3,
@@ -98,7 +96,7 @@ module Apartment
98
96
 
99
97
  def create_tenant_command(conn, tenant)
100
98
  # NOTE: This was causing some tests to fail because of the database strategy for rspec
101
- if ActiveRecord::Base.connection.open_transactions > 0
99
+ if ActiveRecord::Base.connection.open_transactions.positive?
102
100
  conn.execute(%(CREATE SCHEMA "#{tenant}"))
103
101
  else
104
102
  schema = %(BEGIN;
@@ -113,7 +111,7 @@ module Apartment
113
111
  end
114
112
 
115
113
  def rollback_transaction(conn)
116
- conn.execute("ROLLBACK;")
114
+ conn.execute('ROLLBACK;')
117
115
  end
118
116
 
119
117
  # Generate the final search path to set including persistent_schemas
@@ -149,6 +147,12 @@ module Apartment
149
147
  c.remove_instance_variable :@sequence_name if c.instance_variable_defined?(:@sequence_name)
150
148
  end
151
149
  end
150
+
151
+ def schema_exists?(schemas)
152
+ return true unless Apartment.tenant_presence_check
153
+
154
+ Array(schemas).all? { |schema| Apartment.connection.schema_exists?(schema.to_s) }
155
+ end
152
156
  end
153
157
 
154
158
  # Another Adapter for Postgresql when using schemas and SQL
@@ -158,6 +162,7 @@ module Apartment
158
162
  /SET lock_timeout/i, # new in postgresql 9.3
159
163
  /SET row_security/i, # new in postgresql 9.5
160
164
  /SET idle_in_transaction_session_timeout/i, # new in postgresql 9.6
165
+ /SET default_table_access_method/i, # new in postgresql 12
161
166
  /CREATE SCHEMA public/i,
162
167
  /COMMENT ON SCHEMA public/i
163
168
 
@@ -224,7 +229,7 @@ module Apartment
224
229
 
225
230
  # Temporary set Postgresql related environment variables if there are in @config
226
231
  #
227
- def with_pg_env(&block)
232
+ def with_pg_env
228
233
  pghost = ENV['PGHOST']
229
234
  pgport = ENV['PGPORT']
230
235
  pguser = ENV['PGUSER']
@@ -235,7 +240,7 @@ module Apartment
235
240
  ENV['PGUSER'] = @config[:username].to_s if @config[:username]
236
241
  ENV['PGPASSWORD'] = @config[:password].to_s if @config[:password]
237
242
 
238
- block.call
243
+ yield
239
244
  ensure
240
245
  ENV['PGHOST'] = pghost
241
246
  ENV['PGPORT'] = pgport
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # A workaraound to get `reload!` to also call Apartment::Tenant.init
3
+ # A workaround to get `reload!` to also call Apartment::Tenant.init
4
4
  # This is unfortunate, but I haven't figured out how to hook into the reload process *after* files are reloaded
5
5
 
6
6
  # reloads the environment
7
+ # rubocop:disable Style/OptionalBooleanParameter
7
8
  def reload!(print = true)
8
9
  puts 'Reloading...' if print
9
10
 
@@ -13,6 +14,7 @@ def reload!(print = true)
13
14
  Apartment::Tenant.init
14
15
  true
15
16
  end
17
+ # rubocop:enable Style/OptionalBooleanParameter
16
18
 
17
19
  def st(schema_name = nil)
18
20
  if schema_name.nil?
@@ -3,10 +3,14 @@
3
3
  require 'active_record/log_subscriber'
4
4
 
5
5
  module Apartment
6
+ # Custom Log subscriber to include database name and schema name in sql logs
6
7
  class LogSubscriber < ActiveRecord::LogSubscriber
8
+ # NOTE: for some reason, if the method definition is not here, then the custom debug method is not called
9
+ # rubocop:disable Lint/UselessMethodDefinition
7
10
  def sql(event)
8
11
  super(event)
9
12
  end
13
+ # rubocop:enable Lint/UselessMethodDefinition
10
14
 
11
15
  private
12
16
 
@@ -17,7 +21,7 @@ module Apartment
17
21
  end
18
22
 
19
23
  def apartment_log
20
- database = color("[#{Apartment.connection.current_database}] ", ActiveSupport::LogSubscriber::MAGENTA, true)
24
+ database = color("[#{Apartment.connection.raw_connection.db}] ", ActiveSupport::LogSubscriber::MAGENTA, true)
21
25
  schema = nil
22
26
  unless Apartment.connection.schema_search_path.nil?
23
27
  schema = color("[#{Apartment.connection.schema_search_path.tr('"', '')}] ",
@@ -17,7 +17,9 @@ module Apartment
17
17
  cache_key = if key.is_a? String
18
18
  "#{Apartment::Tenant.current}_#{key}"
19
19
  else
20
- [Apartment::Tenant.current] + key
20
+ # NOTE: In Rails 6.0.4 we start receiving an ActiveRecord::Reflection::BelongsToReflection
21
+ # as the key, which wouldn't work well with an array.
22
+ [Apartment::Tenant.current] + Array.wrap(key)
21
23
  end
22
24
  cache = @find_by_statement_cache[connection.prepared_statements]
23
25
  cache.compute_if_absent(cache_key) { ActiveRecord::StatementCache.create(connection, &block) }
@@ -6,7 +6,6 @@ require 'apartment/reloader'
6
6
 
7
7
  module Apartment
8
8
  class Railtie < Rails::Railtie
9
-
10
9
  #
11
10
  # Set up our default config options
12
11
  # Do this before the app initializers run so we don't override custom settings
@@ -27,13 +26,14 @@ module Apartment
27
26
  end
28
27
 
29
28
  # Hook into ActionDispatch::Reloader to ensure Apartment is properly initialized
30
- # Note that this doens't entirely work as expected in Development, because this is called before classes are reloaded
29
+ # Note that this doesn't entirely work as expected in Development,
30
+ # because this is called before classes are reloaded
31
31
  # See the middleware/console declarations below to help with this. Hope to fix that soon.
32
32
  #
33
33
  config.to_prepare do
34
34
  next if ARGV.any? { |arg| arg =~ /\Aassets:(?:precompile|clean)\z/ }
35
- next if ARGV.any? { |arg| arg == 'webpacker:compile' }
36
- next if ENV["APARTMENT_DISABLE_INIT"]
35
+ next if ARGV.any?('webpacker:compile')
36
+ next if ENV['APARTMENT_DISABLE_INIT']
37
37
 
38
38
  begin
39
39
  Apartment.connection_class.connection_pool.with_connection do
@@ -45,7 +45,7 @@ module Apartment
45
45
  end
46
46
  end
47
47
 
48
- config.after_initialize do |app|
48
+ config.after_initialize do
49
49
  # NOTE: Load the custom log subscriber if enabled
50
50
  if Apartment.active_record_log
51
51
  ActiveSupport::Notifications.unsubscribe 'sql.active_record'
@@ -72,7 +72,8 @@ module Apartment
72
72
  app.config.middleware.use Apartment::Reloader
73
73
  end
74
74
 
75
- # Overrides reload! to also call Apartment::Tenant.init as well so that the reloaded classes have the proper table_names
75
+ # Overrides reload! to also call Apartment::Tenant.init as well
76
+ # so that the reloaded classes have the proper table_names
76
77
  console do
77
78
  require 'apartment/console'
78
79
  end
@@ -36,5 +36,17 @@ module Apartment
36
36
  rescue Apartment::TenantExists => e
37
37
  puts "Tried to create already existing tenant: #{e}"
38
38
  end
39
+
40
+ def self.migrate_tenant(tenant_name)
41
+ strategy = Apartment.db_migrate_tenant_missing_strategy
42
+ create_tenant(tenant_name) if strategy == :create_tenant
43
+
44
+ puts("Migrating #{tenant_name} tenant")
45
+ Apartment::Migrator.migrate tenant_name
46
+ rescue Apartment::TenantNotFound => e
47
+ raise e if strategy == :raise_exception
48
+
49
+ puts e.message
50
+ end
39
51
  end
40
52
  end
@@ -10,8 +10,7 @@ module Apartment
10
10
  extend Forwardable
11
11
 
12
12
  def_delegators :adapter, :create, :drop, :switch, :switch!, :current, :each,
13
- :reset, :init, :set_callback, :seed, :current_tenant,
14
- :default_tenant, :environmentify
13
+ :reset, :init, :set_callback, :seed, :default_tenant, :environmentify
15
14
 
16
15
  attr_writer :config
17
16
 
@@ -24,9 +23,10 @@ module Apartment
24
23
  adapter_method = "#{config[:adapter]}_adapter"
25
24
 
26
25
  if defined?(JRUBY_VERSION)
27
- if config[:adapter] =~ /mysql/
26
+ case config[:adapter]
27
+ when /mysql/
28
28
  adapter_method = 'jdbc_mysql_adapter'
29
- elsif config[:adapter] =~ /postgresql/
29
+ when /postgresql/
30
30
  adapter_method = 'jdbc_postgresql_adapter'
31
31
  end
32
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Apartment
4
- VERSION = '2.8.1.rc1'
4
+ VERSION = '2.10.0'
5
5
  end
data/lib/apartment.rb CHANGED
@@ -27,7 +27,7 @@ module Apartment
27
27
 
28
28
  WRITER_METHODS = %i[tenant_names database_schema_file excluded_models
29
29
  persistent_schemas connection_class
30
- db_migrate_tenants seed_data_file
30
+ db_migrate_tenants db_migrate_tenant_missing_strategy seed_data_file
31
31
  parallel_migration_threads pg_excluded_names].freeze
32
32
 
33
33
  attr_accessor(*ACCESSOR_METHODS)
@@ -72,6 +72,21 @@ module Apartment
72
72
  @db_migrate_tenants = true
73
73
  end
74
74
 
75
+ # How to handle tenant missing on db:migrate
76
+ # defaults to :rescue_exception
77
+ # available options: rescue_exception, raise_exception, create_tenant
78
+ def db_migrate_tenant_missing_strategy
79
+ valid = %i[rescue_exception raise_exception create_tenant]
80
+ value = @db_migrate_tenant_missing_strategy || :rescue_exception
81
+
82
+ return value if valid.include?(value)
83
+
84
+ key_name = 'config.db_migrate_tenant_missing_strategy'
85
+ opt_names = valid.join(', ')
86
+
87
+ raise ApartmentError, "Option #{value} not valid for `#{key_name}`. Use one of #{opt_names}"
88
+ end
89
+
75
90
  # Default to empty array
76
91
  def excluded_models
77
92
  @excluded_models || []
@@ -92,13 +107,13 @@ module Apartment
92
107
  def database_schema_file
93
108
  return @database_schema_file if defined?(@database_schema_file)
94
109
 
95
- @database_schema_file = Rails.root.join('db', 'schema.rb')
110
+ @database_schema_file = Rails.root.join('db/schema.rb')
96
111
  end
97
112
 
98
113
  def seed_data_file
99
114
  return @seed_data_file if defined?(@seed_data_file)
100
115
 
101
- @seed_data_file = Rails.root.join('db', 'seeds.rb')
116
+ @seed_data_file = Rails.root.join('db/seeds.rb')
102
117
  end
103
118
 
104
119
  def pg_excluded_names
@@ -17,12 +17,10 @@ apartment_namespace = namespace :apartment do
17
17
  desc 'Drop all tenants'
18
18
  task :drop do
19
19
  Apartment::TaskHelper.tenants.each do |tenant|
20
- begin
21
- puts("Dropping #{tenant} tenant")
22
- Apartment::Tenant.drop(tenant)
23
- rescue Apartment::TenantNotFound, ActiveRecord::NoDatabaseError => e
24
- puts e.message
25
- end
20
+ puts("Dropping #{tenant} tenant")
21
+ Apartment::Tenant.drop(tenant)
22
+ rescue Apartment::TenantNotFound, ActiveRecord::NoDatabaseError => e
23
+ puts e.message
26
24
  end
27
25
  end
28
26
 
@@ -30,13 +28,7 @@ apartment_namespace = namespace :apartment do
30
28
  task :migrate do
31
29
  Apartment::TaskHelper.warn_if_tenants_empty
32
30
  Apartment::TaskHelper.each_tenant do |tenant|
33
- begin
34
- Apartment::TaskHelper.create_tenant(tenant)
35
- puts("Migrating #{tenant} tenant")
36
- Apartment::Migrator.migrate tenant
37
- rescue Apartment::TenantNotFound => e
38
- puts e.message
39
- end
31
+ Apartment::TaskHelper.migrate_tenant(tenant)
40
32
  end
41
33
  end
42
34
 
@@ -45,15 +37,13 @@ apartment_namespace = namespace :apartment do
45
37
  Apartment::TaskHelper.warn_if_tenants_empty
46
38
 
47
39
  Apartment::TaskHelper.each_tenant do |tenant|
48
- begin
49
- Apartment::TaskHelper.create_tenant(tenant)
50
- puts("Seeding #{tenant} tenant")
51
- Apartment::Tenant.switch(tenant) do
52
- Apartment::Tenant.seed
53
- end
54
- rescue Apartment::TenantNotFound => e
55
- puts e.message
40
+ Apartment::TaskHelper.create_tenant(tenant)
41
+ puts("Seeding #{tenant} tenant")
42
+ Apartment::Tenant.switch(tenant) do
43
+ Apartment::Tenant.seed
56
44
  end
45
+ rescue Apartment::TenantNotFound => e
46
+ puts e.message
57
47
  end
58
48
  end
59
49
 
@@ -64,12 +54,10 @@ apartment_namespace = namespace :apartment do
64
54
  step = ENV['STEP'] ? ENV['STEP'].to_i : 1
65
55
 
66
56
  Apartment::TaskHelper.each_tenant do |tenant|
67
- begin
68
- puts("Rolling back #{tenant} tenant")
69
- Apartment::Migrator.rollback tenant, step
70
- rescue Apartment::TenantNotFound => e
71
- puts e.message
72
- end
57
+ puts("Rolling back #{tenant} tenant")
58
+ Apartment::Migrator.rollback tenant, step
59
+ rescue Apartment::TenantNotFound => e
60
+ puts e.message
73
61
  end
74
62
  end
75
63
 
@@ -82,12 +70,10 @@ apartment_namespace = namespace :apartment do
82
70
  raise 'VERSION is required' unless version
83
71
 
84
72
  Apartment::TaskHelper.each_tenant do |tenant|
85
- begin
86
- puts("Migrating #{tenant} tenant up")
87
- Apartment::Migrator.run :up, tenant, version
88
- rescue Apartment::TenantNotFound => e
89
- puts e.message
90
- end
73
+ puts("Migrating #{tenant} tenant up")
74
+ Apartment::Migrator.run :up, tenant, version
75
+ rescue Apartment::TenantNotFound => e
76
+ puts e.message
91
77
  end
92
78
  end
93
79
 
@@ -99,12 +85,10 @@ apartment_namespace = namespace :apartment do
99
85
  raise 'VERSION is required' unless version
100
86
 
101
87
  Apartment::TaskHelper.each_tenant do |tenant|
102
- begin
103
- puts("Migrating #{tenant} tenant down")
104
- Apartment::Migrator.run :down, tenant, version
105
- rescue Apartment::TenantNotFound => e
106
- puts e.message
107
- end
88
+ puts("Migrating #{tenant} tenant down")
89
+ Apartment::Migrator.run :down, tenant, version
90
+ rescue Apartment::TenantNotFound => e
91
+ puts e.message
108
92
  end
109
93
  end
110
94
 
@@ -27,17 +27,23 @@ Gem::Specification.new do |s|
27
27
  s.homepage = 'https://github.com/rails-on-services/apartment'
28
28
  s.licenses = ['MIT']
29
29
 
30
- s.add_dependency 'activerecord', '>= 5.0.0', '< 6.2'
31
- s.add_dependency 'parallel', '< 2.0'
32
- s.add_dependency 'public_suffix', '>= 2.0.5', '< 5.0'
33
- s.add_dependency 'rack', '>= 1.3.6', '< 3.0'
30
+ s.add_dependency 'activerecord', '>= 5.0.0', '< 6.2'
31
+ s.add_dependency 'parallel', '< 2.0'
32
+ s.add_dependency 'public_suffix', '>= 2.0.5', '< 5.0'
33
+ s.add_dependency 'rack', '>= 1.3.6', '< 3.0'
34
34
 
35
- s.add_development_dependency 'appraisal', '~> 2.2'
36
- s.add_development_dependency 'bundler', '>= 1.3', '< 3.0'
37
- s.add_development_dependency 'capybara', '~> 2.0'
38
- s.add_development_dependency 'rake', '~> 13.0'
39
- s.add_development_dependency 'rspec', '~> 3.4'
40
- s.add_development_dependency 'rspec-rails', '~> 3.4'
35
+ s.add_development_dependency 'appraisal', '~> 2.2'
36
+ s.add_development_dependency 'bundler', '>= 1.3', '< 3.0'
37
+ s.add_development_dependency 'guard-rspec', '~> 4.2'
38
+ s.add_development_dependency 'pry'
39
+ s.add_development_dependency 'rake', '~> 13.0'
40
+ s.add_development_dependency 'rspec', '~> 3.4'
41
+ s.add_development_dependency 'rspec_junit_formatter'
42
+ s.add_development_dependency 'rspec-rails', '~> 3.4'
43
+ s.add_development_dependency 'rubocop', '~> 0.93'
44
+ s.add_development_dependency 'rubocop-performance', '~> 1.10'
45
+ s.add_development_dependency 'rubocop-rails', '~> 2.1'
46
+ s.add_development_dependency 'rubocop-rspec', '~> 1.44'
41
47
 
42
48
  if defined?(JRUBY_VERSION)
43
49
  s.add_development_dependency 'activerecord-jdbc-adapter'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ros-apartment
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1.rc1
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner
8
8
  - Brad Robertson
9
9
  - Rui Baltazar
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-12-17 00:00:00.000000000 Z
13
+ date: 2021-09-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -121,19 +121,33 @@ dependencies:
121
121
  - !ruby/object:Gem::Version
122
122
  version: '3.0'
123
123
  - !ruby/object:Gem::Dependency
124
- name: capybara
124
+ name: guard-rspec
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '2.0'
129
+ version: '4.2'
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: '2.0'
136
+ version: '4.2'
137
+ - !ruby/object:Gem::Dependency
138
+ name: pry
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
137
151
  - !ruby/object:Gem::Dependency
138
152
  name: rake
139
153
  requirement: !ruby/object:Gem::Requirement
@@ -162,6 +176,20 @@ dependencies:
162
176
  - - "~>"
163
177
  - !ruby/object:Gem::Version
164
178
  version: '3.4'
179
+ - !ruby/object:Gem::Dependency
180
+ name: rspec_junit_formatter
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ type: :development
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
165
193
  - !ruby/object:Gem::Dependency
166
194
  name: rspec-rails
167
195
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +204,62 @@ dependencies:
176
204
  - - "~>"
177
205
  - !ruby/object:Gem::Version
178
206
  version: '3.4'
207
+ - !ruby/object:Gem::Dependency
208
+ name: rubocop
209
+ requirement: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - "~>"
212
+ - !ruby/object:Gem::Version
213
+ version: '0.93'
214
+ type: :development
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - "~>"
219
+ - !ruby/object:Gem::Version
220
+ version: '0.93'
221
+ - !ruby/object:Gem::Dependency
222
+ name: rubocop-performance
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: '1.10'
228
+ type: :development
229
+ prerelease: false
230
+ version_requirements: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - "~>"
233
+ - !ruby/object:Gem::Version
234
+ version: '1.10'
235
+ - !ruby/object:Gem::Dependency
236
+ name: rubocop-rails
237
+ requirement: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - "~>"
240
+ - !ruby/object:Gem::Version
241
+ version: '2.1'
242
+ type: :development
243
+ prerelease: false
244
+ version_requirements: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - "~>"
247
+ - !ruby/object:Gem::Version
248
+ version: '2.1'
249
+ - !ruby/object:Gem::Dependency
250
+ name: rubocop-rspec
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - "~>"
254
+ - !ruby/object:Gem::Version
255
+ version: '1.44'
256
+ type: :development
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - "~>"
261
+ - !ruby/object:Gem::Version
262
+ version: '1.44'
179
263
  - !ruby/object:Gem::Dependency
180
264
  name: mysql2
181
265
  requirement: !ruby/object:Gem::Requirement
@@ -228,15 +312,17 @@ executables: []
228
312
  extensions: []
229
313
  extra_rdoc_files: []
230
314
  files:
315
+ - ".circleci/config.yml"
231
316
  - ".github/ISSUE_TEMPLATE.md"
232
317
  - ".github/workflows/changelog.yml"
318
+ - ".github/workflows/reviewdog.yml"
233
319
  - ".gitignore"
234
320
  - ".pryrc"
235
321
  - ".rspec"
236
322
  - ".rubocop.yml"
237
323
  - ".rubocop_todo.yml"
324
+ - ".ruby-version"
238
325
  - ".story_branch.yml"
239
- - ".travis.yml"
240
326
  - Appraisals
241
327
  - CHANGELOG.md
242
328
  - Gemfile
@@ -251,6 +337,7 @@ files:
251
337
  - gemfiles/rails_5_1.gemfile
252
338
  - gemfiles/rails_5_2.gemfile
253
339
  - gemfiles/rails_6_0.gemfile
340
+ - gemfiles/rails_6_1.gemfile
254
341
  - gemfiles/rails_master.gemfile
255
342
  - lib/apartment.rb
256
343
  - lib/apartment/active_record/connection_handling.rb
@@ -291,7 +378,7 @@ homepage: https://github.com/rails-on-services/apartment
291
378
  licenses:
292
379
  - MIT
293
380
  metadata: {}
294
- post_install_message:
381
+ post_install_message:
295
382
  rdoc_options: []
296
383
  require_paths:
297
384
  - lib
@@ -302,12 +389,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
302
389
  version: '0'
303
390
  required_rubygems_version: !ruby/object:Gem::Requirement
304
391
  requirements:
305
- - - ">"
392
+ - - ">="
306
393
  - !ruby/object:Gem::Version
307
- version: 1.3.1
394
+ version: '0'
308
395
  requirements: []
309
- rubygems_version: 3.1.4
310
- signing_key:
396
+ rubygems_version: 3.1.6
397
+ signing_key:
311
398
  specification_version: 4
312
399
  summary: A Ruby gem for managing database multitenancy. Apartment Gem drop in replacement
313
400
  test_files: []
data/.travis.yml DELETED
@@ -1,49 +0,0 @@
1
- os: linux
2
-
3
- language: ruby
4
- services:
5
- - docker
6
- rvm:
7
- - jruby-9.2.11.0
8
- - 2.4.10
9
- - 2.5.8
10
- - 2.6.6
11
- - 2.7.1
12
- - jruby-head
13
- - ruby-head
14
-
15
- branches:
16
- only:
17
- - master
18
- - development
19
-
20
- gemfile:
21
- - gemfiles/rails_5_0.gemfile
22
- - gemfiles/rails_5_1.gemfile
23
- - gemfiles/rails_5_2.gemfile
24
- - gemfiles/rails_6_0.gemfile
25
- - gemfiles/rails_master.gemfile
26
-
27
- bundler_args: --without local
28
- before_install:
29
- - sudo /etc/init.d/mysql stop
30
- - sudo /etc/init.d/postgresql stop
31
- - docker-compose up -d
32
-
33
- env:
34
- RUBY_GC_MALLOC_LIMIT: 90000000
35
- RUBY_GC_HEAP_FREE_SLOTS: 200000
36
- jobs:
37
- include:
38
- - name: Rubocop Lint
39
- script: gem install rubocop
40
-
41
- allow_failures:
42
- - rvm: ruby-head
43
- - rvm: jruby-head
44
- - gemfile: gemfiles/rails_master.gemfile
45
- exclude:
46
- - rvm: 2.4.10
47
- gemfile: gemfiles/rails_6_0.gemfile
48
- fast_finish: true
49
- cache: bundler