locomotivecms_steam 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -2
- data/Gemfile +4 -2
- data/Gemfile.lock +58 -120
- data/Rakefile +2 -2
- data/lib/locomotive/steam/adapters/mongodb/command.rb +1 -1
- data/lib/locomotive/steam/initializers.rb +0 -1
- data/lib/locomotive/steam/liquid/tags/concerns/attributes.rb +11 -98
- data/lib/locomotive/steam/liquid/tags/concerns/path.rb +6 -25
- data/lib/locomotive/steam/liquid/tags/consume.rb +3 -3
- data/lib/locomotive/steam/liquid/tags/inherited_block.rb +4 -3
- data/lib/locomotive/steam/liquid/tags/with_scope.rb +25 -17
- data/lib/locomotive/steam/middlewares/sitemap.rb +2 -2
- data/lib/locomotive/steam/models/concerns/validation.rb +1 -1
- data/lib/locomotive/steam/server.rb +1 -5
- data/lib/locomotive/steam/version.rb +1 -1
- data/locomotivecms_steam.gemspec +8 -17
- data/spec/fixtures/default/public/javascripts/application.js +1 -0
- data/spec/integration/adapters/mongodb_spec.rb +1 -1
- data/spec/integration/server/assets_spec.rb +3 -13
- data/spec/support/helpers.rb +1 -1
- data/spec/unit/liquid/tags/paginate_spec.rb +1 -1
- data/spec/unit/liquid/tags/with_scope_spec.rb +1 -51
- data/spec/unit/middlewares/auth_spec.rb +1 -0
- data/spec/unit/middlewares/cache_spec.rb +4 -4
- data/spec/unit/middlewares/sitemap_spec.rb +2 -2
- metadata +24 -148
- data/lib/locomotive/steam/initializers/sprockets.rb +0 -69
- data/lib/locomotive/steam/middlewares/dynamic_assets.rb +0 -33
- data/spec/fixtures/default/public/javascripts/application.js.coffee +0 -2
- data/spec/unit/initializers/sprockets_spec.rb +0 -47
- data/spec/unit/middlewares/dynamic_assets_spec.rb +0 -34
metadata
CHANGED
@@ -1,46 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotivecms_steam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
8
8
|
- Rodrigo Alvarez
|
9
9
|
- Arnaud Sellenet
|
10
10
|
- Joel Azemar
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
name: rake
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - "~>"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 13.0.1
|
23
|
-
type: :development
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 13.0.1
|
30
16
|
- !ruby/object:Gem::Dependency
|
31
17
|
name: mongo
|
32
18
|
requirement: !ruby/object:Gem::Requirement
|
33
19
|
requirements:
|
34
20
|
- - "~>"
|
35
21
|
- !ruby/object:Gem::Version
|
36
|
-
version: 2.
|
22
|
+
version: 2.18.2
|
37
23
|
type: :development
|
38
24
|
prerelease: false
|
39
25
|
version_requirements: !ruby/object:Gem::Requirement
|
40
26
|
requirements:
|
41
27
|
- - "~>"
|
42
28
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
29
|
+
version: 2.18.2
|
44
30
|
- !ruby/object:Gem::Dependency
|
45
31
|
name: origin
|
46
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,36 +45,30 @@ dependencies:
|
|
59
45
|
name: nokogiri
|
60
46
|
requirement: !ruby/object:Gem::Requirement
|
61
47
|
requirements:
|
62
|
-
- - "
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '1.11'
|
65
|
-
- - "<"
|
48
|
+
- - "~>"
|
66
49
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
50
|
+
version: 1.14.2
|
68
51
|
type: :runtime
|
69
52
|
prerelease: false
|
70
53
|
version_requirements: !ruby/object:Gem::Requirement
|
71
54
|
requirements:
|
72
|
-
- - "
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '1.11'
|
75
|
-
- - "<"
|
55
|
+
- - "~>"
|
76
56
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
57
|
+
version: 1.14.2
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: sanitize
|
80
60
|
requirement: !ruby/object:Gem::Requirement
|
81
61
|
requirements:
|
82
62
|
- - "~>"
|
83
63
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
64
|
+
version: 6.0.1
|
85
65
|
type: :runtime
|
86
66
|
prerelease: false
|
87
67
|
version_requirements: !ruby/object:Gem::Requirement
|
88
68
|
requirements:
|
89
69
|
- - "~>"
|
90
70
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
71
|
+
version: 6.0.1
|
92
72
|
- !ruby/object:Gem::Dependency
|
93
73
|
name: morphine
|
94
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,14 +145,14 @@ dependencies:
|
|
165
145
|
requirements:
|
166
146
|
- - "~>"
|
167
147
|
- !ruby/object:Gem::Version
|
168
|
-
version: 4.0.
|
148
|
+
version: 4.0.4
|
169
149
|
type: :runtime
|
170
150
|
prerelease: false
|
171
151
|
version_requirements: !ruby/object:Gem::Requirement
|
172
152
|
requirements:
|
173
153
|
- - "~>"
|
174
154
|
- !ruby/object:Gem::Version
|
175
|
-
version: 4.0.
|
155
|
+
version: 4.0.4
|
176
156
|
- !ruby/object:Gem::Dependency
|
177
157
|
name: rack-rewrite
|
178
158
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,89 +230,19 @@ dependencies:
|
|
250
230
|
- !ruby/object:Gem::Version
|
251
231
|
version: 1.0.0
|
252
232
|
- !ruby/object:Gem::Dependency
|
253
|
-
name:
|
254
|
-
requirement: !ruby/object:Gem::Requirement
|
255
|
-
requirements:
|
256
|
-
- - "~>"
|
257
|
-
- !ruby/object:Gem::Version
|
258
|
-
version: 3.7.1
|
259
|
-
type: :runtime
|
260
|
-
prerelease: false
|
261
|
-
version_requirements: !ruby/object:Gem::Requirement
|
262
|
-
requirements:
|
263
|
-
- - "~>"
|
264
|
-
- !ruby/object:Gem::Version
|
265
|
-
version: 3.7.1
|
266
|
-
- !ruby/object:Gem::Dependency
|
267
|
-
name: sass
|
268
|
-
requirement: !ruby/object:Gem::Requirement
|
269
|
-
requirements:
|
270
|
-
- - "~>"
|
271
|
-
- !ruby/object:Gem::Version
|
272
|
-
version: 3.4.25
|
273
|
-
type: :runtime
|
274
|
-
prerelease: false
|
275
|
-
version_requirements: !ruby/object:Gem::Requirement
|
276
|
-
requirements:
|
277
|
-
- - "~>"
|
278
|
-
- !ruby/object:Gem::Version
|
279
|
-
version: 3.4.25
|
280
|
-
- !ruby/object:Gem::Dependency
|
281
|
-
name: uglifier
|
282
|
-
requirement: !ruby/object:Gem::Requirement
|
283
|
-
requirements:
|
284
|
-
- - "~>"
|
285
|
-
- !ruby/object:Gem::Version
|
286
|
-
version: 4.1.3
|
287
|
-
type: :runtime
|
288
|
-
prerelease: false
|
289
|
-
version_requirements: !ruby/object:Gem::Requirement
|
290
|
-
requirements:
|
291
|
-
- - "~>"
|
292
|
-
- !ruby/object:Gem::Version
|
293
|
-
version: 4.1.3
|
294
|
-
- !ruby/object:Gem::Dependency
|
295
|
-
name: coffee-script
|
296
|
-
requirement: !ruby/object:Gem::Requirement
|
297
|
-
requirements:
|
298
|
-
- - "~>"
|
299
|
-
- !ruby/object:Gem::Version
|
300
|
-
version: 2.4.1
|
301
|
-
type: :runtime
|
302
|
-
prerelease: false
|
303
|
-
version_requirements: !ruby/object:Gem::Requirement
|
304
|
-
requirements:
|
305
|
-
- - "~>"
|
306
|
-
- !ruby/object:Gem::Version
|
307
|
-
version: 2.4.1
|
308
|
-
- !ruby/object:Gem::Dependency
|
309
|
-
name: compass
|
310
|
-
requirement: !ruby/object:Gem::Requirement
|
311
|
-
requirements:
|
312
|
-
- - "~>"
|
313
|
-
- !ruby/object:Gem::Version
|
314
|
-
version: 1.0.3
|
315
|
-
type: :runtime
|
316
|
-
prerelease: false
|
317
|
-
version_requirements: !ruby/object:Gem::Requirement
|
318
|
-
requirements:
|
319
|
-
- - "~>"
|
320
|
-
- !ruby/object:Gem::Version
|
321
|
-
version: 1.0.3
|
322
|
-
- !ruby/object:Gem::Dependency
|
323
|
-
name: autoprefixer-rails
|
233
|
+
name: execjs
|
324
234
|
requirement: !ruby/object:Gem::Requirement
|
325
235
|
requirements:
|
326
236
|
- - "~>"
|
327
237
|
- !ruby/object:Gem::Version
|
328
|
-
version: 8.
|
238
|
+
version: 2.8.1
|
329
239
|
type: :runtime
|
330
240
|
prerelease: false
|
331
241
|
version_requirements: !ruby/object:Gem::Requirement
|
332
242
|
requirements:
|
333
243
|
- - "~>"
|
334
244
|
- !ruby/object:Gem::Version
|
335
|
-
version: 8.
|
245
|
+
version: 2.8.1
|
336
246
|
- !ruby/object:Gem::Dependency
|
337
247
|
name: kramdown
|
338
248
|
requirement: !ruby/object:Gem::Requirement
|
@@ -417,48 +327,20 @@ dependencies:
|
|
417
327
|
- - "~>"
|
418
328
|
- !ruby/object:Gem::Version
|
419
329
|
version: '1.12'
|
420
|
-
- !ruby/object:Gem::Dependency
|
421
|
-
name: parser
|
422
|
-
requirement: !ruby/object:Gem::Requirement
|
423
|
-
requirements:
|
424
|
-
- - "~>"
|
425
|
-
- !ruby/object:Gem::Version
|
426
|
-
version: '2.7'
|
427
|
-
type: :runtime
|
428
|
-
prerelease: false
|
429
|
-
version_requirements: !ruby/object:Gem::Requirement
|
430
|
-
requirements:
|
431
|
-
- - "~>"
|
432
|
-
- !ruby/object:Gem::Version
|
433
|
-
version: '2.7'
|
434
|
-
- !ruby/object:Gem::Dependency
|
435
|
-
name: unparser
|
436
|
-
requirement: !ruby/object:Gem::Requirement
|
437
|
-
requirements:
|
438
|
-
- - "~>"
|
439
|
-
- !ruby/object:Gem::Version
|
440
|
-
version: '0.4'
|
441
|
-
type: :runtime
|
442
|
-
prerelease: false
|
443
|
-
version_requirements: !ruby/object:Gem::Requirement
|
444
|
-
requirements:
|
445
|
-
- - "~>"
|
446
|
-
- !ruby/object:Gem::Version
|
447
|
-
version: '0.4'
|
448
330
|
- !ruby/object:Gem::Dependency
|
449
331
|
name: locomotivecms_common
|
450
332
|
requirement: !ruby/object:Gem::Requirement
|
451
333
|
requirements:
|
452
334
|
- - "~>"
|
453
335
|
- !ruby/object:Gem::Version
|
454
|
-
version: 0.
|
336
|
+
version: 0.5.0
|
455
337
|
type: :runtime
|
456
338
|
prerelease: false
|
457
339
|
version_requirements: !ruby/object:Gem::Requirement
|
458
340
|
requirements:
|
459
341
|
- - "~>"
|
460
342
|
- !ruby/object:Gem::Version
|
461
|
-
version: 0.
|
343
|
+
version: 0.5.0
|
462
344
|
description: The LocomotiveCMS Steam is the rendering stack used by both Wagon and
|
463
345
|
Engine
|
464
346
|
email:
|
@@ -541,7 +423,6 @@ files:
|
|
541
423
|
- lib/locomotive/steam/initializers.rb
|
542
424
|
- lib/locomotive/steam/initializers/dragonfly.rb
|
543
425
|
- lib/locomotive/steam/initializers/i18n.rb
|
544
|
-
- lib/locomotive/steam/initializers/sprockets.rb
|
545
426
|
- lib/locomotive/steam/liquid.rb
|
546
427
|
- lib/locomotive/steam/liquid/drops/base.rb
|
547
428
|
- lib/locomotive/steam/liquid/drops/content_entry.rb
|
@@ -619,7 +500,6 @@ files:
|
|
619
500
|
- lib/locomotive/steam/middlewares/concerns/recaptcha.rb
|
620
501
|
- lib/locomotive/steam/middlewares/concerns/rendering.rb
|
621
502
|
- lib/locomotive/steam/middlewares/default_env.rb
|
622
|
-
- lib/locomotive/steam/middlewares/dynamic_assets.rb
|
623
503
|
- lib/locomotive/steam/middlewares/encoded_link_redirection.rb
|
624
504
|
- lib/locomotive/steam/middlewares/entry_submission.rb
|
625
505
|
- lib/locomotive/steam/middlewares/favicon.rb
|
@@ -783,7 +663,7 @@ files:
|
|
783
663
|
- spec/fixtures/default/public/images/photo_frame.png
|
784
664
|
- spec/fixtures/default/public/images/sep.png
|
785
665
|
- spec/fixtures/default/public/images/top.jpg
|
786
|
-
- spec/fixtures/default/public/javascripts/application.js
|
666
|
+
- spec/fixtures/default/public/javascripts/application.js
|
787
667
|
- spec/fixtures/default/public/javascripts/common.js
|
788
668
|
- spec/fixtures/default/public/samples/asset_collections/cover.jpg
|
789
669
|
- spec/fixtures/default/public/samples/photo.jpg
|
@@ -886,7 +766,6 @@ files:
|
|
886
766
|
- spec/unit/entities/snippet_spec.rb
|
887
767
|
- spec/unit/errors_spec.rb
|
888
768
|
- spec/unit/initializers/dragonfly_spec.rb
|
889
|
-
- spec/unit/initializers/sprockets_spec.rb
|
890
769
|
- spec/unit/liquid/drops/content_entry_collection_spec.rb
|
891
770
|
- spec/unit/liquid/drops/content_entry_spec.rb
|
892
771
|
- spec/unit/liquid/drops/content_types_spec.rb
|
@@ -942,7 +821,6 @@ files:
|
|
942
821
|
- spec/unit/liquid/tags/with_scope_spec.rb
|
943
822
|
- spec/unit/middlewares/auth_spec.rb
|
944
823
|
- spec/unit/middlewares/cache_spec.rb
|
945
|
-
- spec/unit/middlewares/dynamic_assets_spec.rb
|
946
824
|
- spec/unit/middlewares/encoded_link_redirection_spec.rb
|
947
825
|
- spec/unit/middlewares/entry_submission_spec.rb
|
948
826
|
- spec/unit/middlewares/helpers_spec.rb
|
@@ -999,7 +877,7 @@ homepage: https://github.com/locomotivecms/steam
|
|
999
877
|
licenses:
|
1000
878
|
- MIT
|
1001
879
|
metadata: {}
|
1002
|
-
post_install_message:
|
880
|
+
post_install_message:
|
1003
881
|
rdoc_options: []
|
1004
882
|
require_paths:
|
1005
883
|
- lib
|
@@ -1007,10 +885,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1007
885
|
requirements:
|
1008
886
|
- - ">="
|
1009
887
|
- !ruby/object:Gem::Version
|
1010
|
-
version: '2.
|
888
|
+
version: '2.7'
|
1011
889
|
- - "<"
|
1012
890
|
- !ruby/object:Gem::Version
|
1013
|
-
version: '3'
|
891
|
+
version: '3.1'
|
1014
892
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1015
893
|
requirements:
|
1016
894
|
- - ">="
|
@@ -1018,7 +896,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1018
896
|
version: '0'
|
1019
897
|
requirements: []
|
1020
898
|
rubygems_version: 3.1.6
|
1021
|
-
signing_key:
|
899
|
+
signing_key:
|
1022
900
|
specification_version: 4
|
1023
901
|
summary: The LocomotiveCMS Steam is the rendering stack used by both Wagon and Engine
|
1024
902
|
test_files:
|
@@ -1105,7 +983,7 @@ test_files:
|
|
1105
983
|
- spec/fixtures/default/public/images/photo_frame.png
|
1106
984
|
- spec/fixtures/default/public/images/sep.png
|
1107
985
|
- spec/fixtures/default/public/images/top.jpg
|
1108
|
-
- spec/fixtures/default/public/javascripts/application.js
|
986
|
+
- spec/fixtures/default/public/javascripts/application.js
|
1109
987
|
- spec/fixtures/default/public/javascripts/common.js
|
1110
988
|
- spec/fixtures/default/public/samples/asset_collections/cover.jpg
|
1111
989
|
- spec/fixtures/default/public/samples/photo.jpg
|
@@ -1208,7 +1086,6 @@ test_files:
|
|
1208
1086
|
- spec/unit/entities/snippet_spec.rb
|
1209
1087
|
- spec/unit/errors_spec.rb
|
1210
1088
|
- spec/unit/initializers/dragonfly_spec.rb
|
1211
|
-
- spec/unit/initializers/sprockets_spec.rb
|
1212
1089
|
- spec/unit/liquid/drops/content_entry_collection_spec.rb
|
1213
1090
|
- spec/unit/liquid/drops/content_entry_spec.rb
|
1214
1091
|
- spec/unit/liquid/drops/content_types_spec.rb
|
@@ -1264,7 +1141,6 @@ test_files:
|
|
1264
1141
|
- spec/unit/liquid/tags/with_scope_spec.rb
|
1265
1142
|
- spec/unit/middlewares/auth_spec.rb
|
1266
1143
|
- spec/unit/middlewares/cache_spec.rb
|
1267
|
-
- spec/unit/middlewares/dynamic_assets_spec.rb
|
1268
1144
|
- spec/unit/middlewares/encoded_link_redirection_spec.rb
|
1269
1145
|
- spec/unit/middlewares/entry_submission_spec.rb
|
1270
1146
|
- spec/unit/middlewares/helpers_spec.rb
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'sprockets'
|
2
|
-
require 'sass'
|
3
|
-
require 'coffee_script'
|
4
|
-
require 'compass'
|
5
|
-
require 'uglifier'
|
6
|
-
require 'autoprefixer-rails'
|
7
|
-
|
8
|
-
require 'execjs'
|
9
|
-
|
10
|
-
module Locomotive::Steam
|
11
|
-
|
12
|
-
class SprocketsEnvironment < ::Sprockets::Environment
|
13
|
-
|
14
|
-
attr_reader :steam_path
|
15
|
-
|
16
|
-
def initialize(root, options = {})
|
17
|
-
super(root)
|
18
|
-
|
19
|
-
@steam_path = root
|
20
|
-
|
21
|
-
append_steam_paths
|
22
|
-
|
23
|
-
install_minifiers if options[:minify]
|
24
|
-
|
25
|
-
install_autoprefixer
|
26
|
-
|
27
|
-
context_class.class_eval do
|
28
|
-
def asset_path(path, options = {})
|
29
|
-
path
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def append_steam_paths
|
37
|
-
%w(fonts stylesheets javascripts).each do |name|
|
38
|
-
append_path File.join(@steam_path, name)
|
39
|
-
end
|
40
|
-
|
41
|
-
Compass::Frameworks::ALL.each { |f| append_path(f.stylesheets_directory) }
|
42
|
-
end
|
43
|
-
|
44
|
-
def install_minifiers
|
45
|
-
# minify javascripts and stylesheets
|
46
|
-
self.js_compressor = :uglify
|
47
|
-
self.css_compressor = :scss
|
48
|
-
end
|
49
|
-
|
50
|
-
def install_autoprefixer
|
51
|
-
file = File.join(root, '..', 'config', 'autoprefixer.yml')
|
52
|
-
|
53
|
-
if File.exists?(file)
|
54
|
-
params = (::YAML.load_file(file) || {}).symbolize_keys
|
55
|
-
AutoprefixerRails.install(self, params)
|
56
|
-
|
57
|
-
Locomotive::Common::Logger.info "[Autoprefixer] detected and installed".light_white
|
58
|
-
|
59
|
-
if ENV['EXECJS_RUNTIME'].blank?
|
60
|
-
Locomotive::Common::Logger.warn "[Autoprefixer]".light_white + " [Warning] if you notice bad performance, install NodeJS and run \"export EXECJS_RUNTIME=Node\" in your shell"
|
61
|
-
end
|
62
|
-
|
63
|
-
Locomotive::Common::Logger.info "\n"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Locomotive::Steam
|
2
|
-
module Middlewares
|
3
|
-
|
4
|
-
class DynamicAssets
|
5
|
-
|
6
|
-
REGEXP = /^\/(javascripts|stylesheets)\/(.*)$/o
|
7
|
-
|
8
|
-
@@sprocket_environments = {}
|
9
|
-
|
10
|
-
attr_reader :app, :assets
|
11
|
-
|
12
|
-
def initialize(app, options)
|
13
|
-
@app = app
|
14
|
-
@assets = self.class.sprocket_environment(options[:root], options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def call(env)
|
18
|
-
if env['PATH_INFO'] =~ REGEXP
|
19
|
-
env['PATH_INFO'] = $2
|
20
|
-
assets.call(env)
|
21
|
-
else
|
22
|
-
app.call(env)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.sprocket_environment(root, options)
|
27
|
-
@@sprocket_environments[root] ||= Locomotive::Steam::SprocketsEnvironment.new(root, options)
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require_relative '../../../lib/locomotive/steam/initializers/sprockets'
|
4
|
-
|
5
|
-
describe Locomotive::Steam::SprocketsEnvironment do
|
6
|
-
|
7
|
-
let(:root) { '.' }
|
8
|
-
let(:options) { { minify: true } }
|
9
|
-
let(:env) { described_class.new(root, options) }
|
10
|
-
|
11
|
-
describe '#install_autoprefixer' do
|
12
|
-
|
13
|
-
let(:options) { { minify: false } }
|
14
|
-
|
15
|
-
subject { env }
|
16
|
-
|
17
|
-
context "config/autoprefixer.yml doesn't exist" do
|
18
|
-
|
19
|
-
before { allow(File).to receive(:exists?).and_return false }
|
20
|
-
|
21
|
-
it { expect(AutoprefixerRails).not_to receive(:install); subject }
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
context "config/autoprefixer.yml exists" do
|
26
|
-
|
27
|
-
before {
|
28
|
-
allow(File).to receive(:exists?).and_return(true)
|
29
|
-
allow(YAML).to receive(:load_file).and_return({})
|
30
|
-
}
|
31
|
-
|
32
|
-
it { expect(AutoprefixerRails).to receive(:install).and_return(true); subject }
|
33
|
-
|
34
|
-
it 'warns developers if they notice bad performance when using autoprefixer' do
|
35
|
-
curent_execjs_runtime = ENV['EXECJS_RUNTIME']
|
36
|
-
ENV['EXECJS_RUNTIME'] = 'NodeJS'
|
37
|
-
expect(Locomotive::Common::Logger).not_to receive(:warn)
|
38
|
-
expect(AutoprefixerRails).to receive(:install).and_return(true)
|
39
|
-
subject
|
40
|
-
ENV['EXECJS_RUNTIME'] = curent_execjs_runtime
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require_relative '../../../lib/locomotive/steam/middlewares/dynamic_assets'
|
4
|
-
|
5
|
-
describe Locomotive::Steam::Middlewares::DynamicAssets do
|
6
|
-
|
7
|
-
let(:app) { ->(env) { [200, env, 'app'] }}
|
8
|
-
let(:options) { { root: File.dirname(__FILE__), minify: true } }
|
9
|
-
let(:middleware) { described_class.new(app, options) }
|
10
|
-
|
11
|
-
describe '#call' do
|
12
|
-
|
13
|
-
let(:env) { { 'PATH_INFO' => '/stylesheets/application.css' } }
|
14
|
-
subject { middleware.call(env) }
|
15
|
-
|
16
|
-
it 'calls sprockets to process the asset' do
|
17
|
-
expect(middleware.assets).to receive(:call).with(env).and_return(true)
|
18
|
-
is_expected.to eq true
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'not an asset' do
|
22
|
-
|
23
|
-
let(:env) { { 'PATH_INFO' => '/index' } }
|
24
|
-
|
25
|
-
it 'bypasses sprockets' do
|
26
|
-
expect(middleware.assets).not_to receive(:call)
|
27
|
-
is_expected.not_to eq nil
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|