synerma-apartment 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.pryrc +5 -0
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +79 -0
  6. data/.ruby-version +1 -0
  7. data/Appraisals +182 -0
  8. data/CODE_OF_CONDUCT.md +71 -0
  9. data/Gemfile +20 -0
  10. data/Guardfile +11 -0
  11. data/README.md +671 -0
  12. data/Rakefile +157 -0
  13. data/legacy_CHANGELOG.md +965 -0
  14. data/lib/apartment/active_record/connection_handling.rb +31 -0
  15. data/lib/apartment/active_record/internal_metadata.rb +9 -0
  16. data/lib/apartment/active_record/postgres/schema_dumper.rb +20 -0
  17. data/lib/apartment/active_record/postgresql_adapter.rb +58 -0
  18. data/lib/apartment/active_record/schema_migration.rb +11 -0
  19. data/lib/apartment/adapters/abstract_adapter.rb +275 -0
  20. data/lib/apartment/adapters/abstract_jdbc_adapter.rb +20 -0
  21. data/lib/apartment/adapters/jdbc_mysql_adapter.rb +19 -0
  22. data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +62 -0
  23. data/lib/apartment/adapters/mysql2_adapter.rb +77 -0
  24. data/lib/apartment/adapters/postgis_adapter.rb +13 -0
  25. data/lib/apartment/adapters/postgresql_adapter.rb +280 -0
  26. data/lib/apartment/adapters/sqlite3_adapter.rb +66 -0
  27. data/lib/apartment/adapters/trilogy_adapter.rb +29 -0
  28. data/lib/apartment/console.rb +24 -0
  29. data/lib/apartment/custom_console.rb +42 -0
  30. data/lib/apartment/deprecation.rb +8 -0
  31. data/lib/apartment/elevators/domain.rb +23 -0
  32. data/lib/apartment/elevators/first_subdomain.rb +18 -0
  33. data/lib/apartment/elevators/generic.rb +33 -0
  34. data/lib/apartment/elevators/host.rb +35 -0
  35. data/lib/apartment/elevators/host_hash.rb +26 -0
  36. data/lib/apartment/elevators/subdomain.rb +66 -0
  37. data/lib/apartment/log_subscriber.rb +45 -0
  38. data/lib/apartment/migrator.rb +46 -0
  39. data/lib/apartment/model.rb +29 -0
  40. data/lib/apartment/railtie.rb +68 -0
  41. data/lib/apartment/tasks/enhancements.rb +55 -0
  42. data/lib/apartment/tasks/task_helper.rb +54 -0
  43. data/lib/apartment/tenant.rb +63 -0
  44. data/lib/apartment/version.rb +5 -0
  45. data/lib/apartment.rb +155 -0
  46. data/lib/generators/apartment/install/USAGE +5 -0
  47. data/lib/generators/apartment/install/install_generator.rb +11 -0
  48. data/lib/generators/apartment/install/templates/apartment.rb +116 -0
  49. data/lib/tasks/apartment.rake +106 -0
  50. data/synerma-apartment.gemspec +40 -0
  51. metadata +198 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b5e6489eed3bed5446d9e4f334674a2d4b04f81f33e90485adb07f8292d0a936
