motel-activerecord 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d99bb0326610a2417b22820a6f19fe41267d345
4
- data.tar.gz: 5758e9d8179ff47709fe4b3f4633e55842a386ed
3
+ metadata.gz: d63d3217db37313c2fdf0ea05beddecf96829775
4
+ data.tar.gz: 51ec95575f6533064f49b0fd1938682108120e2c
5
5
  SHA512:
6
- metadata.gz: 19f4d633c32fe7a15744f7c3c3599a2adb43c5e04bd1f6be0ce7e1c6d8f12ecf1303707c68f8b58bd5e8ce59fc6906a633b336cfafbc59d60771dc4a3f3ce9f3
7
- data.tar.gz: e1900055fe03cb927f8daaf1d6ad4eaf887fe941dbacbe6e371f2ffcd0d6c2e7d0db139ebcf0e69740f7b97d06032a3bad297b24fbbb7c0f3588662583ff6ee7
6
+ metadata.gz: 3fdd2eb7bf0b8673feae3601c02081ab91bbc52eed684ec1cee07cda7f1a7c09ec1e50345ce0167e6dba11dea7786936503ffcf17b99d1f588014730f4eb65e5
7
+ data.tar.gz: bf6799396a47d73b5c0fb00c7b47f70d833c84223c9504ba006874ea31f4a732484f133ad39b6afa14e114e1e61a635836522601cabef6d5d212eb284a0db517
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Motel ActiveRecord
1
+ Motel-ActiveRecord
2
2
  ===================
3
3
 
4
4
  Motel is a gem that adds functionality to ActiveRecord to use
@@ -59,7 +59,7 @@ table_name: 'tenant'
59
59
 
60
60
  Note: The columns of the table must contain connection details and
61
61
  thad are according with the information needed to connect to a database,
62
- including the name column to store the tenant name. Example columns
62
+ including the name column to store the tenant name. Example columns
63
63
  are showed below:
64
64
 
65
65
  |Name |Type |
@@ -91,13 +91,13 @@ option.
91
91
 
92
92
  ### Default source of tenants
93
93
 
94
- Also you can use the gem without specify a source configuration.
94
+ Also you can use the gem without specify a source configuration.
95
95
 
96
96
  If you want to assing dirently the tenants specificactions you can do it:
97
97
 
98
98
  ```ruby
99
99
  config.motel.tenants_source_configurations = {
100
- tenant: { 'foo' => { adapter: 'sqlite3', database: 'db/foo.sqlite3' }}
100
+ configurations: { 'foo' => { adapter: 'sqlite3', database: 'db/foo.sqlite3' }}
101
101
  }
102
102
  ```
103
103
 
@@ -105,13 +105,21 @@ Assing tenants from database.yml file:
105
105
 
106
106
  ```ruby
107
107
  config.motel.tenants_source_configurations = {
108
- tenant: Rails.application.config.database_configuration
108
+ configurations: Rails.application.config.database_configuration
109
109
  }
110
110
  ```
111
111
 
112
- Note: The methods like `add_tenant`, `update_tenant` and
112
+ Note: The methods like `add_tenant`, `update_tenant` and
113
113
  `delete_tenant` dosen't store permanently tenants.
114
114
 
115
+ ### Use rake task
116
+ Set the `TENANT` environment variable to run the rake task on a
117
+ specific tenant.
118
+
119
+ ```ruby
120
+ $ TENANT='foo' rake db:migrate
121
+ ```
122
+
115
123
  ### More configurations
116
124
 
117
125
  You can assign a default tenant if the current tenant is null:
@@ -121,15 +129,15 @@ config.motel.default_tenant = 'my_default_tenant'
121
129
  ```
122
130
 
123
131
  Tenants switching is done via the subdomain of the url, you can
124
- specify a criteria to identify the tenant providing a regex as a
125
- string. Example, to get the tenant `foo` from the following url
132
+ specify a criteria to identify the tenant providing a regex as a
133
+ string. Example, to get the tenant `foo` from the follow url
126
134
  `http://www.example.com/foo/index` you should write:
127
135
 
128
136
  ```ruby
129
137
  config.motel.admission_criteria = '\/(\w*)\/'
130
138
  ```
131
139
 
132
- To disable automatic switching between tenants by url you must
140
+ If you do not want the automatic switching of tenants by url you must
133
141
  disable the middleware:
134
142
 
135
143
  ```ruby
@@ -147,7 +155,8 @@ config.motel.nonexistent_tenant_page = 'new_path'
147
155
 
148
156
  ### Specifying the source of tenants
149
157
 
150
- You can set the source of the tenants in the same way as with Rails, use the method `tenants_source_configurations` of `ActiveRecord::Base.motel`:
158
+ You can set the source of the tenants in the same way as with Rails,
159
+ use the method `tenants_source_configurations` of `ActiveRecord::Base.motel`:
151
160
 
152
161
  ```ruby
