locomotivecms_steam 1.2.1 → 1.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +3 -2
- data/Gemfile.lock +57 -50
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/config/locales/nl.yml +2 -2
- data/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_entry.rb +8 -0
- data/lib/locomotive/steam/adapters/memory/condition.rb +1 -1
- data/lib/locomotive/steam/configuration.rb +1 -1
- data/lib/locomotive/steam/decorators/template_decorator.rb +1 -1
- data/lib/locomotive/steam/entities/content_entry.rb +17 -0
- data/lib/locomotive/steam/entities/content_type.rb +1 -0
- data/lib/locomotive/steam/entities/content_type_field.rb +1 -0
- data/lib/locomotive/steam/entities/editable_element.rb +4 -0
- data/lib/locomotive/steam/errors.rb +35 -5
- data/lib/locomotive/steam/initializers/sprockets.rb +6 -80
- data/lib/locomotive/steam/liquid/drops/page.rb +9 -2
- data/lib/locomotive/steam/liquid/filters/date.rb +109 -0
- data/lib/locomotive/steam/liquid/tags/action.rb +6 -1
- data/lib/locomotive/steam/liquid/tags/authorize.rb +65 -0
- data/lib/locomotive/steam/liquid/tags/snippet.rb +10 -2
- data/lib/locomotive/steam/liquid/template.rb +3 -1
- data/lib/locomotive/steam/middlewares/auth.rb +187 -0
- data/lib/locomotive/steam/middlewares/redirection.rb +24 -0
- data/lib/locomotive/steam/middlewares/renderer.rb +20 -3
- data/lib/locomotive/steam/middlewares/sitemap.rb +3 -1
- data/lib/locomotive/steam/middlewares/templatized_page.rb +1 -6
- data/lib/locomotive/steam/middlewares/thread_safe.rb +19 -0
- data/lib/locomotive/steam/middlewares/url_redirection.rb +14 -1
- data/lib/locomotive/steam/repositories.rb +5 -1
- data/lib/locomotive/steam/repositories/content_entry_repository.rb +1 -1
- data/lib/locomotive/steam/repositories/content_type_field_repository.rb +4 -0
- data/lib/locomotive/steam/server.rb +2 -0
- data/lib/locomotive/steam/services.rb +9 -1
- data/lib/locomotive/steam/services/action_service.rb +26 -7
- data/lib/locomotive/steam/services/asset_host_service.rb +6 -1
- data/lib/locomotive/steam/services/auth_service.rb +105 -0
- data/lib/locomotive/steam/services/content_entry_service.rb +14 -0
- data/lib/locomotive/steam/services/external_api_service.rb +59 -25
- data/lib/locomotive/steam/services/liquid_parser_service.rb +5 -1
- data/lib/locomotive/steam/services/page_redirection_service.rb +29 -0
- data/lib/locomotive/steam/version.rb +1 -1
- data/locomotivecms_steam.gemspec +18 -16
- data/spec/fixtures/default/app/content_types/accounts.yml +59 -0
- data/spec/fixtures/default/app/content_types/songs.yml +2 -1
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.fr.liquid.haml +5 -1
- data/spec/fixtures/default/app/views/pages/about_us/john_doe.liquid.haml +1 -1
- data/spec/fixtures/default/app/views/pages/account/forgot_password.liquid +39 -0
- data/spec/fixtures/default/app/views/pages/account/me.liquid +15 -0
- data/spec/fixtures/default/app/views/pages/account/reset_password.liquid +42 -0
- data/spec/fixtures/default/app/views/pages/account/sign_in.liquid +49 -0
- data/spec/fixtures/default/app/views/pages/all.liquid.haml +1 -1
- data/spec/fixtures/default/app/views/pages/emails/reset_password.liquid +15 -0
- data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +1 -1
- data/spec/fixtures/default/config/metafields_schema.yml +10 -0
- data/spec/fixtures/default/config/site.yml +5 -0
- data/spec/fixtures/default/config/translations.yml +25 -1
- data/spec/fixtures/default/data/accounts.yml +15 -0
- data/spec/fixtures/mongodb/locomotive_accounts.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_accounts.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_activities.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_activities.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_content_assets.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_content_assets.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_content_entries.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_content_entries.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_content_types.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_content_types.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_pages.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_pages.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_sites.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_sites.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_snippets.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_snippets.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_theme_assets.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_theme_assets.metadata.json +1 -1
- data/spec/fixtures/mongodb/locomotive_translations.bson +0 -0
- data/spec/fixtures/mongodb/locomotive_translations.metadata.json +1 -1
- data/spec/integration/repositories/content_entry_repository_spec.rb +1 -1
- data/spec/integration/repositories/content_type_repository_spec.rb +1 -1
- data/spec/integration/repositories/page_repository_spec.rb +3 -3
- data/spec/integration/repositories/theme_asset_repository_spec.rb +1 -1
- data/spec/integration/repositories/translation_repository_spec.rb +1 -1
- data/spec/integration/server/auth_spec.rb +196 -0
- data/spec/integration/server/basic_spec.rb +18 -0
- data/spec/integration/server/nav_spec.rb +1 -1
- data/spec/integration/server/sitemap_spec.rb +1 -1
- data/spec/integration/services/content_entry_service_spec.rb +1 -1
- data/spec/integration/services/external_api_service_spec.rb +9 -0
- data/spec/support/helpers.rb +1 -1
- data/spec/unit/adapters/filesystem/yaml_loaders/content_entry_spec.rb +17 -5
- data/spec/unit/adapters/filesystem/yaml_loaders/content_type_spec.rb +4 -4
- data/spec/unit/adapters/filesystem/yaml_loaders/page_spec.rb +7 -7
- data/spec/unit/adapters/filesystem/yaml_loaders/site_spec.rb +1 -1
- data/spec/unit/adapters/filesystem/yaml_loaders/translation_spec.rb +1 -1
- data/spec/unit/entities/content_entry_spec.rb +10 -0
- data/spec/unit/errors_spec.rb +2 -2
- data/spec/unit/initializers/sprockets_spec.rb +0 -14
- data/spec/unit/liquid/drops/page_spec.rb +3 -2
- data/spec/unit/liquid/filters/date_spec.rb +219 -0
- data/spec/unit/liquid/tags/action_spec.rb +9 -0
- data/spec/unit/liquid/tags/authorize_spec.rb +51 -0
- data/spec/unit/liquid/tags/link_to_spec.rb +1 -1
- data/spec/unit/liquid/tags/paginate_spec.rb +1 -1
- data/spec/unit/liquid/tags/snippet_spec.rb +10 -0
- data/spec/unit/middlewares/auth_spec.rb +31 -0
- data/spec/unit/middlewares/redirection_spec.rb +37 -0
- data/spec/unit/middlewares/url_redirection_spec.rb +20 -1
- data/spec/unit/services/action_service_spec.rb +57 -1
- data/spec/unit/services/asset_host_service_spec.rb +15 -0
- data/spec/unit/services/auth_service_spec.rb +156 -0
- data/spec/unit/services/external_api_service_spec.rb +22 -0
- data/spec/unit/services/page_redirection_service_spec.rb +49 -0
- metadata +96 -40
- data/CHANGELOG.md +0 -29
- data/spec/fixtures/mongodb/system.indexes.bson +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f196a0b63817aacbd1564c4f1e48f11f3d9a099
|
4
|
+
data.tar.gz: f2abdbd4a45e167bec4ec66ed0e4fe8ecb51f41a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e71b96955c2395129bfb9c42b83a581592a7c55ec814b682b3f3919a2b55d63c87a42fe5fc671600ff4674202c19d6c2e462d9581fd2341f820fbe2d3027c8
|
7
|
+
data.tar.gz: efc45f6d8acb3117e4b9154830b1b43fbeb299358c60e57d606692b0eb3a86fe0ea4ac05d095f080331bcb0ea6358a9d8f23cbed96311bac21239f4de40a4c39
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -8,9 +8,10 @@ group :development do
|
|
8
8
|
# gem 'locomotivecms_models', '~> 0.0.1', path: '../models'
|
9
9
|
# gem 'locomotivecms_models', '0.0.1.pre.alpha'
|
10
10
|
# gem 'locomotivecms-liquid', path: '/Users/didier/Documents/LocomotiveCMS/gems/liquid'
|
11
|
+
# gem 'duktape', path: '/Users/didier/Documents/NoCoffee/ProjectsX/duktape.rb'
|
12
|
+
# gem 'duktape', github: 'judofyr/duktape.rb', ref: '20ef6a5'
|
11
13
|
# gem 'thin'
|
12
14
|
gem 'puma'
|
13
|
-
gem 'yui-compressor', '~> 0.12.0'
|
14
15
|
gem 'haml', '~> 4.0.6'
|
15
16
|
|
16
17
|
gem 'rack-mini-profiler', '~> 0.10.1'
|
@@ -35,5 +36,5 @@ group :test do
|
|
35
36
|
end
|
36
37
|
|
37
38
|
platform :ruby do
|
38
|
-
ruby '2.
|
39
|
+
ruby '2.3.3'
|
39
40
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
locomotivecms_steam (1.
|
4
|
+
locomotivecms_steam (1.3.0.rc1)
|
5
5
|
RedCloth (~> 4.3.2)
|
6
|
-
autoprefixer-rails (~> 6.
|
6
|
+
autoprefixer-rails (~> 6.7.2)
|
7
|
+
bcrypt (~> 3.1.11)
|
7
8
|
chronic (~> 0.10.2)
|
8
9
|
coffee-script (~> 2.4.1)
|
9
10
|
compass (~> 1.0.3)
|
10
|
-
dragonfly (~> 1.
|
11
|
-
duktape (~> 1.
|
12
|
-
httparty (~> 0.
|
13
|
-
kramdown (~> 1.
|
11
|
+
dragonfly (~> 1.1.1)
|
12
|
+
duktape (~> 1.6.1.0)
|
13
|
+
httparty (~> 0.14.0)
|
14
|
+
kramdown (~> 1.13.2)
|
14
15
|
locomotivecms-solid (~> 4.0.1)
|
15
16
|
locomotivecms_common (~> 0.2.0)
|
16
|
-
mime-types (~>
|
17
|
+
mime-types (~> 3.1.0)
|
17
18
|
mimetype-fu (~> 0.1.2)
|
18
|
-
moneta (~> 0.
|
19
|
+
moneta (~> 1.0.0)
|
19
20
|
morphine (~> 0.1.1)
|
20
|
-
nokogiri (~> 1.
|
21
|
+
nokogiri (~> 1.7.0.1)
|
21
22
|
pony (~> 1.11)
|
22
|
-
rack-cache (~> 1.
|
23
|
+
rack-cache (~> 1.7.0)
|
23
24
|
rack-rewrite (~> 1.5.1)
|
24
|
-
rack_csrf (~> 2.
|
25
|
-
sanitize (~> 4.0
|
26
|
-
sass (~> 3.4.
|
27
|
-
sprockets (~> 3.
|
25
|
+
rack_csrf (~> 2.6.0)
|
26
|
+
sanitize (~> 4.4.0)
|
27
|
+
sass (~> 3.4.23)
|
28
|
+
sprockets (~> 3.7.1)
|
29
|
+
uglifier (~> 3.1.6)
|
28
30
|
|
29
31
|
GEM
|
30
32
|
remote: https://rubygems.org/
|
@@ -38,9 +40,10 @@ GEM
|
|
38
40
|
addressable (2.5.0)
|
39
41
|
public_suffix (~> 2.0, >= 2.0.2)
|
40
42
|
attr_extras (4.4.0)
|
41
|
-
autoprefixer-rails (6.
|
43
|
+
autoprefixer-rails (6.7.6)
|
42
44
|
execjs
|
43
|
-
|
45
|
+
bcrypt (3.1.11)
|
46
|
+
bson (4.2.1)
|
44
47
|
byebug (8.2.5)
|
45
48
|
chronic (0.10.2)
|
46
49
|
chunky_png (1.3.8)
|
@@ -65,38 +68,37 @@ GEM
|
|
65
68
|
compass-import-once (1.0.5)
|
66
69
|
sass (>= 3.2, < 3.5)
|
67
70
|
concurrent-ruby (1.0.5)
|
68
|
-
coveralls (0.8.
|
71
|
+
coveralls (0.8.19)
|
69
72
|
json (>= 1.8, < 3)
|
70
73
|
simplecov (~> 0.12.0)
|
71
74
|
term-ansicolor (~> 1.3)
|
72
75
|
thor (~> 0.19.1)
|
73
|
-
tins (
|
76
|
+
tins (~> 1.6)
|
74
77
|
crass (1.0.2)
|
75
|
-
diff-lcs (1.
|
78
|
+
diff-lcs (1.3)
|
76
79
|
docile (1.1.5)
|
77
|
-
dragonfly (1.
|
80
|
+
dragonfly (1.1.1)
|
78
81
|
addressable (~> 2.3)
|
79
82
|
multi_json (~> 1.0)
|
80
|
-
rack (>= 1.3
|
81
|
-
duktape (1.
|
83
|
+
rack (>= 1.3)
|
84
|
+
duktape (1.6.1.0)
|
82
85
|
execjs (2.7.0)
|
83
86
|
ffi (1.9.18)
|
84
87
|
flamegraph (0.9.5)
|
85
88
|
haml (4.0.7)
|
86
89
|
tilt
|
87
|
-
httparty (0.
|
88
|
-
json (~> 1.8)
|
90
|
+
httparty (0.14.0)
|
89
91
|
multi_xml (>= 0.5.2)
|
90
|
-
i18n (0.
|
92
|
+
i18n (0.8.0)
|
91
93
|
i18n-spec (0.6.0)
|
92
94
|
iso
|
93
95
|
iso (0.2.2)
|
94
96
|
i18n
|
95
|
-
json (1.8.
|
97
|
+
json (1.8.6)
|
96
98
|
json_spec (1.1.4)
|
97
99
|
multi_json (~> 1.0)
|
98
100
|
rspec (>= 2.0, < 4.0)
|
99
|
-
kramdown (1.
|
101
|
+
kramdown (1.13.2)
|
100
102
|
locomotivecms-liquid (4.0.0)
|
101
103
|
locomotivecms-solid (4.0.1)
|
102
104
|
locomotivecms-liquid (~> 4.0.0)
|
@@ -107,23 +109,25 @@ GEM
|
|
107
109
|
stringex (~> 2.6.0)
|
108
110
|
mail (2.6.4)
|
109
111
|
mime-types (>= 1.16, < 4)
|
110
|
-
memory_profiler (0.9.
|
112
|
+
memory_profiler (0.9.7)
|
111
113
|
method_source (0.8.2)
|
112
|
-
mime-types (
|
114
|
+
mime-types (3.1)
|
115
|
+
mime-types-data (~> 3.2015)
|
116
|
+
mime-types-data (3.2016.0521)
|
113
117
|
mimetype-fu (0.1.2)
|
114
118
|
mini_portile2 (2.1.0)
|
115
119
|
minitest (5.10.1)
|
116
|
-
moneta (0.
|
117
|
-
mongo (2.
|
118
|
-
bson (
|
120
|
+
moneta (1.0.0)
|
121
|
+
mongo (2.4.1)
|
122
|
+
bson (>= 4.2.1, < 5.0.0)
|
119
123
|
morphine (0.1.1)
|
120
124
|
multi_json (1.12.1)
|
121
125
|
multi_xml (0.6.0)
|
122
|
-
nokogiri (1.
|
126
|
+
nokogiri (1.7.0.1)
|
123
127
|
mini_portile2 (~> 2.1.0)
|
124
128
|
nokogumbo (1.4.10)
|
125
129
|
nokogiri
|
126
|
-
origin (2.
|
130
|
+
origin (2.3.0)
|
127
131
|
pony (1.11)
|
128
132
|
mail (>= 2.0)
|
129
133
|
pry (0.10.4)
|
@@ -134,16 +138,16 @@ GEM
|
|
134
138
|
byebug (~> 8.0)
|
135
139
|
pry (~> 0.10)
|
136
140
|
public_suffix (2.0.5)
|
137
|
-
puma (3.
|
141
|
+
puma (3.7.0)
|
138
142
|
rack (2.0.1)
|
139
|
-
rack-cache (1.
|
143
|
+
rack-cache (1.7.0)
|
140
144
|
rack (>= 0.4)
|
141
|
-
rack-mini-profiler (0.10.
|
145
|
+
rack-mini-profiler (0.10.2)
|
142
146
|
rack (>= 1.2.0)
|
143
147
|
rack-rewrite (1.5.1)
|
144
148
|
rack-test (0.6.3)
|
145
149
|
rack (>= 1.0)
|
146
|
-
rack_csrf (2.
|
150
|
+
rack_csrf (2.6.0)
|
147
151
|
rack (>= 1.1.0)
|
148
152
|
rake (10.4.2)
|
149
153
|
rb-fsevent (0.9.8)
|
@@ -162,7 +166,7 @@ GEM
|
|
162
166
|
diff-lcs (>= 1.2.0, < 2.0)
|
163
167
|
rspec-support (~> 3.4.0)
|
164
168
|
rspec-support (3.4.1)
|
165
|
-
sanitize (4.0
|
169
|
+
sanitize (4.4.0)
|
166
170
|
crass (~> 1.0.2)
|
167
171
|
nokogiri (>= 1.4.4)
|
168
172
|
nokogumbo (~> 1.4.1)
|
@@ -173,21 +177,22 @@ GEM
|
|
173
177
|
simplecov-html (~> 0.10.0)
|
174
178
|
simplecov-html (0.10.0)
|
175
179
|
slop (3.6.0)
|
176
|
-
sprockets (3.
|
180
|
+
sprockets (3.7.1)
|
177
181
|
concurrent-ruby (~> 1.0)
|
178
182
|
rack (> 1, < 3)
|
179
|
-
stackprof (0.2.
|
183
|
+
stackprof (0.2.10)
|
180
184
|
stringex (2.6.1)
|
181
|
-
term-ansicolor (1.
|
185
|
+
term-ansicolor (1.4.0)
|
182
186
|
tins (~> 1.0)
|
183
|
-
thor (0.19.
|
187
|
+
thor (0.19.4)
|
184
188
|
thread_safe (0.3.6)
|
185
|
-
tilt (2.0.
|
189
|
+
tilt (2.0.6)
|
186
190
|
timecop (0.8.1)
|
187
|
-
tins (1.
|
191
|
+
tins (1.13.2)
|
188
192
|
tzinfo (1.2.2)
|
189
193
|
thread_safe (~> 0.1)
|
190
|
-
|
194
|
+
uglifier (3.1.6)
|
195
|
+
execjs (>= 0.3.0, < 3)
|
191
196
|
|
192
197
|
PLATFORMS
|
193
198
|
ruby
|
@@ -202,8 +207,8 @@ DEPENDENCIES
|
|
202
207
|
json_spec (~> 1.1.4)
|
203
208
|
locomotivecms_steam!
|
204
209
|
memory_profiler
|
205
|
-
mongo (~> 2.
|
206
|
-
origin (~> 2.
|
210
|
+
mongo (~> 2.4.1)
|
211
|
+
origin (~> 2.3.0)
|
207
212
|
pry-byebug (~> 3.3.0)
|
208
213
|
puma
|
209
214
|
rack-mini-profiler (~> 0.10.1)
|
@@ -212,7 +217,9 @@ DEPENDENCIES
|
|
212
217
|
rspec (~> 3.4.0)
|
213
218
|
stackprof
|
214
219
|
timecop (~> 0.8.0)
|
215
|
-
|
220
|
+
|
221
|
+
RUBY VERSION
|
222
|
+
ruby 2.3.3p222
|
216
223
|
|
217
224
|
BUNDLED WITH
|
218
|
-
1.
|
225
|
+
1.14.6
|
data/LICENSE
CHANGED
data/README.md
CHANGED
data/config/locales/nl.yml
CHANGED
@@ -13,7 +13,7 @@ nl:
|
|
13
13
|
|
14
14
|
errors:
|
15
15
|
messages:
|
16
|
-
blank: "
|
16
|
+
blank: "mag niet leeg zijn"
|
17
17
|
|
18
18
|
number:
|
19
19
|
format:
|
@@ -157,4 +157,4 @@ nl:
|
|
157
157
|
|
158
158
|
pagination:
|
159
159
|
previous: "« Vorige"
|
160
|
-
next: "Volgende »"
|
160
|
+
next: "Volgende »"
|
@@ -23,6 +23,7 @@ module Locomotive
|
|
23
23
|
modify_for_selects(_attributes)
|
24
24
|
modify_for_associations(_attributes)
|
25
25
|
modify_for_files(_attributes)
|
26
|
+
modify_for_passwords(_attributes)
|
26
27
|
|
27
28
|
list << _attributes
|
28
29
|
end
|
@@ -56,6 +57,13 @@ module Locomotive
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
60
|
+
def modify_for_passwords(attributes)
|
61
|
+
content_type.password_fields.each do |field|
|
62
|
+
uncrypted_password = attributes.delete(field.name.to_sym)
|
63
|
+
attributes[:"#{field.name}_hash"] = BCrypt::Password.create(uncrypted_password)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
59
67
|
def file_size(path)
|
60
68
|
return nil if path.blank?
|
61
69
|
|
@@ -65,7 +65,7 @@ module Locomotive
|
|
65
65
|
attr_accessor :asset_path
|
66
66
|
|
67
67
|
# If java is installed and if this option is enabled,
|
68
|
-
# then
|
68
|
+
# then Uglifier and Sass are used to minify the javascript and the css.
|
69
69
|
#
|
70
70
|
# default: false
|
71
71
|
#
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'chronic'
|
2
|
+
require 'bcrypt'
|
2
3
|
|
3
4
|
module Locomotive::Steam
|
4
5
|
|
@@ -131,6 +132,22 @@ module Locomotive::Steam
|
|
131
132
|
_cast_convertor(field.name, &:to_f)
|
132
133
|
end
|
133
134
|
|
135
|
+
def _cast_json(field)
|
136
|
+
_cast_convertor(field.name) do |value|
|
137
|
+
if value.respond_to?(:to_h)
|
138
|
+
value
|
139
|
+
else
|
140
|
+
value.blank? ? nil : JSON.parse(value)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def _cast_password(field)
|
146
|
+
_cast_convertor(:"#{field.name}_hash") do |value|
|
147
|
+
value.blank? ? nil : BCrypt::Password.new(value)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
134
151
|
def _cast_file(field)
|
135
152
|
_cast_convertor(field.name) do |value, locale|
|
136
153
|
if value.respond_to?(:url)
|
@@ -8,6 +8,7 @@ module Locomotive::Steam
|
|
8
8
|
def_delegator :fields, :associations, :association_fields
|
9
9
|
def_delegator :fields, :selects, :select_fields
|
10
10
|
def_delegator :fields, :files, :file_fields
|
11
|
+
def_delegator :fields, :passwords, :password_fields
|
11
12
|
def_delegator :fields, :default, :fields_with_default
|
12
13
|
|
13
14
|
def initialize(attributes = {})
|
@@ -3,14 +3,22 @@ module Locomotive::Steam
|
|
3
3
|
class NoSiteException < ::Exception
|
4
4
|
end
|
5
5
|
|
6
|
-
class
|
6
|
+
class RedirectionException < ::Exception
|
7
|
+
|
8
|
+
attr_reader :url
|
9
|
+
|
10
|
+
def initialize(url)
|
11
|
+
@url = url
|
12
|
+
super("Redirect to #{url}")
|
13
|
+
end
|
14
|
+
|
7
15
|
end
|
8
16
|
|
9
|
-
class
|
17
|
+
class ParsingRenderingError < ::StandardError
|
10
18
|
|
11
19
|
LINES_RANGE = 10
|
12
20
|
|
13
|
-
|
21
|
+
attr_accessor :file, :line, :source, :original_backtrace
|
14
22
|
|
15
23
|
def initialize(message, file, source, line, original_backtrace)
|
16
24
|
@file, @source, @line, @original_backtrace = file, source, line, original_backtrace
|
@@ -23,10 +31,10 @@ module Locomotive::Steam
|
|
23
31
|
lines = source.split("\n")
|
24
32
|
|
25
33
|
start = line - (LINES_RANGE / 2)
|
26
|
-
start =
|
34
|
+
start = 1 if start <= 0
|
27
35
|
finish = line + (LINES_RANGE / 2)
|
28
36
|
|
29
|
-
(start..finish).map { |i| [i, lines[i]] }
|
37
|
+
(start..finish).map { |i| [i, lines[i - 1]] }
|
30
38
|
end
|
31
39
|
|
32
40
|
def backtrace
|
@@ -35,4 +43,26 @@ module Locomotive::Steam
|
|
35
43
|
|
36
44
|
end
|
37
45
|
|
46
|
+
class RenderError < ParsingRenderingError
|
47
|
+
|
48
|
+
def initialize(error, file, source)
|
49
|
+
message = error.message
|
50
|
+
line = error.respond_to?(:line_number) ? error.line_number : error.line
|
51
|
+
backtrace = error.backtrace
|
52
|
+
|
53
|
+
super(message, file, source, line, backtrace)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
class ActionError < ParsingRenderingError
|
59
|
+
|
60
|
+
attr_accessor :action
|
61
|
+
|
62
|
+
def initialize(error, script)
|
63
|
+
super(error.message, nil, script, 0, error.backtrace)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
38
68
|
end
|