dr-apartment 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/Gemfile +22 -0
- data/HISTORY.md +133 -0
- data/README.md +152 -0
- data/Rakefile +79 -0
- data/apartment.gemspec +32 -0
- data/lib/apartment.rb +69 -0
- data/lib/apartment/adapters/abstract_adapter.rb +176 -0
- data/lib/apartment/adapters/jdbcpostgresql_adapter.rb +115 -0
- data/lib/apartment/adapters/mysql_adapter.rb +18 -0
- data/lib/apartment/adapters/postgresql_adapter.rb +114 -0
- data/lib/apartment/console.rb +12 -0
- data/lib/apartment/database.rb +57 -0
- data/lib/apartment/delayed_job/active_record.rb +20 -0
- data/lib/apartment/delayed_job/enqueue.rb +20 -0
- data/lib/apartment/delayed_job/hooks.rb +25 -0
- data/lib/apartment/delayed_job/requirements.rb +23 -0
- data/lib/apartment/elevators/subdomain.rb +27 -0
- data/lib/apartment/migrator.rb +23 -0
- data/lib/apartment/railtie.rb +54 -0
- data/lib/apartment/reloader.rb +24 -0
- data/lib/apartment/version.rb +3 -0
- data/lib/tasks/apartment.rake +70 -0
- data/spec/adapters/mysql_adapter_spec.rb +36 -0
- data/spec/adapters/postgresql_adapter_spec.rb +137 -0
- data/spec/apartment_spec.rb +11 -0
- data/spec/config/database.yml +13 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +6 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/company.rb +3 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/application/index.html.erb +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +47 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +16 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/apartment.rb +4 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +37 -0
- data/spec/dummy/db/migrate/20111202022214_create_table_books.rb +13 -0
- data/spec/dummy/db/schema.rb +48 -0
- data/spec/dummy/db/seeds.rb +8 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/fake_dj_class.rb +6 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/apartment_rake_integration_spec.rb +74 -0
- data/spec/integration/database_integration_spec.rb +200 -0
- data/spec/integration/delayed_job_integration_spec.rb +100 -0
- data/spec/integration/middleware/subdomain_elevator_spec.rb +63 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/apartment_helpers.rb +32 -0
- data/spec/support/capybara_sessions.rb +15 -0
- data/spec/support/config.rb +11 -0
- data/spec/tasks/apartment_rake_spec.rb +118 -0
- data/spec/unit/config_spec.rb +78 -0
- data/spec/unit/middleware/subdomain_elevator_spec.rb +20 -0
- data/spec/unit/migrator_spec.rb +87 -0
- data/spec/unit/reloader_spec.rb +22 -0
- metadata +144 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Apartment::Reloader do
|
4
|
+
|
5
|
+
context "using postgresql schemas" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
Apartment.excluded_models = ["Company"]
|
9
|
+
Company.reset_table_name # ensure we're clean
|
10
|
+
end
|
11
|
+
|
12
|
+
subject{ Apartment::Reloader.new(mock("Rack::Application", :call => nil)) }
|
13
|
+
|
14
|
+
it "should initialize apartment when called" do
|
15
|
+
Company.table_name.should_not include('public.')
|
16
|
+
subject.call(mock('env'))
|
17
|
+
Company.table_name.should include('public.')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dr-apartment
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 37
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 14
|
9
|
+
- 1
|
10
|
+
version: 0.14.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Brunner
|
14
|
+
- Brad Robertson
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2013-02-28 00:00:00 Z
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Apartment allows Rails applications to deal with database multitenancy
|
23
|
+
email:
|
24
|
+
- ryan@ryanbrunner.com
|
25
|
+
- bradleyrobertson@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- .rspec
|
35
|
+
- .rvmrc
|
36
|
+
- Gemfile
|
37
|
+
- HISTORY.md
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- apartment.gemspec
|
41
|
+
- lib/apartment.rb
|
42
|
+
- lib/apartment/adapters/abstract_adapter.rb
|
43
|
+
- lib/apartment/adapters/jdbcpostgresql_adapter.rb
|
44
|
+
- lib/apartment/adapters/mysql_adapter.rb
|
45
|
+
- lib/apartment/adapters/postgresql_adapter.rb
|
46
|
+
- lib/apartment/console.rb
|
47
|
+
- lib/apartment/database.rb
|
48
|
+
- lib/apartment/delayed_job/active_record.rb
|
49
|
+
- lib/apartment/delayed_job/enqueue.rb
|
50
|
+
- lib/apartment/delayed_job/hooks.rb
|
51
|
+
- lib/apartment/delayed_job/requirements.rb
|
52
|
+
- lib/apartment/elevators/subdomain.rb
|
53
|
+
- lib/apartment/migrator.rb
|
54
|
+
- lib/apartment/railtie.rb
|
55
|
+
- lib/apartment/reloader.rb
|
56
|
+
- lib/apartment/version.rb
|
57
|
+
- lib/tasks/apartment.rake
|
58
|
+
- spec/adapters/mysql_adapter_spec.rb
|
59
|
+
- spec/adapters/postgresql_adapter_spec.rb
|
60
|
+
- spec/apartment_spec.rb
|
61
|
+
- spec/config/database.yml
|
62
|
+
- spec/dummy/Rakefile
|
63
|
+
- spec/dummy/app/controllers/application_controller.rb
|
64
|
+
- spec/dummy/app/helpers/application_helper.rb
|
65
|
+
- spec/dummy/app/models/company.rb
|
66
|
+
- spec/dummy/app/models/user.rb
|
67
|
+
- spec/dummy/app/views/application/index.html.erb
|
68
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
69
|
+
- spec/dummy/config.ru
|
70
|
+
- spec/dummy/config/application.rb
|
71
|
+
- spec/dummy/config/boot.rb
|
72
|
+
- spec/dummy/config/database.yml
|
73
|
+
- spec/dummy/config/environment.rb
|
74
|
+
- spec/dummy/config/environments/development.rb
|
75
|
+
- spec/dummy/config/environments/production.rb
|
76
|
+
- spec/dummy/config/environments/test.rb
|
77
|
+
- spec/dummy/config/initializers/apartment.rb
|
78
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
79
|
+
- spec/dummy/config/initializers/inflections.rb
|
80
|
+
- spec/dummy/config/initializers/mime_types.rb
|
81
|
+
- spec/dummy/config/initializers/secret_token.rb
|
82
|
+
- spec/dummy/config/initializers/session_store.rb
|
83
|
+
- spec/dummy/config/locales/en.yml
|
84
|
+
- spec/dummy/config/routes.rb
|
85
|
+
- spec/dummy/db/migrate/20110613152810_create_dummy_models.rb
|
86
|
+
- spec/dummy/db/migrate/20111202022214_create_table_books.rb
|
87
|
+
- spec/dummy/db/schema.rb
|
88
|
+
- spec/dummy/db/seeds.rb
|
89
|
+
- spec/dummy/db/test.sqlite3
|
90
|
+
- spec/dummy/lib/fake_dj_class.rb
|
91
|
+
- spec/dummy/public/404.html
|
92
|
+
- spec/dummy/public/422.html
|
93
|
+
- spec/dummy/public/500.html
|
94
|
+
- spec/dummy/public/favicon.ico
|
95
|
+
- spec/dummy/public/stylesheets/.gitkeep
|
96
|
+
- spec/dummy/script/rails
|
97
|
+
- spec/integration/apartment_rake_integration_spec.rb
|
98
|
+
- spec/integration/database_integration_spec.rb
|
99
|
+
- spec/integration/delayed_job_integration_spec.rb
|
100
|
+
- spec/integration/middleware/subdomain_elevator_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
- spec/support/apartment_helpers.rb
|
103
|
+
- spec/support/capybara_sessions.rb
|
104
|
+
- spec/support/config.rb
|
105
|
+
- spec/tasks/apartment_rake_spec.rb
|
106
|
+
- spec/unit/config_spec.rb
|
107
|
+
- spec/unit/middleware/subdomain_elevator_spec.rb
|
108
|
+
- spec/unit/migrator_spec.rb
|
109
|
+
- spec/unit/reloader_spec.rb
|
110
|
+
homepage: http://github.com/bradrobertson/apartment
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
version: "0"
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
136
|
+
requirements: []
|
137
|
+
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 1.8.24
|
140
|
+
signing_key:
|
141
|
+
specification_version: 3
|
142
|
+
summary: A Ruby gem for managing database multitenancy in Rails applications
|
143
|
+
test_files: []
|
144
|
+
|