153
162
  ActiveRecord::Base.motel.tenants_source_configurations({
@@ -164,9 +173,9 @@ Set a tenats source configurations
164
173
  ActiveRecord::Base.motel.tenants_source_configurations(config)
165
174
  ```
166
175
 
167
- Set the admission criterio for the middleware
176
+ Set the admission criteria for the middleware
168
177
  ```ruby
169
- ActiveRecord::Base.motel.admission_criterio
178
+ ActiveRecord::Base.motel.admission_criteria
170
179
  ```
171
180
 
172
181
  Set a default tenant
@@ -222,4 +231,4 @@ ActiveRecord::Base.motel.active_tenants
222
231
  Determine the tenant to use for the connection
223
232
  ```ruby
224
233
  ActiveRecord::Base.motel.determines_tenant
225
- ```
234
+ ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motel-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Martínez Valdelamar
@@ -79,33 +79,31 @@ extensions: []
79
79
  extra_rdoc_files: []
80
80
  files:
81
81
  - lib/motel-activerecord.rb
82
- - lib/motel/manager.rb
83
- - lib/motel/sources.rb
84
- - lib/motel/railtie.rb
85
- - lib/motel/sources/database.rb
86
- - lib/motel/sources/default.rb
87
- - lib/motel/sources/redis.rb
88
- - lib/motel/errors.rb
89
82
  - lib/motel/version.rb
90
- - lib/motel/connection_adapters.rb
91
- - lib/motel/multi_tenant.rb
92
- - lib/motel/connection_adapters/connection_specification/resolver.rb
83
+ - lib/motel/lobby.rb
84
+ - lib/motel/errors.rb
93
85
  - lib/motel/connection_adapters/connection_specification.rb
94
86
  - lib/motel/connection_adapters/connection_handler.rb
95
- - lib/motel/lobby.rb
87
+ - lib/motel/connection_adapters/connection_specification/resolver.rb
88
+ - lib/motel/multi_tenant.rb
89
+ - lib/motel/connection_adapters.rb
90
+ - lib/motel/sources.rb
91
+ - lib/motel/sources/redis.rb
92
+ - lib/motel/sources/default.rb
93
+ - lib/motel/sources/database.rb
94
+ - lib/motel/railtie.rb
95
+ - lib/motel/manager.rb
96
96
  - VERSION
97
97
  - README.md
98
- - spec/tmp/foo.sqlite3
99
- - spec/tmp/tenants.sqlite3
100
- - spec/spec_helper.rb
101
- - spec/lib/motel/sources/default_spec.rb
102
- - spec/lib/motel/sources/database_spec.rb
103
- - spec/lib/motel/sources/redis_spec.rb
98
+ - spec/lib/motel/multi_tenant_spec.rb
104
99
  - spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
105
100
  - spec/lib/motel/connection_adapters/connection_handler_spec.rb
106
- - spec/lib/motel/multi_tenant_spec.rb
101
+ - spec/lib/motel/sources/database_spec.rb
102
+ - spec/lib/motel/sources/default_spec.rb
103
+ - spec/lib/motel/sources/redis_spec.rb
107
104
  - spec/lib/motel/lobby_spec.rb
108
105
  - spec/lib/motel/manager_spec.rb
106
+ - spec/spec_helper.rb
109
107
  homepage: https://github.com/dimarval/motel-activerecord
110
108
  licenses:
111
109
  - MIT
@@ -131,14 +129,12 @@ signing_key:
131
129
  specification_version: 4
132
130
  summary: Multi-tenant gem
133
131
  test_files:
134
- - spec/tmp/foo.sqlite3
135
- - spec/tmp/tenants.sqlite3
136
- - spec/spec_helper.rb
137
- - spec/lib/motel/sources/default_spec.rb
138
- - spec/lib/motel/sources/database_spec.rb
139
- - spec/lib/motel/sources/redis_spec.rb
132
+ - spec/lib/motel/multi_tenant_spec.rb
140
133
  - spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
141
134
  - spec/lib/motel/connection_adapters/connection_handler_spec.rb
142
- - spec/lib/motel/multi_tenant_spec.rb
135
+ - spec/lib/motel/sources/database_spec.rb
136
+ - spec/lib/motel/sources/default_spec.rb
137
+ - spec/lib/motel/sources/redis_spec.rb
143
138
  - spec/lib/motel/lobby_spec.rb
144
139
  - spec/lib/motel/manager_spec.rb
140
+ - spec/spec_helper.rb
data/spec/tmp/foo.sqlite3 DELETED
File without changes
Binary file