locomotivecms 3.0.0.rc3 → 3.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/README.md +1 -1
- data/app/assets/stylesheets/locomotive/unauthorized/_public.scss +7 -4
- data/app/controllers/locomotive/errors_controller.rb +4 -0
- data/app/helpers/locomotive/errors_helper.rb +2 -4
- data/app/models/locomotive/concerns/content_entry/csv.rb +4 -0
- data/app/models/locomotive/concerns/content_entry/slug.rb +0 -2
- data/app/models/locomotive/concerns/content_type/sync.rb +2 -2
- data/app/models/locomotive/concerns/page/templatized.rb +1 -1
- data/app/models/locomotive/concerns/site/access_points.rb +3 -3
- data/app/models/locomotive/theme_asset.rb +0 -1
- data/app/views/locomotive/developers_documentation/_wagon.html.slim +2 -2
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +1 -0
- data/app/views/locomotive/errors/no_site.json +1 -0
- data/app/views/locomotive/shared/_sidebar.html.slim +1 -1
- data/app/views/locomotive/shared/_sidebar_without_site.html.slim +1 -1
- data/app/views/locomotive/shared/header/_account_menu.html.slim +2 -2
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +4 -2
- data/lib/generators/locomotive/install/install_generator.rb +9 -9
- data/lib/generators/locomotive/install/templates/carrierwave.rb +23 -12
- data/lib/generators/locomotive/install/templates/carrierwave_aws.rb +36 -0
- data/lib/generators/locomotive/install/templates/mongoid.yml +97 -35
- data/lib/locomotive/dependencies.rb +1 -1
- data/lib/locomotive/middlewares/site.rb +10 -4
- data/lib/locomotive/mongoid/patches.rb +1 -1
- data/lib/locomotive/steam_adaptor.rb +6 -4
- data/lib/locomotive/version.rb +1 -1
- data/spec/dummy/config/application.rb +0 -3
- data/spec/dummy/config/initializers/devise.rb +128 -58
- data/spec/dummy/config/mongoid.yml +95 -78
- data/spec/models/locomotive/content_entry_spec.rb +6 -6
- data/spec/requests/locomotive/steam/cache_spec.rb +1 -1
- data/spec/requests/site_spec.rb +25 -0
- data/spec/support/mongoid.rb +2 -0
- metadata +16 -189
- data/features/api/accounts.feature +0 -43
- data/features/api/authentication.feature +0 -41
- data/features/api/authorization/accounts.feature +0 -165
- data/features/api/authorization/content_assets.feature +0 -147
- data/features/api/authorization/content_entries.feature +0 -202
- data/features/api/authorization/content_types.feature +0 -237
- data/features/api/authorization/current_site.feature +0 -30
- data/features/api/authorization/memberships.feature +0 -225
- data/features/api/authorization/pages.feature +0 -189
- data/features/api/authorization/sites.feature +0 -212
- data/features/api/authorization/snippets.feature +0 -179
- data/features/api/authorization/theme_assets.feature +0 -185
- data/features/api/authorization/translations.feature +0 -253
- data/features/api/content_entries.feature +0 -184
- data/features/api/content_types.feature +0 -156
- data/features/api/editable_elements.feature +0 -190
- data/features/api/entries_custom_fields.feature +0 -150
- data/features/api/memberships.feature +0 -26
- data/features/api/pages.feature +0 -72
- data/features/backoffice/authorization/account_settings.feature +0 -28
- data/features/backoffice/authorization/content_type.feature +0 -35
- data/features/backoffice/authorization/current_site.feature +0 -53
- data/features/backoffice/authorization/inline_front_end_editing.feature +0 -46
- data/features/backoffice/authorization/pages.feature +0 -95
- data/features/backoffice/authorization/theme_assets.feature +0 -50
- data/features/backoffice/content_types/edit.feature +0 -20
- data/features/backoffice/content_types/email.feature +0 -26
- data/features/backoffice/content_types/has_many.feature +0 -80
- data/features/backoffice/content_types/integer.feature +0 -26
- data/features/backoffice/content_types/localized.feature +0 -63
- data/features/backoffice/content_types/many_to_many.feature +0 -70
- data/features/backoffice/content_types/tags.feature +0 -22
- data/features/backoffice/content_types/uniqueness.feature +0 -29
- data/features/backoffice/contents.feature +0 -93
- data/features/backoffice/editable_elements.feature +0 -22
- data/features/backoffice/installation.feature +0 -33
- data/features/backoffice/login.feature +0 -33
- data/features/backoffice/mounting.feature +0 -13
- data/features/backoffice/my_account.feature +0 -22
- data/features/backoffice/pages.feature +0 -73
- data/features/backoffice/regressions.feature +0 -19
- data/features/backoffice/site.feature +0 -71
- data/features/backoffice/snippets.feature +0 -39
- data/features/backoffice/theme_assets.feature +0 -72
- data/features/backoffice/translations.feature +0 -50
- data/features/public/basic.feature +0 -30
- data/features/public/contact_form.feature +0 -98
- data/features/public/content_entries.feature +0 -69
- data/features/public/editable_elements.feature +0 -138
- data/features/public/has_many.feature +0 -8
- data/features/public/inheritance.feature +0 -157
- data/features/public/inline_front_end_editing.feature +0 -26
- data/features/public/many_to_many.feature +0 -64
- data/features/public/new_contact_form.feature +0 -95
- data/features/public/pages.feature +0 -116
- data/features/public/pagination.feature +0 -8
- data/features/public/robots.feature +0 -22
- data/features/public/session.feature +0 -40
- data/features/public/sitemap.feature +0 -74
- data/features/public/snippets.feature +0 -21
- data/features/public/tablerow.feature +0 -42
- data/features/public/tags.feature +0 -45
- data/features/step_definitions/api_steps.rb +0 -179
- data/features/step_definitions/backoffice/mounting_steps.rb +0 -22
- data/features/step_definitions/backoffice_steps.rb +0 -47
- data/features/step_definitions/content_assets_steps.rb +0 -12
- data/features/step_definitions/content_types_steps.rb +0 -135
- data/features/step_definitions/current_site_steps.rb +0 -43
- data/features/step_definitions/editable_elements_steps.rb +0 -24
- data/features/step_definitions/membership_steps.rb +0 -19
- data/features/step_definitions/more_web_steps.rb +0 -131
- data/features/step_definitions/page_steps.rb +0 -133
- data/features/step_definitions/pagination_steps.rb +0 -35
- data/features/step_definitions/pickle_steps.rb +0 -100
- data/features/step_definitions/relationships_steps.rb +0 -110
- data/features/step_definitions/site_steps.rb +0 -111
- data/features/step_definitions/snippet_steps.rb +0 -37
- data/features/step_definitions/theme_asset_steps.rb +0 -64
- data/features/step_definitions/translation_steps.rb +0 -7
- data/features/step_definitions/web_steps.rb +0 -225
- data/features/step_definitions/within_steps.rb +0 -14
- data/features/support/cleaner.rb +0 -4
- data/features/support/env.rb +0 -82
- data/features/support/factory_girl.rb +0 -2
- data/features/support/http.rb +0 -22
- data/features/support/locales.rb +0 -5
- data/features/support/paths.rb +0 -62
- data/features/support/pickle.rb +0 -24
- data/features/support/selectors.rb +0 -57
@@ -1,12 +1,21 @@
|
|
1
|
-
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
-
#
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
3
|
Devise.setup do |config|
|
4
|
+
# The secret key used by Devise. Devise uses this key to generate
|
5
|
+
# random tokens. Changing this key will render invalid all existing
|
6
|
+
# confirmation, reset password and unlock tokens in the database.
|
7
|
+
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
|
8
|
+
# by default. You can change it below and use your own secret key.
|
9
|
+
# config.secret_key = '16bd3131443ad5f07c5f164fe641a17daf1779a559bf24592bfa715c5862753eed97b512e28216e5abb50e93458f3977296e0c4a73cf152478cee6f5c2548b32'
|
10
|
+
|
4
11
|
# ==> Mailer Configuration
|
5
|
-
# Configure the e-mail address which will be shown in
|
6
|
-
|
12
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
13
|
+
# note that it will be overwritten if you use your own mailer class
|
14
|
+
# with default "from" parameter.
|
15
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
7
16
|
|
8
17
|
# Configure the class responsible to send e-mails.
|
9
|
-
# config.mailer =
|
18
|
+
# config.mailer = 'Devise::Mailer'
|
10
19
|
|
11
20
|
# ==> ORM configuration
|
12
21
|
# Load and configure the ORM. Supports :active_record (default) and
|
@@ -14,8 +23,6 @@ Devise.setup do |config|
|
|
14
23
|
# available as additional gems.
|
15
24
|
require 'devise/orm/mongoid'
|
16
25
|
|
17
|
-
config.secret_key = '8d6ff8102c31815f8395a8c806c9e47d36ba6c607bf7054b4714b4131d8a372fef78adac89930170d77b6d9ec59347315ee1193cb535746249eebf3e5ad5b9b3'
|
18
|
-
|
19
26
|
# ==> Configuration for any authentication mechanism
|
20
27
|
# Configure which keys are used when authenticating a user. The default is
|
21
28
|
# just :email. You can configure it to use [:username, :subdomain], so for
|
@@ -24,7 +31,7 @@ Devise.setup do |config|
|
|
24
31
|
# session. If you need permissions, you should implement that in a before filter.
|
25
32
|
# You can also supply a hash where the value is a boolean determining whether
|
26
33
|
# or not authentication should be aborted when the value is not present.
|
27
|
-
# config.authentication_keys = [
|
34
|
+
# config.authentication_keys = [:email]
|
28
35
|
|
29
36
|
# Configure parameters from the request object used for authentication. Each entry
|
30
37
|
# given should be a request method and it will automatically be passed to the
|
@@ -36,57 +43,111 @@ Devise.setup do |config|
|
|
36
43
|
# Configure which authentication keys should be case-insensitive.
|
37
44
|
# These keys will be downcased upon creating or modifying a user and when used
|
38
45
|
# to authenticate or find a user. Default is :email.
|
39
|
-
config.case_insensitive_keys = [
|
46
|
+
config.case_insensitive_keys = [:email]
|
47
|
+
|
48
|
+
# Configure which authentication keys should have whitespace stripped.
|
49
|
+
# These keys will have whitespace before and after removed upon creating or
|
50
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
51
|
+
config.strip_whitespace_keys = [:email]
|
40
52
|
|
41
53
|
# Tell if authentication through request.params is enabled. True by default.
|
54
|
+
# It can be set to an array that will enable params authentication only for the
|
55
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
56
|
+
# enable it only for database (email + password) authentication.
|
42
57
|
# config.params_authenticatable = true
|
43
58
|
|
44
|
-
# Tell if authentication through HTTP
|
59
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
60
|
+
# It can be set to an array that will enable http authentication only for the
|
61
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
62
|
+
# enable it only for database authentication. The supported strategies are:
|
63
|
+
# :database = Support basic authentication with authentication key + password
|
45
64
|
# config.http_authenticatable = false
|
46
65
|
|
47
|
-
# If
|
66
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
48
67
|
# config.http_authenticatable_on_xhr = true
|
49
68
|
|
50
|
-
# The realm used in Http Basic Authentication.
|
51
|
-
# config.http_authentication_realm =
|
69
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
70
|
+
# config.http_authentication_realm = 'Application'
|
71
|
+
|
72
|
+
# It will change confirmation, password recovery and other workflows
|
73
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
74
|
+
# Does not affect registerable.
|
75
|
+
# config.paranoid = true
|
76
|
+
|
77
|
+
# By default Devise will store the user in session. You can skip storage for
|
78
|
+
# particular strategies by setting this option.
|
79
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
80
|
+
# may want to disable generating routes to Devise's sessions controller by
|
81
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
82
|
+
config.skip_session_storage = [:http_auth]
|
83
|
+
|
84
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
85
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
86
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
87
|
+
# from the server. You can disable this option at your own risk.
|
88
|
+
# config.clean_up_csrf_token_on_authentication = true
|
52
89
|
|
53
90
|
# ==> Configuration for :database_authenticatable
|
54
91
|
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
55
92
|
# using other encryptors, it sets how many times you want the password re-encrypted.
|
56
|
-
|
93
|
+
#
|
94
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
95
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
96
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
97
|
+
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
98
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
99
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
57
100
|
|
58
101
|
# Setup a pepper to generate the encrypted password.
|
59
|
-
# config.pepper =
|
102
|
+
# config.pepper = '7fece71d4a1dcafb548cb7df4ca7d3c6a2156642dea872bd872e3d4aaee59791b5b4a6f56343290c741cf005552fe99ce4e111b2f1304e991d733861acfd62c7'
|
60
103
|
|
61
104
|
# ==> Configuration for :confirmable
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
# (ie 2 days).
|
105
|
+
# A period that the user is allowed to access the website even without
|
106
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
107
|
+
# able to access the website for two days without confirming their account,
|
108
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
109
|
+
# the user cannot access the website without confirming their account.
|
68
110
|
# config.allow_unconfirmed_access_for = 2.days
|
69
111
|
|
112
|
+
# A period that the user is allowed to confirm their account before their
|
113
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
114
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
115
|
+
# their account can't be confirmed with the token any more.
|
116
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
117
|
+
# before confirming their account.
|
118
|
+
# config.confirm_within = 3.days
|
119
|
+
|
120
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
121
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
122
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
123
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
124
|
+
config.reconfirmable = true
|
125
|
+
|
70
126
|
# Defines which key will be used when confirming an account
|
71
|
-
# config.confirmation_keys = [
|
127
|
+
# config.confirmation_keys = [:email]
|
72
128
|
|
73
129
|
# ==> Configuration for :rememberable
|
74
130
|
# The time the user will be remembered without asking for credentials again.
|
75
|
-
config.remember_for = 2.weeks
|
131
|
+
# config.remember_for = 2.weeks
|
132
|
+
|
133
|
+
# Invalidates all the remember me tokens when the user signs out.
|
134
|
+
config.expire_all_remember_me_on_sign_out = true
|
76
135
|
|
77
136
|
# If true, extends the user's remember period when remembered via cookie.
|
78
137
|
# config.extend_remember_period = false
|
79
138
|
|
80
139
|
# Options to be passed to the created cookie. For instance, you can set
|
81
|
-
# :
|
82
|
-
# config.
|
140
|
+
# secure: true in order to force SSL only cookies.
|
141
|
+
# config.rememberable_options = {}
|
83
142
|
|
84
143
|
# ==> Configuration for :validatable
|
85
|
-
# Range for password length.
|
86
|
-
config.password_length = 6..
|
144
|
+
# Range for password length.
|
145
|
+
config.password_length = 6..72
|
87
146
|
|
88
|
-
#
|
89
|
-
#
|
147
|
+
# Email regex used to validate email formats. It simply asserts that
|
148
|
+
# one (and only one) @ exists in the given string. This is mainly
|
149
|
+
# to give user feedback and not to assert the e-mail validity.
|
150
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
90
151
|
|
91
152
|
# ==> Configuration for :timeoutable
|
92
153
|
# The time you want to timeout the user session without activity. After this
|
@@ -100,7 +161,7 @@ Devise.setup do |config|
|
|
100
161
|
# config.lock_strategy = :failed_attempts
|
101
162
|
|
102
163
|
# Defines which key will be used when locking and unlocking an account
|
103
|
-
# config.unlock_keys = [
|
164
|
+
# config.unlock_keys = [:email]
|
104
165
|
|
105
166
|
# Defines which strategy will be used to unlock an account.
|
106
167
|
# :email = Sends an unlock link to the user email
|
@@ -116,48 +177,45 @@ Devise.setup do |config|
|
|
116
177
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
117
178
|
# config.unlock_in = 1.hour
|
118
179
|
|
180
|
+
# Warn on the last attempt before the account is locked.
|
181
|
+
# config.last_attempt_warning = true
|
182
|
+
|
119
183
|
# ==> Configuration for :recoverable
|
120
184
|
#
|
121
185
|
# Defines which key will be used when recovering the password for an account
|
122
|
-
# config.reset_password_keys = [
|
186
|
+
# config.reset_password_keys = [:email]
|
123
187
|
|
124
188
|
# Time interval you can reset your password with a reset password key.
|
125
189
|
# Don't put a too small interval or your users won't have the time to
|
126
190
|
# change their passwords.
|
127
|
-
config.reset_password_within =
|
191
|
+
config.reset_password_within = 6.hours
|
192
|
+
|
193
|
+
# When set to false, does not sign a user in automatically after their password is
|
194
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
195
|
+
# config.sign_in_after_reset_password = true
|
128
196
|
|
129
197
|
# ==> Configuration for :encryptable
|
130
198
|
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
131
199
|
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
132
200
|
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
133
201
|
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
134
|
-
# REST_AUTH_SITE_KEY to pepper)
|
135
|
-
#
|
136
|
-
|
137
|
-
#
|
138
|
-
# Defines name of the authentication token params key
|
139
|
-
# config.token_authentication_key = :auth_token
|
140
|
-
|
141
|
-
# If true, authentication through token does not store user in session and needs
|
142
|
-
# to be supplied on each request. Useful if you are using the token as API token.
|
143
|
-
# config.stateless_token = false
|
144
|
-
# Hint: Devise 2
|
145
|
-
# Devise.stateless_token was removed. If you want to have stateless tokens,
|
146
|
-
# simply do config.skip_session_storage << :auth_token in your initializer;
|
202
|
+
# REST_AUTH_SITE_KEY to pepper).
|
203
|
+
#
|
204
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
205
|
+
# config.encryptor = :sha512
|
147
206
|
|
148
207
|
# ==> Scopes configuration
|
149
208
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
150
209
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
151
210
|
# are using only default views.
|
152
|
-
config.scoped_views =
|
211
|
+
# config.scoped_views = false
|
153
212
|
|
154
213
|
# Configure the default scope given to Warden. By default it's the first
|
155
214
|
# devise role declared in your routes (usually :user).
|
156
|
-
# config.default_scope = :
|
215
|
+
# config.default_scope = :user
|
157
216
|
|
158
|
-
#
|
159
|
-
#
|
160
|
-
# The default is true, which means any logout action will sign out all active scopes.
|
217
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
218
|
+
# only the current scope. By default, Devise signs out all scopes.
|
161
219
|
# config.sign_out_all_scopes = true
|
162
220
|
|
163
221
|
# ==> Navigation configuration
|
@@ -168,25 +226,37 @@ Devise.setup do |config|
|
|
168
226
|
# If you have any extra navigational formats, like :iphone or :mobile, you
|
169
227
|
# should add them to the navigational formats lists.
|
170
228
|
#
|
171
|
-
# The
|
172
|
-
#
|
173
|
-
# config.navigational_formats = [:"*/*", "*/*", :html]
|
229
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
230
|
+
# config.navigational_formats = ['*/*', :html]
|
174
231
|
|
175
|
-
# The default HTTP method used to sign out a resource. Default is :
|
176
|
-
|
232
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
233
|
+
config.sign_out_via = :delete
|
177
234
|
|
178
235
|
# ==> OmniAuth
|
179
236
|
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
180
237
|
# up on your models and hooks.
|
181
|
-
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :
|
238
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
182
239
|
|
183
240
|
# ==> Warden configuration
|
184
241
|
# If you want to use other strategies, that are not supported by Devise, or
|
185
242
|
# change the failure app, you can configure them inside the config.warden block.
|
186
243
|
#
|
187
244
|
# config.warden do |manager|
|
188
|
-
# manager.failure_app = AnotherApp
|
189
245
|
# manager.intercept_401 = false
|
190
|
-
# manager.default_strategies(:
|
246
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
191
247
|
# end
|
248
|
+
|
249
|
+
# ==> Mountable engine configurations
|
250
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
251
|
+
# is mountable, there are some extra configurations to be taken into account.
|
252
|
+
# The following options are available, assuming the engine is mounted as:
|
253
|
+
#
|
254
|
+
# mount MyEngine, at: '/my_engine'
|
255
|
+
#
|
256
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
257
|
+
# config.router_name = :my_engine
|
258
|
+
#
|
259
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
260
|
+
# so you need to do it manually. For the users scope, it would be:
|
261
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
192
262
|
end
|
@@ -1,48 +1,116 @@
|
|
1
1
|
development:
|
2
|
-
# Configure available database
|
3
|
-
|
4
|
-
# Defines the default
|
2
|
+
# Configure available database clients. (required)
|
3
|
+
clients:
|
4
|
+
# Defines the default client. (required)
|
5
5
|
default:
|
6
6
|
# Defines the name of the default database that Mongoid can connect to.
|
7
7
|
# (required).
|
8
8
|
# database: locomotive_engine_wagon_dev
|
9
9
|
database: locomotive_engine_dev
|
10
|
-
# Provides the hosts the default
|
10
|
+
# Provides the hosts the default client can connect to. Must be an array
|
11
11
|
# of host:port pairs. (required)
|
12
12
|
hosts:
|
13
13
|
- localhost:27017
|
14
|
-
# uri: 'mongodb://localhost:27017/locomotive_engine_coal_dev'
|
15
14
|
options:
|
16
|
-
# Change
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
20
|
-
# Change the default
|
21
|
-
# :
|
22
|
-
#
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
# Change the default write concern. (default = { w: 1 })
|
16
|
+
# write:
|
17
|
+
# w: 1
|
18
|
+
|
19
|
+
# Change the default read preference. Valid options for mode are: :secondary,
|
20
|
+
# :secondary_preferred, :primary, :primary_preferred, :nearest
|
21
|
+
# (default: primary)
|
22
|
+
# read:
|
23
|
+
# mode: :secondary_preferred
|
24
|
+
|
25
|
+
# The name of the user for authentication.
|
26
|
+
# user: 'user'
|
27
|
+
|
28
|
+
# The password of the user for authentication.
|
29
|
+
# password: 'password'
|
30
|
+
|
31
|
+
# The user's database roles.
|
32
|
+
# roles:
|
33
|
+
# - 'dbOwner'
|
34
|
+
|
35
|
+
# Change the default authentication mechanism. Valid options are: :scram,
|
36
|
+
# :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
|
37
|
+
# on 2.4 and 2.6 is :plain)
|
38
|
+
# auth_mech: :scram
|
39
|
+
|
40
|
+
# The database or source to authenticate the user against. (default: admin)
|
41
|
+
# auth_source: admin
|
42
|
+
|
43
|
+
# Force a the driver cluster to behave in a certain manner instead of auto-
|
44
|
+
# discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
|
45
|
+
# when connecting to hidden members of a replica set.
|
46
|
+
# connect: :direct
|
47
|
+
|
48
|
+
# Changes the default time in seconds the server monitors refresh their status
|
49
|
+
# via ismaster commands. (default: 10)
|
50
|
+
# heartbeat_frequency: 10
|
51
|
+
|
52
|
+
# The time in seconds for selecting servers for a near read preference. (default: 5)
|
53
|
+
# local_threshold: 5
|
54
|
+
|
55
|
+
# The timeout in seconds for selecting a server for an operation. (default: 30)
|
56
|
+
# server_selection_timeout: 30
|
57
|
+
|
58
|
+
# The maximum number of connections in the connection pool. (default: 5)
|
59
|
+
# max_pool_size: 5
|
60
|
+
|
61
|
+
# The minimum number of connections in the connection pool. (default: 1)
|
62
|
+
# min_pool_size: 1
|
63
|
+
|
64
|
+
# The time to wait, in seconds, in the connection pool for a connection
|
65
|
+
# to be checked in before timing out. (default: 5)
|
66
|
+
# wait_queue_timeout: 5
|
67
|
+
|
68
|
+
# The time to wait to establish a connection before timing out, in seconds.
|
69
|
+
# (default: 5)
|
70
|
+
# connect_timeout: 5
|
71
|
+
|
72
|
+
# The timeout to wait to execute operations on a socket before raising an error.
|
73
|
+
# (default: 5)
|
74
|
+
# socket_timeout: 5
|
75
|
+
|
76
|
+
# The name of the replica set to connect to. Servers provided as seeds that do
|
77
|
+
# not belong to this replica set will be ignored.
|
78
|
+
# replica_set: name
|
79
|
+
|
80
|
+
# Whether to connect to the servers via ssl. (default: false)
|
81
|
+
# ssl: true
|
82
|
+
|
83
|
+
# The certificate file used to identify the connection against MongoDB.
|
84
|
+
# ssl_cert: /path/to/my.cert
|
29
85
|
|
30
|
-
|
31
|
-
|
86
|
+
# The private keyfile used to identify the connection against MongoDB.
|
87
|
+
# Note that even if the key is stored in the same file as the certificate,
|
88
|
+
# both need to be explicitly specified.
|
89
|
+
# ssl_key: /path/to/my.key
|
32
90
|
|
91
|
+
# A passphrase for the private key.
|
92
|
+
# ssl_key_pass_phrase: password
|
93
|
+
|
94
|
+
# Whether or not to do peer certification validation. (default: false)
|
95
|
+
# ssl_verify: true
|
96
|
+
|
97
|
+
# The file containing a set of concatenated certification authority certifications
|
98
|
+
# used to validate certs passed from the other end of the connection.
|
99
|
+
# ssl_ca_cert: /path/to/ca.cert
|
100
|
+
|
101
|
+
|
102
|
+
# Configure Mongoid specific options. (optional)
|
103
|
+
options:
|
33
104
|
# Includes the root model name in json serialization. (default: false)
|
34
105
|
# include_root_in_json: false
|
35
106
|
|
36
|
-
# Include the _type field in
|
107
|
+
# Include the _type field in serialization. (default: false)
|
37
108
|
# include_type_for_serialization: false
|
38
109
|
|
39
110
|
# Preload all models in development, needed when models use
|
40
111
|
# inheritance. (default: false)
|
41
112
|
# preload_models: false
|
42
113
|
|
43
|
-
# Protect id and type from mass assignment. (default: true)
|
44
|
-
# protect_sensitive_fields: true
|
45
|
-
|
46
114
|
# Raise an error when performing a #find and the document is not found.
|
47
115
|
# (default: true)
|
48
116
|
# raise_not_found_error: true
|
@@ -51,67 +119,16 @@ development:
|
|
51
119
|
# existing method. (default: false)
|
52
120
|
# scope_overwrite_exception: false
|
53
121
|
|
54
|
-
#
|
55
|
-
# admin access. (default: false)
|
56
|
-
# skip_version_check: false
|
57
|
-
|
58
|
-
# User Active Support's time zone in conversions. (default: true)
|
122
|
+
# Use Active Support's time zone in conversions. (default: true)
|
59
123
|
# use_activesupport_time_zone: true
|
60
124
|
|
61
125
|
# Ensure all times are UTC in the app side. (default: false)
|
62
126
|
# use_utc: false
|
63
|
-
|
64
|
-
profile:
|
65
|
-
sessions:
|
66
|
-
default:
|
67
|
-
database: locomotive_engine_profile
|
68
|
-
hosts:
|
69
|
-
- localhost:27017
|
70
|
-
options:
|
71
|
-
# consistency: :strong
|
72
|
-
# identity_map_enabled: true
|
73
|
-
|
74
127
|
test:
|
75
|
-
|
128
|
+
clients:
|
76
129
|
default:
|
77
130
|
database: locomotive_engine_test
|
78
131
|
hosts:
|
79
132
|
- localhost:27017
|
80
133
|
options:
|
81
|
-
|
82
|
-
# identity_map_enabled: true
|
83
|
-
|
84
|
-
production:
|
85
|
-
sessions:
|
86
|
-
default:
|
87
|
-
database: locomotive_engine_prod
|
88
|
-
hosts:
|
89
|
-
- localhost:27017
|
90
|
-
options:
|
91
|
-
# consistency: :strong
|
92
|
-
# identity_map_enabled: true
|
93
|
-
|
94
|
-
|
95
|
-
# defaults: &defaults
|
96
|
-
# host: localhost
|
97
|
-
# port: 27017
|
98
|
-
# # slaves:
|
99
|
-
# # - host: slave1.local
|
100
|
-
# # port: 27018
|
101
|
-
# # - host: slave2.local
|
102
|
-
# # port: 27019
|
103
|
-
|
104
|
-
# development:
|
105
|
-
# <<: *defaults
|
106
|
-
# database: locomotive_engine_dev
|
107
|
-
# identity_map_enabled: true
|
108
|
-
|
109
|
-
# test:
|
110
|
-
# <<: *defaults
|
111
|
-
# database: locomotive_engine_test
|
112
|
-
# identity_map_enabled: true
|
113
|
-
|
114
|
-
# production:
|
115
|
-
# <<: *defaults
|
116
|
-
# identity_map_enabled: true
|
117
|
-
# database: locomotive_engine_production
|
134
|
+
max_pool_size: 1
|
@@ -163,13 +163,13 @@ describe Locomotive::ContentEntry do
|
|
163
163
|
context 'set of entries' do
|
164
164
|
|
165
165
|
before(:each) do
|
166
|
-
@content_type.save
|
166
|
+
@content_type.save!
|
167
167
|
3.times { build_content_entry(file: FixturedAsset.open('5k.png')).save! }
|
168
168
|
end
|
169
169
|
|
170
170
|
subject { @content_type.ordered_entries.to_csv(host: 'example.com').split("\n") }
|
171
171
|
|
172
|
-
it { expect(subject.size).to eq(4) }
|
172
|
+
it { puts @content_type.ordered_entries.first.content_type.inspect; expect(subject.size).to eq(4) }
|
173
173
|
it { expect(subject.first).to eq("Title,Description,Visible ?,File,Published at,Created at") }
|
174
174
|
it { expect(subject.last).to match(/^Locomotive,Lorem ipsum....,false,http:\/\/example.com\/sites\/[0-9a-f]+\/content_entry[0-9a-f]+\/[0-9a-f]+\/files\/5k.png,\"\",\"July 05, 2013 00:00\"$/) }
|
175
175
|
|
@@ -388,12 +388,12 @@ describe Locomotive::ContentEntry do
|
|
388
388
|
|
389
389
|
end
|
390
390
|
|
391
|
-
it_should_behave_like 'model scoped by a site' do
|
391
|
+
# it_should_behave_like 'model scoped by a site' do
|
392
392
|
|
393
|
-
|
394
|
-
|
393
|
+
# let(:model) { build_content_entry }
|
394
|
+
# let(:attribute) { :content_version }
|
395
395
|
|
396
|
-
end
|
396
|
+
# end
|
397
397
|
|
398
398
|
def localize_content_type(content_type)
|
399
399
|
content_type.entries_custom_fields.first.localized = true
|
data/spec/requests/site_spec.rb
CHANGED
@@ -11,8 +11,33 @@ describe Locomotive::Middlewares::Site do
|
|
11
11
|
|
12
12
|
describe 'no site' do
|
13
13
|
|
14
|
+
let(:app) { ->(env) { raise ::Locomotive::Steam::NoSiteException.new } }
|
15
|
+
|
14
16
|
it { is_expected.to eq(nil) }
|
15
17
|
|
18
|
+
describe 'not the default host' do
|
19
|
+
|
20
|
+
before { allow(Locomotive::Account).to receive(:count).and_return(1) }
|
21
|
+
|
22
|
+
let(:warden) { instance_double('WargenStrategy', authenticate: nil) }
|
23
|
+
let(:rack_env) { env_for(url).tap { |e| e['warden'] = warden } }
|
24
|
+
|
25
|
+
subject { middleware.call(rack_env) }
|
26
|
+
|
27
|
+
it { expect(subject.first).to eq 404 }
|
28
|
+
it { expect(subject.last.body).to match(/Sign In/) }
|
29
|
+
|
30
|
+
context 'default host' do
|
31
|
+
|
32
|
+
before { allow(Locomotive.config).to receive(:host).and_return('example.com') }
|
33
|
+
|
34
|
+
it { expect(subject.first).to eq 301 }
|
35
|
+
it { expect(subject[1]['Location']).to eq '/locomotive/sign_in' }
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
16
41
|
end
|
17
42
|
|
18
43
|
describe 'no account' do
|