apartment 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.pryrc +3 -0
- data/.travis.yml +5 -0
- data/HISTORY.md +8 -0
- data/README.md +66 -14
- data/Rakefile +11 -10
- data/apartment.gemspec +6 -5
- data/lib/apartment.rb +21 -3
- data/lib/apartment/adapters/{mysql_adapter.rb → mysql2_adapter.rb} +7 -7
- data/lib/apartment/adapters/postgresql_adapter.rb +26 -15
- data/lib/apartment/database.rb +3 -0
- data/lib/apartment/elevators/domain.rb +18 -0
- data/lib/apartment/elevators/generic.rb +27 -0
- data/lib/apartment/elevators/subdomain.rb +5 -19
- data/lib/apartment/version.rb +1 -1
- data/spec/adapters/{mysql_adapter_spec.rb → mysql2_adapter_spec.rb} +7 -7
- data/spec/adapters/postgresql_adapter_spec.rb +4 -4
- data/spec/config/database.yml +2 -1
- data/spec/database_spec.rb +49 -26
- data/spec/dummy/config/application.rb +3 -0
- data/spec/examples/db_adapter_examples.rb +8 -8
- data/spec/examples/elevator_examples.rb +31 -0
- data/spec/examples/generic_adapter_examples.rb +10 -10
- data/spec/examples/schema_adapter_examples.rb +125 -38
- data/spec/integration/delayed_job_integration_spec.rb +1 -1
- data/spec/integration/middleware/domain_elevator_spec.rb +9 -0
- data/spec/integration/middleware/generic_elevator_spec.rb +10 -0
- data/spec/integration/middleware/subdomain_elevator_spec.rb +6 -49
- data/spec/spec_helper.rb +5 -2
- data/spec/support/apartment_helpers.rb +13 -10
- data/spec/support/contexts.rb +54 -0
- data/spec/support/requirements.rb +4 -4
- data/spec/unit/config_spec.rb +0 -4
- data/spec/unit/middleware/domain_elevator_spec.rb +26 -0
- data/spec/unit/middleware/subdomain_elevator_spec.rb +7 -7
- metadata +119 -108
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Apartment::Elevators::Generic, :elevator => true do
|
4
|
+
|
5
|
+
# NOTE, see spec/dummy/config/application.rb to see the Proc that defines the behaviour here
|
6
|
+
let(:domain1) { "http://#{database1}.com?db=#{database1}" }
|
7
|
+
let(:domain2) { "http://#{database2}.com?db=#{database2}" }
|
8
|
+
|
9
|
+
it_should_behave_like "an apartment elevator"
|
10
|
+
end
|
@@ -1,52 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Apartment::Elevators::Subdomain do
|
4
|
-
|
5
|
-
let(:
|
6
|
-
let(:
|
7
|
-
|
8
|
-
|
9
|
-
before do
|
10
|
-
Apartment.seed_after_create = false
|
11
|
-
Apartment.use_postgres_schemas = true
|
12
|
-
|
13
|
-
api.create(company.subdomain)
|
14
|
-
end
|
15
|
-
|
16
|
-
after{ api.drop(company.subdomain) }
|
17
|
-
|
18
|
-
context "single request" do
|
19
|
-
it "should switch the db" do
|
20
|
-
ActiveRecord::Base.connection.schema_search_path.should_not == company.subdomain
|
21
|
-
|
22
|
-
visit(domain)
|
23
|
-
ActiveRecord::Base.connection.schema_search_path.should == company.subdomain
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "simultaneous requests" do
|
28
|
-
let(:company2){ mock_model(Company, :subdomain => 'bar').as_null_object }
|
29
|
-
let(:domain2){ "http://#{company2.subdomain}.domain.com" }
|
30
|
-
|
31
|
-
before{ api.create(company2.subdomain) }
|
32
|
-
after{ api.drop(company2.subdomain) }
|
33
|
-
|
34
|
-
let!(:c1_user_count){ api.process(company.subdomain){ (2 + rand(2)).times{ User.create } } }
|
35
|
-
let!(:c2_user_count){ api.process(company2.subdomain){ (c1_user_count + 2).times{ User.create } } }
|
36
|
-
|
37
|
-
it "should fetch the correct user count for each session based on subdomain" do
|
38
|
-
visit(domain)
|
39
|
-
|
40
|
-
in_new_session do |session|
|
41
|
-
session.visit(domain2)
|
42
|
-
User.count.should == c2_user_count
|
43
|
-
end
|
44
|
-
|
45
|
-
visit(domain)
|
46
|
-
User.count.should == c1_user_count
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
3
|
+
describe Apartment::Elevators::Subdomain, :elevator => true do
|
4
|
+
|
5
|
+
let(:domain1) { "http://#{database1}.example.com" }
|
6
|
+
let(:domain2) { "http://#{database2}.example.com" }
|
7
|
+
|
8
|
+
it_should_behave_like "an apartment elevator"
|
52
9
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,9 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
7
7
|
require "rspec/rails"
|
8
8
|
require 'capybara/rspec'
|
9
9
|
require 'capybara/rails'
|
10
|
+
require 'pry'
|
11
|
+
|
12
|
+
silence_warnings{ IRB = Pry }
|
10
13
|
|
11
14
|
ActionMailer::Base.delivery_method = :test
|
12
15
|
ActionMailer::Base.perform_deliveries = true
|
@@ -27,9 +30,9 @@ RSpec.configure do |config|
|
|
27
30
|
# Necessary as some tests will leak things like current_schema into the next test
|
28
31
|
ActiveRecord::Base.clear_all_connections!
|
29
32
|
end
|
30
|
-
|
33
|
+
|
31
34
|
config.after(:each) do
|
32
|
-
Apartment
|
35
|
+
Apartment.reset
|
33
36
|
end
|
34
37
|
|
35
38
|
end
|
@@ -1,38 +1,41 @@
|
|
1
1
|
module Apartment
|
2
2
|
module Test
|
3
|
-
|
3
|
+
|
4
4
|
extend self
|
5
|
-
|
5
|
+
|
6
6
|
def reset
|
7
7
|
Apartment.excluded_models = nil
|
8
8
|
Apartment.use_postgres_schemas = nil
|
9
9
|
Apartment.seed_after_create = nil
|
10
|
+
Apartment.default_schema = nil
|
10
11
|
end
|
11
|
-
|
12
|
+
|
12
13
|
def next_db
|
13
14
|
@x ||= 0
|
14
|
-
"
|
15
|
+
"db%d" % @x += 1
|
15
16
|
end
|
16
|
-
|
17
|
+
|
17
18
|
def drop_schema(schema)
|
18
19
|
ActiveRecord::Base.connection.execute("DROP SCHEMA IF EXISTS #{schema} CASCADE") rescue true
|
19
20
|
end
|
20
|
-
|
21
|
+
|
22
|
+
# Use this if you don't want to import schema.rb etc... but need the postgres schema to exist
|
23
|
+
# basically for speed purposes
|
21
24
|
def create_schema(schema)
|
22
25
|
ActiveRecord::Base.connection.execute("CREATE SCHEMA #{schema}")
|
23
26
|
end
|
24
|
-
|
27
|
+
|
25
28
|
def load_schema
|
26
29
|
silence_stream(STDOUT){ load(Rails.root.join('db', 'schema.rb')) }
|
27
30
|
end
|
28
|
-
|
31
|
+
|
29
32
|
def migrate
|
30
33
|
ActiveRecord::Migrator.migrate(Rails.root + ActiveRecord::Migrator.migrations_path)
|
31
34
|
end
|
32
|
-
|
35
|
+
|
33
36
|
def rollback
|
34
37
|
ActiveRecord::Migrator.rollback(Rails.root + ActiveRecord::Migrator.migrations_path)
|
35
38
|
end
|
36
|
-
|
39
|
+
|
37
40
|
end
|
38
41
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Some shared contexts for specs
|
2
|
+
|
3
|
+
shared_context "with default schema", :default_schema => true do
|
4
|
+
let(:default_schema){ Apartment::Test.next_db }
|
5
|
+
|
6
|
+
before do
|
7
|
+
Apartment::Test.create_schema(default_schema)
|
8
|
+
Apartment.default_schema = default_schema
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
# resetting default_schema so we can drop and any further resets won't try to access droppped schema
|
13
|
+
Apartment.default_schema = nil
|
14
|
+
Apartment::Test.drop_schema(default_schema)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Some default setup for elevator specs
|
19
|
+
shared_context "elevators", :elevator => true do
|
20
|
+
let(:company1) { mock_model(Company, :database => Apartment::Test.next_db).as_null_object }
|
21
|
+
let(:company2) { mock_model(Company, :database => Apartment::Test.next_db).as_null_object }
|
22
|
+
|
23
|
+
let(:database1) { company1.database }
|
24
|
+
let(:database2) { company2.database }
|
25
|
+
|
26
|
+
let(:api) { Apartment::Database }
|
27
|
+
|
28
|
+
before do
|
29
|
+
Apartment.seed_after_create = false
|
30
|
+
Apartment.use_postgres_schemas = true
|
31
|
+
|
32
|
+
api.create(database1)
|
33
|
+
api.create(database2)
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
api.drop(database1)
|
38
|
+
api.drop(database2)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
shared_context "persistent_schemas", :persistent_schemas => true do
|
43
|
+
let(:persistent_schemas){ ['hstore', 'postgis'] }
|
44
|
+
|
45
|
+
before do
|
46
|
+
persistent_schemas.map{|schema| subject.create(schema) }
|
47
|
+
Apartment.persistent_schemas = persistent_schemas
|
48
|
+
end
|
49
|
+
|
50
|
+
after do
|
51
|
+
Apartment.persistent_schemas = []
|
52
|
+
persistent_schemas.map{|schema| subject.drop(schema) }
|
53
|
+
end
|
54
|
+
end
|
@@ -7,9 +7,9 @@ module Apartment
|
|
7
7
|
#
|
8
8
|
#
|
9
9
|
module AdapterRequirements
|
10
|
-
|
10
|
+
|
11
11
|
extend ActiveSupport::Concern
|
12
|
-
|
12
|
+
|
13
13
|
included do
|
14
14
|
let(:db1){ Apartment::Test.next_db }
|
15
15
|
let(:db2){ Apartment::Test.next_db }
|
@@ -28,7 +28,7 @@ module Apartment
|
|
28
28
|
# sometimes we manually drop these schemas in testing, don't care if we can't drop, hence rescue
|
29
29
|
subject.drop(db1) rescue true
|
30
30
|
subject.drop(db2) rescue true
|
31
|
-
|
31
|
+
|
32
32
|
ActiveRecord::Base.clear_all_connections!
|
33
33
|
Apartment::Database.reload!
|
34
34
|
end
|
@@ -39,7 +39,7 @@ module Apartment
|
|
39
39
|
raise "You must define a `#{method}` method in your host group"
|
40
40
|
end unless defined?(method)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/spec/unit/config_spec.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Apartment::Elevators::Domain do
|
4
|
+
|
5
|
+
describe "#parse_database_name" do
|
6
|
+
it "parses the host for a domain name" do
|
7
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'example.com')
|
8
|
+
elevator = Apartment::Elevators::Domain.new(nil)
|
9
|
+
elevator.parse_database_name(request).should == 'example'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "ignores a www prefix and domain suffix" do
|
13
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => 'www.example.bc.ca')
|
14
|
+
elevator = Apartment::Elevators::Domain.new(nil)
|
15
|
+
elevator.parse_database_name(request).should == 'example'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns nil if there is no host" do
|
19
|
+
request = ActionDispatch::Request.new('HTTP_HOST' => '')
|
20
|
+
elevator = Apartment::Elevators::Domain.new(nil)
|
21
|
+
elevator.parse_database_name(request).should be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Apartment::Elevators::Subdomain do
|
4
|
-
|
5
|
-
describe "#
|
4
|
+
|
5
|
+
describe "#parse_database_name" do
|
6
6
|
it "should parse subdomain" do
|
7
7
|
request = ActionDispatch::Request.new('HTTP_HOST' => 'foo.bar.com')
|
8
8
|
elevator = Apartment::Elevators::Subdomain.new(nil)
|
9
|
-
elevator.
|
9
|
+
elevator.parse_database_name(request).should == 'foo'
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should return nil when no subdomain" do
|
13
13
|
request = ActionDispatch::Request.new('HTTP_HOST' => 'bar.com')
|
14
14
|
elevator = Apartment::Elevators::Subdomain.new(nil)
|
15
|
-
elevator.
|
15
|
+
elevator.parse_database_name(request).should be_nil
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
end
|
metadata
CHANGED
@@ -1,165 +1,173 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: apartment
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.16.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.15.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Ryan Brunner
|
9
9
|
- Brad Robertson
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-06-01 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
18
16
|
name: activerecord
|
19
|
-
requirement: &
|
17
|
+
requirement: &2152850820 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
24
22
|
version: 3.1.2
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
|
-
version_requirements: *
|
28
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: *2152850820
|
26
|
+
- !ruby/object:Gem::Dependency
|
29
27
|
name: rack
|
30
|
-
requirement: &
|
28
|
+
requirement: &2152849500 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 1.
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.6
|
36
34
|
type: :runtime
|
37
35
|
prerelease: false
|
38
|
-
version_requirements: *
|
39
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *2152849500
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: pry
|
39
|
+
requirement: &2152722880 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.9.9
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2152722880
|
48
|
+
- !ruby/object:Gem::Dependency
|
40
49
|
name: rails
|
41
|
-
requirement: &
|
50
|
+
requirement: &2152722120 !ruby/object:Gem::Requirement
|
42
51
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
46
55
|
version: 3.1.2
|
47
56
|
type: :development
|
48
57
|
prerelease: false
|
49
|
-
version_requirements: *
|
50
|
-
- !ruby/object:Gem::Dependency
|
58
|
+
version_requirements: *2152722120
|
59
|
+
- !ruby/object:Gem::Dependency
|
51
60
|
name: rake
|
52
|
-
requirement: &
|
61
|
+
requirement: &2152721240 !ruby/object:Gem::Requirement
|
53
62
|
none: false
|
54
|
-
requirements:
|
63
|
+
requirements:
|
55
64
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
65
|
+
- !ruby/object:Gem::Version
|
57
66
|
version: 0.9.2
|
58
67
|
type: :development
|
59
68
|
prerelease: false
|
60
|
-
version_requirements: *
|
61
|
-
- !ruby/object:Gem::Dependency
|
69
|
+
version_requirements: *2152721240
|
70
|
+
- !ruby/object:Gem::Dependency
|
62
71
|
name: sqlite3
|
63
|
-
requirement: &
|
72
|
+
requirement: &2152719600 !ruby/object:Gem::Requirement
|
64
73
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
69
78
|
type: :development
|
70
79
|
prerelease: false
|
71
|
-
version_requirements: *
|
72
|
-
- !ruby/object:Gem::Dependency
|
80
|
+
version_requirements: *2152719600
|
81
|
+
- !ruby/object:Gem::Dependency
|
73
82
|
name: rspec
|
74
|
-
requirement: &
|
83
|
+
requirement: &2152717500 !ruby/object:Gem::Requirement
|
75
84
|
none: false
|
76
|
-
requirements:
|
85
|
+
requirements:
|
77
86
|
- - ~>
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 2.
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.10.0
|
80
89
|
type: :development
|
81
90
|
prerelease: false
|
82
|
-
version_requirements: *
|
83
|
-
- !ruby/object:Gem::Dependency
|
91
|
+
version_requirements: *2152717500
|
92
|
+
- !ruby/object:Gem::Dependency
|
84
93
|
name: rspec-rails
|
85
|
-
requirement: &
|
94
|
+
requirement: &2152733100 !ruby/object:Gem::Requirement
|
86
95
|
none: false
|
87
|
-
requirements:
|
96
|
+
requirements:
|
88
97
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 2.
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.10.0
|
91
100
|
type: :development
|
92
101
|
prerelease: false
|
93
|
-
version_requirements: *
|
94
|
-
- !ruby/object:Gem::Dependency
|
102
|
+
version_requirements: *2152733100
|
103
|
+
- !ruby/object:Gem::Dependency
|
95
104
|
name: capybara
|
96
|
-
requirement: &
|
105
|
+
requirement: &2152732580 !ruby/object:Gem::Requirement
|
97
106
|
none: false
|
98
|
-
requirements:
|
107
|
+
requirements:
|
99
108
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
109
|
+
- !ruby/object:Gem::Version
|
101
110
|
version: 1.0.0
|
102
111
|
type: :development
|
103
112
|
prerelease: false
|
104
|
-
version_requirements: *
|
105
|
-
- !ruby/object:Gem::Dependency
|
113
|
+
version_requirements: *2152732580
|
114
|
+
- !ruby/object:Gem::Dependency
|
106
115
|
name: pg
|
107
|
-
requirement: &
|
116
|
+
requirement: &2152732000 !ruby/object:Gem::Requirement
|
108
117
|
none: false
|
109
|
-
requirements:
|
110
|
-
- -
|
111
|
-
- !ruby/object:Gem::Version
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
112
121
|
version: 0.11.0
|
113
122
|
type: :development
|
114
123
|
prerelease: false
|
115
|
-
version_requirements: *
|
116
|
-
- !ruby/object:Gem::Dependency
|
124
|
+
version_requirements: *2152732000
|
125
|
+
- !ruby/object:Gem::Dependency
|
117
126
|
name: mysql2
|
118
|
-
requirement: &
|
127
|
+
requirement: &2152731420 !ruby/object:Gem::Requirement
|
119
128
|
none: false
|
120
|
-
requirements:
|
129
|
+
requirements:
|
121
130
|
- - ~>
|
122
|
-
- !ruby/object:Gem::Version
|
131
|
+
- !ruby/object:Gem::Version
|
123
132
|
version: 0.3.10
|
124
133
|
type: :development
|
125
134
|
prerelease: false
|
126
|
-
version_requirements: *
|
127
|
-
- !ruby/object:Gem::Dependency
|
135
|
+
version_requirements: *2152731420
|
136
|
+
- !ruby/object:Gem::Dependency
|
128
137
|
name: delayed_job
|
129
|
-
requirement: &
|
138
|
+
requirement: &2152730820 !ruby/object:Gem::Requirement
|
130
139
|
none: false
|
131
|
-
requirements:
|
140
|
+
requirements:
|
132
141
|
- - ~>
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version:
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '3.0'
|
135
144
|
type: :development
|
136
145
|
prerelease: false
|
137
|
-
version_requirements: *
|
138
|
-
- !ruby/object:Gem::Dependency
|
146
|
+
version_requirements: *2152730820
|
147
|
+
- !ruby/object:Gem::Dependency
|
139
148
|
name: delayed_job_active_record
|
140
|
-
requirement: &
|
149
|
+
requirement: &2152730320 !ruby/object:Gem::Requirement
|
141
150
|
none: false
|
142
|
-
requirements:
|
143
|
-
- -
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version:
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
146
155
|
type: :development
|
147
156
|
prerelease: false
|
148
|
-
version_requirements: *
|
157
|
+
version_requirements: *2152730320
|
149
158
|
description: Apartment allows Rails applications to deal with database multitenancy
|
150
|
-
email:
|
159
|
+
email:
|
151
160
|
- ryan@ryanbrunner.com
|
152
161
|
- bradleyrobertson@gmail.com
|
153
162
|
executables: []
|
154
|
-
|
155
163
|
extensions: []
|
156
|
-
|
157
164
|
extra_rdoc_files: []
|
158
|
-
|
159
|
-
files:
|
165
|
+
files:
|
160
166
|
- .gitignore
|
167
|
+
- .pryrc
|
161
168
|
- .rspec
|
162
169
|
- .rvmrc
|
170
|
+
- .travis.yml
|
163
171
|
- Gemfile
|
164
172
|
- HISTORY.md
|
165
173
|
- README.md
|
@@ -167,7 +175,7 @@ files:
|
|
167
175
|
- apartment.gemspec
|
168
176
|
- lib/apartment.rb
|
169
177
|
- lib/apartment/adapters/abstract_adapter.rb
|
170
|
-
- lib/apartment/adapters/
|
178
|
+
- lib/apartment/adapters/mysql2_adapter.rb
|
171
179
|
- lib/apartment/adapters/postgresql_adapter.rb
|
172
180
|
- lib/apartment/console.rb
|
173
181
|
- lib/apartment/database.rb
|
@@ -175,13 +183,15 @@ files:
|
|
175
183
|
- lib/apartment/delayed_job/enqueue.rb
|
176
184
|
- lib/apartment/delayed_job/hooks.rb
|
177
185
|
- lib/apartment/delayed_job/requirements.rb
|
186
|
+
- lib/apartment/elevators/domain.rb
|
187
|
+
- lib/apartment/elevators/generic.rb
|
178
188
|
- lib/apartment/elevators/subdomain.rb
|
179
189
|
- lib/apartment/migrator.rb
|
180
190
|
- lib/apartment/railtie.rb
|
181
191
|
- lib/apartment/reloader.rb
|
182
192
|
- lib/apartment/version.rb
|
183
193
|
- lib/tasks/apartment.rake
|
184
|
-
- spec/adapters/
|
194
|
+
- spec/adapters/mysql2_adapter_spec.rb
|
185
195
|
- spec/adapters/postgresql_adapter_spec.rb
|
186
196
|
- spec/apartment_spec.rb
|
187
197
|
- spec/config/database.yml
|
@@ -222,54 +232,55 @@ files:
|
|
222
232
|
- spec/dummy/public/stylesheets/.gitkeep
|
223
233
|
- spec/dummy/script/rails
|
224
234
|
- spec/examples/db_adapter_examples.rb
|
235
|
+
- spec/examples/elevator_examples.rb
|
225
236
|
- spec/examples/generic_adapter_examples.rb
|
226
237
|
- spec/examples/schema_adapter_examples.rb
|
227
238
|
- spec/integration/apartment_rake_integration_spec.rb
|
228
239
|
- spec/integration/delayed_job_integration_spec.rb
|
240
|
+
- spec/integration/middleware/domain_elevator_spec.rb
|
241
|
+
- spec/integration/middleware/generic_elevator_spec.rb
|
229
242
|
- spec/integration/middleware/subdomain_elevator_spec.rb
|
230
243
|
- spec/spec_helper.rb
|
231
244
|
- spec/support/apartment_helpers.rb
|
232
245
|
- spec/support/capybara_sessions.rb
|
233
246
|
- spec/support/config.rb
|
247
|
+
- spec/support/contexts.rb
|
234
248
|
- spec/support/requirements.rb
|
235
249
|
- spec/tasks/apartment_rake_spec.rb
|
236
250
|
- spec/unit/config_spec.rb
|
251
|
+
- spec/unit/middleware/domain_elevator_spec.rb
|
237
252
|
- spec/unit/middleware/subdomain_elevator_spec.rb
|
238
253
|
- spec/unit/migrator_spec.rb
|
239
254
|
- spec/unit/reloader_spec.rb
|
240
|
-
has_rdoc: true
|
241
255
|
homepage: http://github.com/bradrobertson/apartment
|
242
|
-
licenses:
|
256
|
+
licenses:
|
243
257
|
- MIT
|
244
258
|
post_install_message:
|
245
259
|
rdoc_options: []
|
246
|
-
|
247
|
-
require_paths:
|
260
|
+
require_paths:
|
248
261
|
- lib
|
249
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
262
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
250
263
|
none: false
|
251
|
-
requirements:
|
252
|
-
- -
|
253
|
-
- !ruby/object:Gem::Version
|
254
|
-
|
255
|
-
segments:
|
264
|
+
requirements:
|
265
|
+
- - ! '>='
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '0'
|
268
|
+
segments:
|
256
269
|
- 0
|
257
|
-
|
258
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
|
+
hash: -2664931283611215158
|
271
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
272
|
none: false
|
260
|
-
requirements:
|
261
|
-
- -
|
262
|
-
- !ruby/object:Gem::Version
|
263
|
-
|
264
|
-
segments:
|
273
|
+
requirements:
|
274
|
+
- - ! '>='
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: '0'
|
277
|
+
segments:
|
265
278
|
- 0
|
266
|
-
|
279
|
+
hash: -2664931283611215158
|
267
280
|
requirements: []
|
268
|
-
|
269
281
|
rubyforge_project:
|
270
|
-
rubygems_version: 1.
|
282
|
+
rubygems_version: 1.8.10
|
271
283
|
signing_key:
|
272
284
|
specification_version: 3
|
273
285
|
summary: A Ruby gem for managing database multitenancy in Rails applications
|
274
286
|
test_files: []
|
275
|
-
|