4
+ data.tar.gz: 89b4c80e986d53daeaadc2f99bfe356d8ecd209f627cc3270cf1beb96f7fd75d
5
+ SHA512:
6
+ metadata.gz: 8c1bb738b9fc850feb1136682c99082c574c6c2ea7c2fc08d2166fe6b0dd1bf54062c8c7b7c8f53bc8d3ef877137cafc301ed990a77c0e541f9fb979898da913
7
+ data.tar.gz: edbf8ce95a57663c4aa503f53bc2221d7c73fa5deb60d076bfbe6ed8e845764215ee1cf651f4c61e1cb818f47f974f81e2545b54b02f69547ec40cae48aa600a
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ *.gem
2
+ .bundle
3
+ *.lock
4
+ gemfiles/*.lock
5
+ gemfiles/vendor
6
+ pkg/*
7
+ *.log
8
+ .idea
9
+ *.sw[pno]
10
+ spec/config/database.yml
11
+ spec/dummy/config/database.yml
12
+ cookbooks
13
+ tmp
14
+ spec/dummy/db/*.sqlite3
15
+ .DS_Store
data/.pryrc ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Style/MixinUsage
4
+ extend Rails::ConsoleMethods if defined?(Rails) && Rails.env
5
+ # rubocop:enable Style/MixinUsage
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format documentation
3
+ --tty
4
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,79 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ Exclude:
4
+ - vendor/bundle/**/*
5
+ - gemfiles/**/*.gemfile
6
+ - gemfiles/vendor/**/*
7
+ - spec/dummy_engine/dummy_engine.gemspec
8
+ - spec/schemas/**/*.rb
9
+
10
+ require:
11
+ - rubocop-rails
12
+ - rubocop-performance
13
+ - rubocop-thread_safety
14
+ - rubocop-rake
15
+ - rubocop-rspec
16
+
17
+ Gemspec/RequiredRubyVersion:
18
+ Exclude:
19
+ - 'synerma-apartment.gemspec'
20
+
21
+ Layout/MultilineMethodCallIndentation:
22
+ EnforcedStyle: indented
23
+
24
+ Metrics/BlockLength:
25
+ Exclude:
26
+ - spec/**/*.rb
27
+
28
+ Rails/RakeEnvironment:
29
+ Enabled: false
30
+
31
+ Rails/ApplicationRecord:
32
+ Enabled: false
33
+
34
+ Rails/Output:
35
+ Enabled: false
36
+
37
+ Style/Documentation:
38
+ Enabled: false
39
+
40
+ Style/StringLiterals:
41
+ EnforcedStyle: single_quotes
42
+
43
+ Style/InlineComment:
44
+ Enabled: false
45
+
46
+ Style/FrozenStringLiteralComment:
47
+ Enabled: true
48
+ Exclude:
49
+ - Gemfile
50
+
51
+ Style/MethodCallWithArgsParentheses:
52
+ Enabled: true
53
+ EnforcedStyle: require_parentheses
54
+ AllowedPatterns:
55
+ - 'puts'
56
+ - 'info'
57
+ - 'warn'
58
+ - 'debug'
59
+ - 'error'
60
+ - 'fatal'
61
+ - 'fail'
62
+
63
+ Style/TrailingCommaInArrayLiteral:
64
+ EnforcedStyleForMultiline: comma
65
+
66
+ Style/TrailingCommaInHashLiteral:
67
+ EnforcedStyleForMultiline: comma
68
+
69
+ Style/ClassAndModuleChildren:
70
+ EnforcedStyle: nested
71
+ AutoCorrect: true
72
+
73
+ Style/CollectionMethods:
74
+ PreferredMethods:
75
+ collect: 'map'
76
+ collect!: 'map!'
77
+ inject: 'reduce'
78
+ detect: 'detect'
79
+ find_all: 'select'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.5
data/Appraisals ADDED
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'rails-6-1-postgresql' do
4
+ gem 'rails', '~> 6.1.0'
5
+ gem 'pg', '~> 1.5'
6
+ end
7
+
8
+ appraise 'rails-6-1-mysql' do
9
+ gem 'rails', '~> 6.1.0'
10
+ gem 'mysql2', '~> 0.5'
11
+ end
12
+
13
+ appraise 'rails-6-1-sqlite3' do
14
+ gem 'rails', '~> 6.1.0'
15
+ gem 'sqlite3', '~> 1.4'
16
+ end
17
+
18
+ appraise 'rails-6-1-jdbc-postgresql' do
19
+ gem 'rails', '~> 6.1.0'
20
+ platforms :jruby do
21
+ gem 'activerecord-jdbc-adapter', '~> 61.3'
22
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 61.3'
23
+ gem 'jdbc-postgres'
24
+ end
25
+ end
26
+
27
+ appraise 'rails-6-1-jdbc-mysql' do
28
+ gem 'rails', '~> 6.1.0'
29
+ platforms :jruby do
30
+ gem 'activerecord-jdbc-adapter', '~> 61.3'
31
+ gem 'activerecord-jdbcmysql-adapter', '~> 61.3'
32
+ gem 'jdbc-mysql'
33
+ end
34
+ end
35
+
36
+ appraise 'rails-6-1-jdbc-sqlite3' do
37
+ gem 'rails', '~> 6.1.0'
38
+ platforms :jruby do
39
+ gem 'activerecord-jdbc-adapter', '~> 61.3'
40
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 61.3'
41
+ gem 'jdbc-sqlite3'
42
+ end
43
+ end
44
+
45
+ appraise 'rails-7-0-postgresql' do
46
+ gem 'rails', '~> 7.0.0'
47
+ gem 'pg', '~> 1.5'
48
+ end
49
+
50
+ appraise 'rails-7-0-mysql' do
51
+ gem 'rails', '~> 7.0.0'
52
+ gem 'mysql2', '~> 0.5'
53
+ end
54
+
55
+ appraise 'rails-7-0-sqlite3' do
56
+ gem 'rails', '~> 7.0.0'
57
+ gem 'sqlite3', '~> 1.4'
58
+ end
59
+
60
+ appraise 'rails-7-0-jdbc-postgresql' do
61
+ gem 'rails', '~> 7.0.0'
62
+ platforms :jruby do
63
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
64
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 70.0'
65
+ gem 'jdbc-postgres'
66
+ end
67
+ end
68
+
69
+ appraise 'rails-7-0-jdbc-mysql' do
70
+ gem 'rails', '~> 7.0.0'
71
+ platforms :jruby do
72
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
73
+ gem 'activerecord-jdbcmysql-adapter', '~> 70.0'
74
+ gem 'jdbc-mysql'
75
+ end
76
+ end
77
+
78
+ appraise 'rails-7-0-jdbc-sqlite3' do
79
+ gem 'rails', '~> 7.0.0'
80
+ platforms :jruby do
81
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
82
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0'
83
+ gem 'jdbc-sqlite3'
84
+ end
85
+ end
86
+
87
+ appraise 'rails-7-1-postgresql' do
88
+ gem 'rails', '~> 7.1.0'
89
+ gem 'pg', '~> 1.5'
90
+ end
91
+
92
+ appraise 'rails-7-1-mysql' do
93
+ gem 'rails', '~> 7.1.0'
94
+ gem 'mysql2', '~> 0.5'
95
+ end
96
+
97
+ appraise 'rails-7-1-sqlite3' do
98
+ gem 'rails', '~> 7.1.0'
99
+ gem 'sqlite3', '~> 2.1'
100
+ end
101
+
102
+ appraise 'rails-7-1-jdbc-postgresql' do
103
+ gem 'rails', '~> 7.1.0'
104
+ platforms :jruby do
105
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
106
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 70.0'
107
+ gem 'jdbc-postgres'
108
+ end
109
+ end
110
+
111
+ appraise 'rails-7-1-jdbc-mysql' do
112
+ gem 'rails', '~> 7.1.0'
113
+ platforms :jruby do
114
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
115
+ gem 'activerecord-jdbcmysql-adapter', '~> 70.0'
116
+ gem 'jdbc-mysql'
117
+ end
118
+ end
119
+
120
+ appraise 'rails-7-1-jdbc-sqlite3' do
121
+ gem 'rails', '~> 7.1.0'
122
+ platforms :jruby do
123
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
124
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0'
125
+ gem 'jdbc-sqlite3'
126
+ end
127
+ end
128
+
129
+ appraise 'rails-7-2-postgresql' do
130
+ gem 'rails', '~> 7.2.0'
131
+ gem 'pg', '~> 1.5'
132
+ end
133
+
134
+ appraise 'rails-7-2-mysql' do
135
+ gem 'rails', '~> 7.2.0'
136
+ gem 'mysql2', '~> 0.5'
137
+ end
138
+
139
+ appraise 'rails-7-2-sqlite3' do
140
+ gem 'rails', '~> 7.2.0'
141
+ gem 'sqlite3', '~> 2.1'
142
+ end
143
+
144
+ appraise 'rails-7-2-jdbc-postgresql' do
145
+ gem 'rails', '~> 7.2.0'
146
+ platforms :jruby do
147
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
148
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 70.0'
149
+ gem 'jdbc-postgres'
150
+ end
151
+ end
152
+
153
+ appraise 'rails-7-2-jdbc-mysql' do
154
+ gem 'rails', '~> 7.2.0'
155
+ platforms :jruby do
156
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
157
+ gem 'activerecord-jdbcmysql-adapter', '~> 70.0'
158
+ gem 'jdbc-mysql'
159
+ end
160
+ end
161
+
162
+ appraise 'rails-7-2-jdbc-sqlite3' do
163
+ gem 'rails', '~> 7.2.0'
164
+ platforms :jruby do
165
+ gem 'activerecord-jdbc-adapter', '~> 70.0'
166
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0'
167
+ gem 'jdbc-sqlite3'
168
+ end
169
+ end
170
+
171
+ # Install Rails from the main branch are failing
172
+ # appraise 'rails-master' do
173
+ # gem 'rails', git: 'https://github.com/rails/rails.git'
174
+ # platforms :ruby do
175
+ # gem 'sqlite3', '~> 2.0'
176
+ # end
177
+ # platforms :jruby do
178
+ # gem 'activerecord-jdbc-adapter', '~> 61.0'
179
+ # gem 'activerecord-jdbcpostgresql-adapter', '~> 61.0'
180
+ # gem 'activerecord-jdbcmysql-adapter', '~> 61.0'
181
+ # end
182
+ # end
@@ -0,0 +1,71 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a safe, welcoming, and inclusive experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ - Demonstrating empathy and kindness toward other people
14
+ - Being respectful of differing opinions, viewpoints, and experiences
15
+ - Giving and gracefully accepting constructive feedback
16
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ - Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others’ private information, such as a physical or email address, without their explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [mauricio@campusesp.com]. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
49
+
50
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
51
+
52
+ ### 2. Warning
53
+ **Community Impact**: A violation through a single incident or series of actions.
54
+
55
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period. Violating these terms may lead to a temporary or permanent ban.
56
+
57
+ ### 3. Temporary Ban
58
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
59
+
60
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period.
61
+
62
+ ### 4. Permanent Ban
63
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
64
+
65
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
66
+
67
+ ## Attribution
68
+
69
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
70
+
71
+ For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq.
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'http://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'appraisal', '~> 2.3'
8
+ gem 'bundler', '< 3.0'
9
+ gem 'pry', '~> 0.13'
10
+ gem 'rake', '< 14.0'
11
+ gem 'rspec', '~> 3.10'
12
+ gem 'rspec_junit_formatter', '~> 0.4'
13
+ gem 'rspec-rails', '>= 6.1.0', '< 8.1'
14
+ gem 'rubocop', '~> 1.12'
15
+ gem 'rubocop-performance', '~> 1.10'
16
+ gem 'rubocop-rails', '~> 2.10'
17
+ gem 'rubocop-rake', '~> 0.5'
18
+ gem 'rubocop-rspec', '~> 3.1'
19
+ gem 'rubocop-thread_safety', '~> 0.4'
20
+ gem 'simplecov', require: false
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ guard :rspec do
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+ watch(%r{^lib/apartment/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
9
+ watch(%r{^lib/apartment/(.+)\.rb$}) { |m| "spec/integration/#{m[1]}_spec.rb" }
10
+ watch('spec/spec_helper.rb') { 'spec' }
11
+ end