ros-apartment 2.3.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +21 -0
  3. data/.gitignore +15 -0
  4. data/.pryrc +3 -0
  5. data/.rspec +4 -0
  6. data/.travis.yml +65 -0
  7. data/Appraisals +71 -0
  8. data/Gemfile +10 -0
  9. data/Guardfile +24 -0
  10. data/HISTORY.md +398 -0
  11. data/README.md +576 -0
  12. data/Rakefile +128 -0
  13. data/TODO.md +51 -0
  14. data/apartment.gemspec +46 -0
  15. data/docker-compose.yml +33 -0
  16. data/gemfiles/rails_4_2.gemfile +23 -0
  17. data/gemfiles/rails_5_0.gemfile +22 -0
  18. data/gemfiles/rails_5_1.gemfile +22 -0
  19. data/gemfiles/rails_5_2.gemfile +18 -0
  20. data/gemfiles/rails_6_0.gemfile +22 -0
  21. data/gemfiles/rails_master.gemfile +22 -0
  22. data/lib/apartment.rb +118 -0
  23. data/lib/apartment/adapters/abstract_adapter.rb +269 -0
  24. data/lib/apartment/adapters/abstract_jdbc_adapter.rb +18 -0
  25. data/lib/apartment/adapters/jdbc_mysql_adapter.rb +19 -0
  26. data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +56 -0
  27. data/lib/apartment/adapters/mysql2_adapter.rb +71 -0
  28. data/lib/apartment/adapters/postgis_adapter.rb +12 -0
  29. data/lib/apartment/adapters/postgresql_adapter.rb +236 -0
  30. data/lib/apartment/adapters/sqlite3_adapter.rb +56 -0
  31. data/lib/apartment/console.rb +12 -0
  32. data/lib/apartment/deprecation.rb +10 -0
  33. data/lib/apartment/elevators/domain.rb +22 -0
  34. data/lib/apartment/elevators/first_subdomain.rb +17 -0
  35. data/lib/apartment/elevators/generic.rb +32 -0
  36. data/lib/apartment/elevators/host.rb +30 -0
  37. data/lib/apartment/elevators/host_hash.rb +22 -0
  38. data/lib/apartment/elevators/subdomain.rb +62 -0
  39. data/lib/apartment/migrator.rb +51 -0
  40. data/lib/apartment/railtie.rb +67 -0
  41. data/lib/apartment/reloader.rb +21 -0
  42. data/lib/apartment/tasks/enhancements.rb +57 -0
  43. data/lib/apartment/tenant.rb +66 -0
  44. data/lib/apartment/version.rb +3 -0
  45. data/lib/generators/apartment/install/USAGE +5 -0
  46. data/lib/generators/apartment/install/install_generator.rb +10 -0
  47. data/lib/generators/apartment/install/templates/apartment.rb +109 -0
  48. data/lib/tasks/apartment.rake +145 -0
  49. data/spec/adapters/jdbc_mysql_adapter_spec.rb +19 -0
  50. data/spec/adapters/jdbc_postgresql_adapter_spec.rb +41 -0
  51. data/spec/adapters/mysql2_adapter_spec.rb +59 -0
  52. data/spec/adapters/postgresql_adapter_spec.rb +61 -0
  53. data/spec/adapters/sqlite3_adapter_spec.rb +83 -0
  54. data/spec/apartment_spec.rb +11 -0
  55. data/spec/config/database.yml.sample +49 -0
  56. data/spec/dummy/Rakefile +7 -0
  57. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  58. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  59. data/spec/dummy/app/models/company.rb +3 -0
  60. data/spec/dummy/app/models/user.rb +3 -0
  61. data/spec/dummy/app/views/application/index.html.erb +1 -0
  62. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  63. data/spec/dummy/config.ru +4 -0
  64. data/spec/dummy/config/application.rb +49 -0
  65. data/spec/dummy/config/boot.rb +11 -0
  66. data/spec/dummy/config/database.yml.sample +44 -0
  67. data/spec/dummy/config/environment.rb +5 -0
  68. data/spec/dummy/config/environments/development.rb +28 -0
  69. data/spec/dummy/config/environments/production.rb +51 -0
  70. data/spec/dummy/config/environments/test.rb +34 -0
  71. data/spec/dummy/config/initializers/apartment.rb +4 -0
  72. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  73. data/spec/dummy/config/initializers/inflections.rb +10 -0
  74. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  75. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  76. data/spec/dummy/config/initializers/session_store.rb +8 -0
  77. data/spec/dummy/config/locales/en.yml +5 -0
  78. data/spec/dummy/config/routes.rb +3 -0
  79. data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +39 -0
  80. data/spec/dummy/db/migrate/20111202022214_create_table_books.rb +14 -0
  81. data/spec/dummy/db/migrate/20180415260934_create_public_tokens.rb +13 -0
  82. data/spec/dummy/db/schema.rb +55 -0
  83. data/spec/dummy/db/seeds.rb +5 -0
  84. data/spec/dummy/db/seeds/import.rb +5 -0
  85. data/spec/dummy/public/404.html +26 -0
  86. data/spec/dummy/public/422.html +26 -0
  87. data/spec/dummy/public/500.html +26 -0
  88. data/spec/dummy/public/favicon.ico +0 -0
  89. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  90. data/spec/dummy/script/rails +6 -0
  91. data/spec/dummy_engine/.gitignore +8 -0
  92. data/spec/dummy_engine/Gemfile +15 -0
  93. data/spec/dummy_engine/Rakefile +34 -0
  94. data/spec/dummy_engine/bin/rails +12 -0
  95. data/spec/dummy_engine/config/initializers/apartment.rb +51 -0
  96. data/spec/dummy_engine/dummy_engine.gemspec +24 -0
  97. data/spec/dummy_engine/lib/dummy_engine.rb +4 -0
  98. data/spec/dummy_engine/lib/dummy_engine/engine.rb +4 -0
  99. data/spec/dummy_engine/lib/dummy_engine/version.rb +3 -0
  100. data/spec/dummy_engine/test/dummy/Rakefile +6 -0
  101. data/spec/dummy_engine/test/dummy/config.ru +4 -0
  102. data/spec/dummy_engine/test/dummy/config/application.rb +22 -0
  103. data/spec/dummy_engine/test/dummy/config/boot.rb +5 -0
  104. data/spec/dummy_engine/test/dummy/config/database.yml +25 -0
  105. data/spec/dummy_engine/test/dummy/config/environment.rb +5 -0
  106. data/spec/dummy_engine/test/dummy/config/environments/development.rb +37 -0
  107. data/spec/dummy_engine/test/dummy/config/environments/production.rb +78 -0
  108. data/spec/dummy_engine/test/dummy/config/environments/test.rb +39 -0
  109. data/spec/dummy_engine/test/dummy/config/initializers/assets.rb +8 -0
  110. data/spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  111. data/spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  112. data/spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  113. data/spec/dummy_engine/test/dummy/config/initializers/inflections.rb +16 -0
  114. data/spec/dummy_engine/test/dummy/config/initializers/mime_types.rb +4 -0
  115. data/spec/dummy_engine/test/dummy/config/initializers/session_store.rb +3 -0
  116. data/spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  117. data/spec/dummy_engine/test/dummy/config/locales/en.yml +23 -0
  118. data/spec/dummy_engine/test/dummy/config/routes.rb +56 -0
  119. data/spec/dummy_engine/test/dummy/config/secrets.yml +22 -0
  120. data/spec/examples/connection_adapter_examples.rb +42 -0
  121. data/spec/examples/generic_adapter_custom_configuration_example.rb +95 -0
  122. data/spec/examples/generic_adapter_examples.rb +163 -0
  123. data/spec/examples/schema_adapter_examples.rb +234 -0
  124. data/spec/integration/apartment_rake_integration_spec.rb +107 -0
  125. data/spec/integration/query_caching_spec.rb +81 -0
  126. data/spec/integration/use_within_an_engine_spec.rb +28 -0
  127. data/spec/schemas/v1.rb +16 -0
  128. data/spec/schemas/v2.rb +43 -0
  129. data/spec/schemas/v3.rb +49 -0
  130. data/spec/spec_helper.rb +61 -0
  131. data/spec/support/apartment_helpers.rb +43 -0
  132. data/spec/support/capybara_sessions.rb +15 -0
  133. data/spec/support/config.rb +10 -0
  134. data/spec/support/contexts.rb +52 -0
  135. data/spec/support/requirements.rb +35 -0
  136. data/spec/support/setup.rb +46 -0
  137. data/spec/tasks/apartment_rake_spec.rb +129 -0
  138. data/spec/tenant_spec.rb +190 -0
  139. data/spec/unit/config_spec.rb +112 -0
  140. data/spec/unit/elevators/domain_spec.rb +32 -0
  141. data/spec/unit/elevators/first_subdomain_spec.rb +24 -0
  142. data/spec/unit/elevators/generic_spec.rb +54 -0
  143. data/spec/unit/elevators/host_hash_spec.rb +32 -0
  144. data/spec/unit/elevators/host_spec.rb +89 -0
  145. data/spec/unit/elevators/subdomain_spec.rb +76 -0
  146. data/spec/unit/migrator_spec.rb +77 -0
  147. data/spec/unit/reloader_spec.rb +24 -0
  148. metadata +487 -0
@@ -0,0 +1,89 @@
1
+ require 'spec_helper'
2
+ require 'apartment/elevators/host'
3
+
4
+ describe Apartment::Elevators::Host do
5
+
6
+ subject(:elevator){ described_class.new(Proc.new{}) }
7
+
8
+ describe "#parse_tenant_name" do
9
+
10
+ it "should return nil when no host" do
11
+ request = ActionDispatch::Request.new('HTTP_HOST' => '')
12
+ expect(elevator.parse_tenant_name(request)).to be_nil
13
+ end
14
+
15
+ context "assuming no ignored_first_subdomains" do
16
+ before { allow(described_class).to receive(:ignored_first_subdomains).and_return([]) }
17
+
18
+ context "with 3 parts" do
19
+ it "should return the whole host" do
20
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
21
+ expect(elevator.parse_tenant_name(request)).to eq('foo.bar.com')
22
+ end
23
+ end
24
+
25
+ context "with 6 parts" do
26
+ it "should return the whole host" do
27
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'one.two.three.foo.bar.com')
28
+ expect(elevator.parse_tenant_name(request)).to eq('one.two.three.foo.bar.com')
29
+ end
30
+ end
31
+ end
32
+
33
+ context "assuming ignored_first_subdomains is set" do
34
+ before { allow(described_class).to receive(:ignored_first_subdomains).and_return(%w{www foo}) }
35
+
36
+ context "with 3 parts" do
37
+ it "should return host without www" do
38
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'www.bar.com')
39
+ expect(elevator.parse_tenant_name(request)).to eq('bar.com')
40
+ end
41
+
42
+ it "should return host without foo" do
43
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
44
+ expect(elevator.parse_tenant_name(request)).to eq('bar.com')
45
+ end
46
+ end
47
+
48
+ context "with 6 parts" do
49
+ it "should return host without www" do
50
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'www.one.two.three.foo.bar.com')
51
+ expect(elevator.parse_tenant_name(request)).to eq('one.two.three.foo.bar.com')
52
+ end
53
+
54
+ it "should return host without www" do
55
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.one.two.three.bar.com')
56
+ expect(elevator.parse_tenant_name(request)).to eq('one.two.three.bar.com')
57
+ end
58
+ end
59
+ end
60
+
61
+ context "assuming localhost" do
62
+ it "should return localhost" do
63
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'localhost')
64
+ expect(elevator.parse_tenant_name(request)).to eq('localhost')
65
+ end
66
+ end
67
+
68
+ context "assuming ip address" do
69
+ it "should return the ip address" do
70
+ request = ActionDispatch::Request.new('HTTP_HOST' => '127.0.0.1')
71
+ expect(elevator.parse_tenant_name(request)).to eq('127.0.0.1')
72
+ end
73
+ end
74
+ end
75
+
76
+ describe "#call" do
77
+ it "switches to the proper tenant" do
78
+ allow(described_class).to receive(:ignored_first_subdomains).and_return([])
79
+ expect(Apartment::Tenant).to receive(:switch).with('foo.bar.com')
80
+ elevator.call('HTTP_HOST' => 'foo.bar.com')
81
+ end
82
+
83
+ it "ignores ignored_first_subdomains" do
84
+ allow(described_class).to receive(:ignored_first_subdomains).and_return(%w{foo})
85
+ expect(Apartment::Tenant).to receive(:switch).with('bar.com')
86
+ elevator.call('HTTP_HOST' => 'foo.bar.com')
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+ require 'apartment/elevators/subdomain'
3
+
4
+ describe Apartment::Elevators::Subdomain do
5
+
6
+ subject(:elevator){ described_class.new(Proc.new{}) }
7
+
8
+ describe "#parse_tenant_name" do
9
+ context "assuming one tld" do
10
+ it "should parse subdomain" do
11
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
12
+ expect(elevator.parse_tenant_name(request)).to eq('foo')
13
+ end
14
+
15
+ it "should return nil when no subdomain" do
16
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.com')
17
+ expect(elevator.parse_tenant_name(request)).to be_nil
18
+ end
19
+ end
20
+
21
+ context "assuming two tlds" do
22
+ it "should parse subdomain in the third level domain" do
23
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.co.uk')
24
+ expect(elevator.parse_tenant_name(request)).to eq("foo")
25
+ end
26
+
27
+ it "should return nil when no subdomain in the third level domain" do
28
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.co.uk')
29
+ expect(elevator.parse_tenant_name(request)).to be_nil
30
+ end
31
+ end
32
+
33
+ context "assuming two subdomains" do
34
+ it "should parse two subdomains in the two level domain" do
35
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.xyz.bar.com')
36
+ expect(elevator.parse_tenant_name(request)).to eq("foo")
37
+ end
38
+
39
+ it "should parse two subdomains in the third level domain" do
40
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.xyz.bar.co.uk')
41
+ expect(elevator.parse_tenant_name(request)).to eq("foo")
42
+ end
43
+ end
44
+
45
+ context "assuming localhost" do
46
+ it "should return nil for localhost" do
47
+ request = ActionDispatch::Request.new('HTTP_HOST' => 'localhost')
48
+ expect(elevator.parse_tenant_name(request)).to be_nil
49
+ end
50
+ end
51
+
52
+ context "assuming ip address" do
53
+ it "should return nil for an ip address" do
54
+ request = ActionDispatch::Request.new('HTTP_HOST' => '127.0.0.1')
55
+ expect(elevator.parse_tenant_name(request)).to be_nil
56
+ end
57
+ end
58
+ end
59
+
60
+ describe "#call" do
61
+ it "switches to the proper tenant" do
62
+ expect(Apartment::Tenant).to receive(:switch).with('tenant1')
63
+ elevator.call('HTTP_HOST' => 'tenant1.example.com')
64
+ end
65
+
66
+ it "ignores excluded subdomains" do
67
+ described_class.excluded_subdomains = %w{foo}
68
+
69
+ expect(Apartment::Tenant).not_to receive(:switch)
70
+
71
+ elevator.call('HTTP_HOST' => 'foo.bar.com')
72
+
73
+ described_class.excluded_subdomains = nil
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,77 @@
1
+ require 'spec_helper'
2
+ require 'apartment/migrator'
3
+
4
+ describe Apartment::Migrator do
5
+
6
+ let(:tenant){ Apartment::Test.next_db }
7
+
8
+ # Don't need a real switch here, just testing behaviour
9
+ before { allow(Apartment::Tenant.adapter).to receive(:connect_to_new) }
10
+
11
+ context "with ActiveRecord below 5.2.0", skip: ActiveRecord.version >= Gem::Version.new("5.2.0") do
12
+ before do
13
+ allow(ActiveRecord::Migrator).to receive(:migrations_paths) { %w(spec/dummy/db/migrate) }
14
+ allow(Apartment::Migrator).to receive(:activerecord_below_5_2?) { true }
15
+ end
16
+
17
+ describe "::migrate" do
18
+ it "switches and migrates" do
19
+ expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
20
+ expect(ActiveRecord::Migrator).to receive(:migrate)
21
+
22
+ Apartment::Migrator.migrate(tenant)
23
+ end
24
+ end
25
+
26
+ describe "::run" do
27
+ it "switches and runs" do
28
+ expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
29
+ expect(ActiveRecord::Migrator).to receive(:run).with(:up, anything, 1234)
30
+
31
+ Apartment::Migrator.run(:up, tenant, 1234)
32
+ end
33
+ end
34
+
35
+ describe "::rollback" do
36
+ it "switches and rolls back" do
37
+ expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
38
+ expect(ActiveRecord::Migrator).to receive(:rollback).with(anything, 2)
39
+
40
+ Apartment::Migrator.rollback(tenant, 2)
41
+ end
42
+ end
43
+ end
44
+
45
+ context "with ActiveRecord above or equal to 5.2.0", skip: ActiveRecord.version < Gem::Version.new("5.2.0") do
46
+ before do
47
+ allow(Apartment::Migrator).to receive(:activerecord_below_5_2?) { false }
48
+ end
49
+
50
+ describe "::migrate" do
51
+ it "switches and migrates" do
52
+ expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
53
+ expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:migrate)
54
+
55
+ Apartment::Migrator.migrate(tenant)
56
+ end
57
+ end
58
+
59
+ describe "::run" do
60
+ it "switches and runs" do
61
+ expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
62
+ expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:run).with(:up, 1234)
63
+
64
+ Apartment::Migrator.run(:up, tenant, 1234)
65
+ end
66
+ end
67
+
68
+ describe "::rollback" do
69
+ it "switches and rolls back" do
70
+ expect(Apartment::Tenant).to receive(:switch).with(tenant).and_call_original
71
+ expect_any_instance_of(ActiveRecord::MigrationContext).to receive(:rollback).with(2)
72
+
73
+ Apartment::Migrator.rollback(tenant, 2)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Apartment::Reloader do
4
+
5
+ context "using postgresql schemas" do
6
+
7
+ before do
8
+ Apartment.configure do |config|
9
+ config.excluded_models = ["Company"]
10
+ config.use_schemas = true
11
+ end
12
+ Apartment::Tenant.reload!(config)
13
+ Company.reset_table_name # ensure we're clean
14
+ end
15
+
16
+ subject{ Apartment::Reloader.new(double("Rack::Application", :call => nil)) }
17
+
18
+ it "should initialize apartment when called" do
19
+ expect(Company.table_name).not_to include('public.')
20
+ subject.call(double('env'))
21
+ expect(Company.table_name).to include('public.')
22
+ end
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,487 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ros-apartment
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.3.0.alpha1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Brunner
8
+ - Brad Robertson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2020-01-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activerecord
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 3.1.2
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '6.1'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: 3.1.2
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '6.1'
34
+ - !ruby/object:Gem::Dependency
35
+ name: rack
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.6
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.6
48
+ - !ruby/object:Gem::Dependency
49
+ name: public_suffix
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '2'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ - !ruby/object:Gem::Dependency
63
+ name: parallel
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.7.1
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.7.1
76
+ - !ruby/object:Gem::Dependency
77
+ name: appraisal
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: rake
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.9'
104
+ - !ruby/object:Gem::Dependency
105
+ name: rspec
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.4'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.4'
118
+ - !ruby/object:Gem::Dependency
119
+ name: rspec-rails
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.4'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.4'
132
+ - !ruby/object:Gem::Dependency
133
+ name: capybara
134
+ requirement: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '2.0'
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '2.0'
146
+ - !ruby/object:Gem::Dependency
147
+ name: bundler
148
+ requirement: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '1.3'
153
+ - - "<"
154
+ - !ruby/object:Gem::Version
155
+ version: '2.0'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '1.3'
163
+ - - "<"
164
+ - !ruby/object:Gem::Version
165
+ version: '2.0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: mysql2
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ - !ruby/object:Gem::Dependency
181
+ name: pg
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ - !ruby/object:Gem::Dependency
195
+ name: sqlite3
196
+ requirement: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: 1.3.6
201
+ type: :development
202
+ prerelease: false
203
+ version_requirements: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: 1.3.6
208
+ description: Apartment allows Rack applications to deal with database multitenancy
209
+ through ActiveRecord
210
+ email:
211
+ - ryan@influitive.com
212
+ - brad@influitive.com
213
+ executables: []
214
+ extensions: []
215
+ extra_rdoc_files: []
216
+ files:
217
+ - ".github/ISSUE_TEMPLATE.md"
218
+ - ".gitignore"
219
+ - ".pryrc"
220
+ - ".rspec"
221
+ - ".travis.yml"
222
+ - Appraisals
223
+ - Gemfile
224
+ - Guardfile
225
+ - HISTORY.md
226
+ - README.md
227
+ - Rakefile
228
+ - TODO.md
229
+ - apartment.gemspec
230
+ - docker-compose.yml
231
+ - gemfiles/rails_4_2.gemfile
232
+ - gemfiles/rails_5_0.gemfile
233
+ - gemfiles/rails_5_1.gemfile
234
+ - gemfiles/rails_5_2.gemfile
235
+ - gemfiles/rails_6_0.gemfile
236
+ - gemfiles/rails_master.gemfile
237
+ - lib/apartment.rb
238
+ - lib/apartment/adapters/abstract_adapter.rb
239
+ - lib/apartment/adapters/abstract_jdbc_adapter.rb
240
+ - lib/apartment/adapters/jdbc_mysql_adapter.rb
241
+ - lib/apartment/adapters/jdbc_postgresql_adapter.rb
242
+ - lib/apartment/adapters/mysql2_adapter.rb
243
+ - lib/apartment/adapters/postgis_adapter.rb
244
+ - lib/apartment/adapters/postgresql_adapter.rb
245
+ - lib/apartment/adapters/sqlite3_adapter.rb
246
+ - lib/apartment/console.rb
247
+ - lib/apartment/deprecation.rb
248
+ - lib/apartment/elevators/domain.rb
249
+ - lib/apartment/elevators/first_subdomain.rb
250
+ - lib/apartment/elevators/generic.rb
251
+ - lib/apartment/elevators/host.rb
252
+ - lib/apartment/elevators/host_hash.rb
253
+ - lib/apartment/elevators/subdomain.rb
254
+ - lib/apartment/migrator.rb
255
+ - lib/apartment/railtie.rb
256
+ - lib/apartment/reloader.rb
257
+ - lib/apartment/tasks/enhancements.rb
258
+ - lib/apartment/tenant.rb
259
+ - lib/apartment/version.rb
260
+ - lib/generators/apartment/install/USAGE
261
+ - lib/generators/apartment/install/install_generator.rb
262
+ - lib/generators/apartment/install/templates/apartment.rb
263
+ - lib/tasks/apartment.rake
264
+ - spec/adapters/jdbc_mysql_adapter_spec.rb
265
+ - spec/adapters/jdbc_postgresql_adapter_spec.rb
266
+ - spec/adapters/mysql2_adapter_spec.rb
267
+ - spec/adapters/postgresql_adapter_spec.rb
268
+ - spec/adapters/sqlite3_adapter_spec.rb
269
+ - spec/apartment_spec.rb
270
+ - spec/config/database.yml.sample
271
+ - spec/dummy/Rakefile
272
+ - spec/dummy/app/controllers/application_controller.rb
273
+ - spec/dummy/app/helpers/application_helper.rb
274
+ - spec/dummy/app/models/company.rb
275
+ - spec/dummy/app/models/user.rb
276
+ - spec/dummy/app/views/application/index.html.erb
277
+ - spec/dummy/app/views/layouts/application.html.erb
278
+ - spec/dummy/config.ru
279
+ - spec/dummy/config/application.rb
280
+ - spec/dummy/config/boot.rb
281
+ - spec/dummy/config/database.yml.sample
282
+ - spec/dummy/config/environment.rb
283
+ - spec/dummy/config/environments/development.rb
284
+ - spec/dummy/config/environments/production.rb
285
+ - spec/dummy/config/environments/test.rb
286
+ - spec/dummy/config/initializers/apartment.rb
287
+ - spec/dummy/config/initializers/backtrace_silencers.rb
288
+ - spec/dummy/config/initializers/inflections.rb
289
+ - spec/dummy/config/initializers/mime_types.rb
290
+ - spec/dummy/config/initializers/secret_token.rb
291
+ - spec/dummy/config/initializers/session_store.rb
292
+ - spec/dummy/config/locales/en.yml
293
+ - spec/dummy/config/routes.rb
294
+ - spec/dummy/db/migrate/20110613152810_create_dummy_models.rb
295
+ - spec/dummy/db/migrate/20111202022214_create_table_books.rb
296
+ - spec/dummy/db/migrate/20180415260934_create_public_tokens.rb
297
+ - spec/dummy/db/schema.rb
298
+ - spec/dummy/db/seeds.rb
299
+ - spec/dummy/db/seeds/import.rb
300
+ - spec/dummy/db/test.sqlite3
301
+ - spec/dummy/public/404.html
302
+ - spec/dummy/public/422.html
303
+ - spec/dummy/public/500.html
304
+ - spec/dummy/public/favicon.ico
305
+ - spec/dummy/public/stylesheets/.gitkeep
306
+ - spec/dummy/script/rails
307
+ - spec/dummy_engine/.gitignore
308
+ - spec/dummy_engine/Gemfile
309
+ - spec/dummy_engine/Rakefile
310
+ - spec/dummy_engine/bin/rails
311
+ - spec/dummy_engine/config/initializers/apartment.rb
312
+ - spec/dummy_engine/dummy_engine.gemspec
313
+ - spec/dummy_engine/lib/dummy_engine.rb
314
+ - spec/dummy_engine/lib/dummy_engine/engine.rb
315
+ - spec/dummy_engine/lib/dummy_engine/version.rb
316
+ - spec/dummy_engine/test/dummy/Rakefile
317
+ - spec/dummy_engine/test/dummy/config.ru
318
+ - spec/dummy_engine/test/dummy/config/application.rb
319
+ - spec/dummy_engine/test/dummy/config/boot.rb
320
+ - spec/dummy_engine/test/dummy/config/database.yml
321
+ - spec/dummy_engine/test/dummy/config/environment.rb
322
+ - spec/dummy_engine/test/dummy/config/environments/development.rb
323
+ - spec/dummy_engine/test/dummy/config/environments/production.rb
324
+ - spec/dummy_engine/test/dummy/config/environments/test.rb
325
+ - spec/dummy_engine/test/dummy/config/initializers/assets.rb
326
+ - spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb
327
+ - spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb
328
+ - spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb
329
+ - spec/dummy_engine/test/dummy/config/initializers/inflections.rb
330
+ - spec/dummy_engine/test/dummy/config/initializers/mime_types.rb
331
+ - spec/dummy_engine/test/dummy/config/initializers/session_store.rb
332
+ - spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb
333
+ - spec/dummy_engine/test/dummy/config/locales/en.yml
334
+ - spec/dummy_engine/test/dummy/config/routes.rb
335
+ - spec/dummy_engine/test/dummy/config/secrets.yml
336
+ - spec/examples/connection_adapter_examples.rb
337
+ - spec/examples/generic_adapter_custom_configuration_example.rb
338
+ - spec/examples/generic_adapter_examples.rb
339
+ - spec/examples/schema_adapter_examples.rb
340
+ - spec/integration/apartment_rake_integration_spec.rb
341
+ - spec/integration/query_caching_spec.rb
342
+ - spec/integration/use_within_an_engine_spec.rb
343
+ - spec/schemas/v1.rb
344
+ - spec/schemas/v2.rb
345
+ - spec/schemas/v3.rb
346
+ - spec/spec_helper.rb
347
+ - spec/support/apartment_helpers.rb
348
+ - spec/support/capybara_sessions.rb
349
+ - spec/support/config.rb
350
+ - spec/support/contexts.rb
351
+ - spec/support/requirements.rb
352
+ - spec/support/setup.rb
353
+ - spec/tasks/apartment_rake_spec.rb
354
+ - spec/tenant_spec.rb
355
+ - spec/unit/config_spec.rb
356
+ - spec/unit/elevators/domain_spec.rb
357
+ - spec/unit/elevators/first_subdomain_spec.rb
358
+ - spec/unit/elevators/generic_spec.rb
359
+ - spec/unit/elevators/host_hash_spec.rb
360
+ - spec/unit/elevators/host_spec.rb
361
+ - spec/unit/elevators/subdomain_spec.rb
362
+ - spec/unit/migrator_spec.rb
363
+ - spec/unit/reloader_spec.rb
364
+ homepage: https://github.com/rails-on-services/apartment
365
+ licenses:
366
+ - MIT
367
+ metadata: {}
368
+ post_install_message:
369
+ rdoc_options: []
370
+ require_paths:
371
+ - lib
372
+ required_ruby_version: !ruby/object:Gem::Requirement
373
+ requirements:
374
+ - - ">="
375
+ - !ruby/object:Gem::Version
376
+ version: '0'
377
+ required_rubygems_version: !ruby/object:Gem::Requirement
378
+ requirements:
379
+ - - ">"
380
+ - !ruby/object:Gem::Version
381
+ version: 1.3.1
382
+ requirements: []
383
+ rubygems_version: 3.0.6
384
+ signing_key:
385
+ specification_version: 4
386
+ summary: A Ruby gem for managing database multitenancy
387
+ test_files:
388
+ - spec/adapters/jdbc_mysql_adapter_spec.rb
389
+ - spec/adapters/jdbc_postgresql_adapter_spec.rb
390
+ - spec/adapters/mysql2_adapter_spec.rb
391
+ - spec/adapters/postgresql_adapter_spec.rb
392
+ - spec/adapters/sqlite3_adapter_spec.rb
393
+ - spec/apartment_spec.rb
394
+ - spec/config/database.yml.sample
395
+ - spec/dummy/Rakefile
396
+ - spec/dummy/app/controllers/application_controller.rb
397
+ - spec/dummy/app/helpers/application_helper.rb
398
+ - spec/dummy/app/models/company.rb
399
+ - spec/dummy/app/models/user.rb
400
+ - spec/dummy/app/views/application/index.html.erb
401
+ - spec/dummy/app/views/layouts/application.html.erb
402
+ - spec/dummy/config.ru
403
+ - spec/dummy/config/application.rb
404
+ - spec/dummy/config/boot.rb
405
+ - spec/dummy/config/database.yml.sample
406
+ - spec/dummy/config/environment.rb
407
+ - spec/dummy/config/environments/development.rb
408
+ - spec/dummy/config/environments/production.rb
409
+ - spec/dummy/config/environments/test.rb
410
+ - spec/dummy/config/initializers/apartment.rb
411
+ - spec/dummy/config/initializers/backtrace_silencers.rb
412
+ - spec/dummy/config/initializers/inflections.rb
413
+ - spec/dummy/config/initializers/mime_types.rb
414
+ - spec/dummy/config/initializers/secret_token.rb
415
+ - spec/dummy/config/initializers/session_store.rb
416
+ - spec/dummy/config/locales/en.yml
417
+ - spec/dummy/config/routes.rb
418
+ - spec/dummy/db/migrate/20110613152810_create_dummy_models.rb
419
+ - spec/dummy/db/migrate/20111202022214_create_table_books.rb
420
+ - spec/dummy/db/migrate/20180415260934_create_public_tokens.rb
421
+ - spec/dummy/db/schema.rb
422
+ - spec/dummy/db/seeds.rb
423
+ - spec/dummy/db/seeds/import.rb
424
+ - spec/dummy/db/test.sqlite3
425
+ - spec/dummy/public/404.html
426
+ - spec/dummy/public/422.html
427
+ - spec/dummy/public/500.html
428
+ - spec/dummy/public/favicon.ico
429
+ - spec/dummy/public/stylesheets/.gitkeep
430
+ - spec/dummy/script/rails
431
+ - spec/dummy_engine/.gitignore
432
+ - spec/dummy_engine/Gemfile
433
+ - spec/dummy_engine/Rakefile
434
+ - spec/dummy_engine/bin/rails
435
+ - spec/dummy_engine/config/initializers/apartment.rb
436
+ - spec/dummy_engine/dummy_engine.gemspec
437
+ - spec/dummy_engine/lib/dummy_engine.rb
438
+ - spec/dummy_engine/lib/dummy_engine/engine.rb
439
+ - spec/dummy_engine/lib/dummy_engine/version.rb
440
+ - spec/dummy_engine/test/dummy/Rakefile
441
+ - spec/dummy_engine/test/dummy/config.ru
442
+ - spec/dummy_engine/test/dummy/config/application.rb
443
+ - spec/dummy_engine/test/dummy/config/boot.rb
444
+ - spec/dummy_engine/test/dummy/config/database.yml
445
+ - spec/dummy_engine/test/dummy/config/environment.rb
446
+ - spec/dummy_engine/test/dummy/config/environments/development.rb
447
+ - spec/dummy_engine/test/dummy/config/environments/production.rb
448
+ - spec/dummy_engine/test/dummy/config/environments/test.rb
449
+ - spec/dummy_engine/test/dummy/config/initializers/assets.rb
450
+ - spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb
451
+ - spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb
452
+ - spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb
453
+ - spec/dummy_engine/test/dummy/config/initializers/inflections.rb
454
+ - spec/dummy_engine/test/dummy/config/initializers/mime_types.rb
455
+ - spec/dummy_engine/test/dummy/config/initializers/session_store.rb
456
+ - spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb
457
+ - spec/dummy_engine/test/dummy/config/locales/en.yml
458
+ - spec/dummy_engine/test/dummy/config/routes.rb
459
+ - spec/dummy_engine/test/dummy/config/secrets.yml
460
+ - spec/examples/connection_adapter_examples.rb
461
+ - spec/examples/generic_adapter_custom_configuration_example.rb
462
+ - spec/examples/generic_adapter_examples.rb
463
+ - spec/examples/schema_adapter_examples.rb
464
+ - spec/integration/apartment_rake_integration_spec.rb
465
+ - spec/integration/query_caching_spec.rb
466
+ - spec/integration/use_within_an_engine_spec.rb
467
+ - spec/schemas/v1.rb
468
+ - spec/schemas/v2.rb
469
+ - spec/schemas/v3.rb
470
+ - spec/spec_helper.rb
471
+ - spec/support/apartment_helpers.rb
472
+ - spec/support/capybara_sessions.rb
473
+ - spec/support/config.rb
474
+ - spec/support/contexts.rb
475
+ - spec/support/requirements.rb
476
+ - spec/support/setup.rb
477
+ - spec/tasks/apartment_rake_spec.rb
478
+ - spec/tenant_spec.rb
479
+ - spec/unit/config_spec.rb
480
+ - spec/unit/elevators/domain_spec.rb
481
+ - spec/unit/elevators/first_subdomain_spec.rb
482
+ - spec/unit/elevators/generic_spec.rb
483
+ - spec/unit/elevators/host_hash_spec.rb
484
+ - spec/unit/elevators/host_spec.rb
485
+ - spec/unit/elevators/subdomain_spec.rb
486
+ - spec/unit/migrator_spec.rb
487
+ - spec/unit/reloader_spec.rb