locomotivecms_steam 1.6.1 → 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/.travis.yml +1 -2
- data/Gemfile +4 -2
- data/Gemfile.lock +58 -81
- 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/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 +7 -14
- 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/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 -120
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1d1190c7a803c31bd03c95eadc0778dae4018260d5f189e17504584ff214eb2
|
4
|
+
data.tar.gz: a31caf22fe539484172005e8ffd8429bc301b72d1e09b0b0d4d553ca6364a8c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fce3dfa770a46f8d6f7ae47db8c7045d4dece1acb550685955f0641bf09c82de9a2d9dc67309727d3fc7874b21b59c205d29f770c8f7c2f3ab5829c72ce769c
|
7
|
+
data.tar.gz: 34b654ec05743ce7da33454004a9828f94533d15f26691a25c254833f179f2ba84cc5f3dc9864485452d76f82b889ae6dd7f10ac6a90bda3951dd5f80b961604
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -9,7 +9,9 @@ group :development do
|
|
9
9
|
# gem 'duktape', github: 'judofyr/duktape.rb', ref: '20ef6a5'
|
10
10
|
# gem 'duktape', github: 'did/duktape.rb', branch: 'any-fixnum'
|
11
11
|
|
12
|
-
gem '
|
12
|
+
gem 'rake'
|
13
|
+
|
14
|
+
gem 'puma', '~> 6.1.0'
|
13
15
|
gem 'haml', '~> 5.2.0'
|
14
16
|
|
15
17
|
gem 'rack', '~> 2.2.3.1'
|
@@ -30,5 +32,5 @@ group :test do
|
|
30
32
|
|
31
33
|
gem 'rack-test', '~> 0.8.2'
|
32
34
|
|
33
|
-
gem 'coveralls', '~> 0.8.
|
35
|
+
gem 'coveralls', '~> 0.8.23', require: false
|
34
36
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,46 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
locomotivecms_steam (1.
|
4
|
+
locomotivecms_steam (1.7.0)
|
5
5
|
RedCloth (~> 4.3.2)
|
6
|
-
autoprefixer-rails (~> 8.0.0)
|
7
6
|
bcrypt (~> 3.1.11)
|
8
7
|
chronic (~> 0.10.2)
|
9
|
-
coffee-script (~> 2.4.1)
|
10
|
-
compass (~> 1.0.3)
|
11
8
|
dragonfly (>= 1.2, < 1.5)
|
12
9
|
duktape (~> 2.0.1.1)
|
10
|
+
execjs (~> 2.8.1)
|
13
11
|
httparty (~> 0.16.0)
|
14
12
|
kramdown (~> 2.3.0)
|
15
|
-
liquid (~> 4.0.
|
16
|
-
locomotivecms_common (~> 0.
|
13
|
+
liquid (~> 4.0.4)
|
14
|
+
locomotivecms_common (~> 0.5.0)
|
17
15
|
mime-types (~> 3.3.0)
|
18
16
|
mimetype-fu (~> 0.1.2)
|
19
17
|
moneta (~> 1.0.0)
|
20
18
|
morphine (~> 0.1.1)
|
21
19
|
multi_json (~> 1.15.0)
|
22
|
-
nokogiri (
|
20
|
+
nokogiri (~> 1.14.2)
|
23
21
|
pony (~> 1.12)
|
24
22
|
rack-cache (~> 1.7.0)
|
25
23
|
rack-rewrite (~> 1.5.1)
|
26
24
|
rack_csrf (~> 2.6.0)
|
27
|
-
sanitize (~>
|
28
|
-
sass (~> 3.4.25)
|
29
|
-
sprockets (~> 3.7.1)
|
30
|
-
uglifier (~> 4.1.3)
|
25
|
+
sanitize (~> 6.0.1)
|
31
26
|
|
32
27
|
GEM
|
33
28
|
remote: https://rubygems.org/
|
34
29
|
specs:
|
35
30
|
RedCloth (4.3.2)
|
36
|
-
activesupport (
|
31
|
+
activesupport (7.0.4.2)
|
37
32
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
38
|
-
i18n (>=
|
39
|
-
minitest (
|
40
|
-
tzinfo (~>
|
33
|
+
i18n (>= 1.6, < 2)
|
34
|
+
minitest (>= 5.1)
|
35
|
+
tzinfo (~> 2.0)
|
41
36
|
addressable (2.8.1)
|
42
37
|
public_suffix (>= 2.0.2, < 6.0)
|
43
|
-
attr_extras (
|
44
|
-
autoprefixer-rails (8.0.0)
|
45
|
-
execjs
|
38
|
+
attr_extras (7.1.0)
|
46
39
|
bcrypt (3.1.18)
|
47
40
|
bson (4.15.0)
|
48
41
|
chronic (0.10.2)
|
49
|
-
chunky_png (1.4.0)
|
50
|
-
coffee-script (2.4.1)
|
51
|
-
coffee-script-source
|
52
|
-
execjs
|
53
|
-
coffee-script-source (1.12.2)
|
54
42
|
colorize (0.8.1)
|
55
|
-
|
56
|
-
chunky_png (~> 1.2)
|
57
|
-
compass-core (~> 1.0.2)
|
58
|
-
compass-import-once (~> 1.0.5)
|
59
|
-
rb-fsevent (>= 0.9.3)
|
60
|
-
rb-inotify (>= 0.9)
|
61
|
-
sass (>= 3.3.13, < 3.5)
|
62
|
-
compass-core (1.0.3)
|
63
|
-
multi_json (~> 1.0)
|
64
|
-
sass (>= 3.3.0, < 3.5)
|
65
|
-
compass-import-once (1.0.5)
|
66
|
-
sass (>= 3.2, < 3.5)
|
67
|
-
concurrent-ruby (1.1.10)
|
43
|
+
concurrent-ruby (1.2.2)
|
68
44
|
coveralls (0.8.23)
|
69
45
|
json (>= 1.8, < 3)
|
70
46
|
simplecov (~> 0.16.1)
|
@@ -72,6 +48,7 @@ GEM
|
|
72
48
|
thor (>= 0.19.4, < 2.0)
|
73
49
|
tins (~> 1.6)
|
74
50
|
crass (1.0.6)
|
51
|
+
date (3.3.3)
|
75
52
|
diff-lcs (1.5.0)
|
76
53
|
docile (1.4.0)
|
77
54
|
dragonfly (1.4.0)
|
@@ -80,7 +57,6 @@ GEM
|
|
80
57
|
rack (>= 1.3)
|
81
58
|
duktape (2.0.1.1)
|
82
59
|
execjs (2.8.1)
|
83
|
-
ffi (1.15.5)
|
84
60
|
flamegraph (0.9.5)
|
85
61
|
haml (5.2.2)
|
86
62
|
temple (>= 0.8.0)
|
@@ -94,47 +70,57 @@ GEM
|
|
94
70
|
iso
|
95
71
|
iso (0.4.0)
|
96
72
|
i18n
|
97
|
-
json (2.6.
|
73
|
+
json (2.6.3)
|
98
74
|
json_spec (1.1.5)
|
99
75
|
multi_json (~> 1.0)
|
100
76
|
rspec (>= 2.0, < 4.0)
|
101
77
|
kramdown (2.3.2)
|
102
78
|
rexml
|
103
|
-
liquid (4.0.
|
104
|
-
locomotivecms_common (0.
|
105
|
-
activesupport (>= 5
|
106
|
-
attr_extras (~>
|
79
|
+
liquid (4.0.4)
|
80
|
+
locomotivecms_common (0.5.0)
|
81
|
+
activesupport (>= 5)
|
82
|
+
attr_extras (~> 7.1.0)
|
107
83
|
colorize
|
108
|
-
stringex (~> 2.8.
|
109
|
-
mail (2.
|
84
|
+
stringex (~> 2.8.5)
|
85
|
+
mail (2.8.1)
|
110
86
|
mini_mime (>= 0.1.1)
|
111
|
-
|
87
|
+
net-imap
|
88
|
+
net-pop
|
89
|
+
net-smtp
|
90
|
+
memory_profiler (1.0.1)
|
112
91
|
mime-types (3.3.1)
|
113
92
|
mime-types-data (~> 3.2015)
|
114
|
-
mime-types-data (3.
|
93
|
+
mime-types-data (3.2023.0218.1)
|
115
94
|
mimetype-fu (0.1.2)
|
116
95
|
mini_mime (1.1.2)
|
117
|
-
mini_portile2 (2.8.
|
118
|
-
minitest (5.
|
96
|
+
mini_portile2 (2.8.1)
|
97
|
+
minitest (5.17.0)
|
119
98
|
moneta (1.0.0)
|
120
|
-
mongo (2.
|
121
|
-
bson (>= 4.
|
99
|
+
mongo (2.18.2)
|
100
|
+
bson (>= 4.14.1, < 5.0.0)
|
122
101
|
morphine (0.1.1)
|
123
102
|
multi_json (1.15.0)
|
124
103
|
multi_xml (0.6.0)
|
104
|
+
net-imap (0.3.4)
|
105
|
+
date
|
106
|
+
net-protocol
|
107
|
+
net-pop (0.1.2)
|
108
|
+
net-protocol
|
109
|
+
net-protocol (0.2.1)
|
110
|
+
timeout
|
111
|
+
net-smtp (0.3.3)
|
112
|
+
net-protocol
|
125
113
|
nio4r (2.5.8)
|
126
|
-
nokogiri (1.
|
114
|
+
nokogiri (1.14.2)
|
127
115
|
mini_portile2 (~> 2.8.0)
|
128
116
|
racc (~> 1.4)
|
129
|
-
nokogumbo (2.0.5)
|
130
|
-
nokogiri (~> 1.8, >= 1.8.4)
|
131
117
|
origin (2.3.1)
|
132
118
|
pony (1.13.1)
|
133
119
|
mail (>= 2.0)
|
134
|
-
public_suffix (5.0.
|
135
|
-
puma (
|
120
|
+
public_suffix (5.0.1)
|
121
|
+
puma (6.1.0)
|
136
122
|
nio4r (~> 2.0)
|
137
|
-
racc (1.6.
|
123
|
+
racc (1.6.2)
|
138
124
|
rack (2.2.3.1)
|
139
125
|
rack-cache (1.7.2)
|
140
126
|
rack (>= 0.4)
|
@@ -146,9 +132,6 @@ GEM
|
|
146
132
|
rack_csrf (2.6.0)
|
147
133
|
rack (>= 1.1.0)
|
148
134
|
rake (13.0.6)
|
149
|
-
rb-fsevent (0.11.2)
|
150
|
-
rb-inotify (0.10.1)
|
151
|
-
ffi (~> 1.0)
|
152
135
|
rexml (3.2.5)
|
153
136
|
rspec (3.7.0)
|
154
137
|
rspec-core (~> 3.7.0)
|
@@ -163,57 +146,51 @@ GEM
|
|
163
146
|
diff-lcs (>= 1.2.0, < 2.0)
|
164
147
|
rspec-support (~> 3.7.0)
|
165
148
|
rspec-support (3.7.1)
|
166
|
-
sanitize (
|
149
|
+
sanitize (6.0.1)
|
167
150
|
crass (~> 1.0.2)
|
168
|
-
nokogiri (>= 1.
|
169
|
-
nokogumbo (~> 2.0)
|
170
|
-
sass (3.4.25)
|
151
|
+
nokogiri (>= 1.12.0)
|
171
152
|
simplecov (0.16.1)
|
172
153
|
docile (~> 1.1)
|
173
154
|
json (>= 1.8, < 3)
|
174
155
|
simplecov-html (~> 0.10.0)
|
175
156
|
simplecov-html (0.10.2)
|
176
|
-
|
177
|
-
concurrent-ruby (~> 1.0)
|
178
|
-
rack (> 1, < 3)
|
179
|
-
stackprof (0.2.21)
|
157
|
+
stackprof (0.2.23)
|
180
158
|
stringex (2.8.5)
|
181
159
|
sync (0.5.0)
|
182
|
-
temple (0.
|
160
|
+
temple (0.10.0)
|
183
161
|
term-ansicolor (1.7.1)
|
184
162
|
tins (~> 1.0)
|
185
163
|
thor (1.2.1)
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
tins (1.
|
164
|
+
tilt (2.1.0)
|
165
|
+
timecop (0.9.6)
|
166
|
+
timeout (0.3.2)
|
167
|
+
tins (1.32.1)
|
190
168
|
sync
|
191
|
-
tzinfo (
|
192
|
-
|
193
|
-
uglifier (4.1.20)
|
194
|
-
execjs (>= 0.3.0, < 3)
|
169
|
+
tzinfo (2.0.6)
|
170
|
+
concurrent-ruby (~> 1.0)
|
195
171
|
|
196
172
|
PLATFORMS
|
197
173
|
ruby
|
174
|
+
x86_64-darwin-22
|
198
175
|
|
199
176
|
DEPENDENCIES
|
200
|
-
coveralls (~> 0.8.
|
177
|
+
coveralls (~> 0.8.23)
|
201
178
|
flamegraph
|
202
179
|
haml (~> 5.2.0)
|
203
180
|
i18n-spec (~> 0.6.0)
|
204
181
|
json_spec (~> 1.1.5)
|
205
182
|
locomotivecms_steam!
|
206
183
|
memory_profiler
|
207
|
-
mongo (~> 2.
|
184
|
+
mongo (~> 2.18.2)
|
208
185
|
origin (~> 2.3.1)
|
209
|
-
puma (~>
|
186
|
+
puma (~> 6.1.0)
|
210
187
|
rack (~> 2.2.3.1)
|
211
188
|
rack-mini-profiler (~> 0.10.1)
|
212
189
|
rack-test (~> 0.8.2)
|
213
|
-
rake
|
190
|
+
rake
|
214
191
|
rspec (~> 3.7.0)
|
215
192
|
stackprof
|
216
193
|
timecop (~> 0.9.1)
|
217
194
|
|
218
195
|
BUNDLED WITH
|
219
|
-
2.
|
196
|
+
2.3.10
|
data/Rakefile
CHANGED
@@ -27,8 +27,8 @@ namespace :mongodb do
|
|
27
27
|
`mv #{dump_path} #{db_path}`
|
28
28
|
end
|
29
29
|
|
30
|
-
`mongo
|
31
|
-
`mongorestore -d
|
30
|
+
`mongo steam_test_1_7_x --eval "db.dropDatabase()" #{host}`
|
31
|
+
`mongorestore -d steam_test_1_7_x #{db_path} #{host}`
|
32
32
|
|
33
33
|
puts "Done! Update now the spec/support/helpers.rb file by setting the new id of the site returned by the mongodb_site_id method"
|
34
34
|
end
|
@@ -23,7 +23,7 @@ module Locomotive::Steam
|
|
23
23
|
def update(entity)
|
24
24
|
entity.tap do
|
25
25
|
serialized_entity = @mapper.serialize(entity)
|
26
|
-
@collection.find(_id: entity._id).update_one(serialized_entity)
|
26
|
+
@collection.find(_id: entity._id).update_one('$set' => serialized_entity)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -7,7 +7,7 @@ module Locomotive::Steam
|
|
7
7
|
|
8
8
|
def _call
|
9
9
|
if env['PATH_INFO'] == '/sitemap.xml' && (page.nil? || page.not_found?)
|
10
|
-
render_response(build_xml, 200, '
|
10
|
+
render_response(build_xml, 200, 'application/xml')
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -89,7 +89,7 @@ module Locomotive::Steam
|
|
89
89
|
<<-XML
|
90
90
|
<url>
|
91
91
|
<loc>#{base_url}#{entry[:loc]}</loc>
|
92
|
-
<lastmod>#{entry[:date].
|
92
|
+
<lastmod>#{entry[:date].to_fs('%Y-%m-%d')}</lastmod>
|
93
93
|
#{entry_links_to_xml(entry[:links])}
|
94
94
|
</url>
|
95
95
|
XML
|
@@ -31,11 +31,7 @@ module Locomotive::Steam
|
|
31
31
|
if configuration.serve_assets
|
32
32
|
use ::Rack::Static, {
|
33
33
|
root: configuration.asset_path,
|
34
|
-
urls: ['/images', '/fonts', '/samples', '/sites', '/misc', '/others', '/pdfs', '/media']
|
35
|
-
}
|
36
|
-
use Middlewares::DynamicAssets, {
|
37
|
-
root: configuration.asset_path,
|
38
|
-
minify: configuration.minify_assets
|
34
|
+
urls: ['/stylesheets', '/javascripts', '/images', '/fonts', '/samples', '/sites', '/misc', '/others', '/pdfs', '/media']
|
39
35
|
}
|
40
36
|
end
|
41
37
|
|
data/locomotivecms_steam.gemspec
CHANGED
@@ -15,19 +15,17 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.add_development_dependency '
|
19
|
-
|
20
|
-
spec.add_development_dependency 'mongo', '~> 2.13.1'
|
18
|
+
spec.add_development_dependency 'mongo', '~> 2.18.2'
|
21
19
|
spec.add_development_dependency 'origin', '~> 2.3.1'
|
22
20
|
|
23
|
-
spec.add_dependency 'nokogiri', '
|
24
|
-
spec.add_dependency 'sanitize', '~>
|
21
|
+
spec.add_dependency 'nokogiri', '~> 1.14.2'
|
22
|
+
spec.add_dependency 'sanitize', '~> 6.0.1'
|
25
23
|
spec.add_dependency 'morphine', '~> 0.1.1'
|
26
24
|
spec.add_dependency 'httparty', '~> 0.16.0'
|
27
25
|
spec.add_dependency 'chronic', '~> 0.10.2'
|
28
26
|
spec.add_dependency 'bcrypt', '~> 3.1.11'
|
29
27
|
spec.add_dependency 'multi_json', '~> 1.15.0'
|
30
|
-
spec.add_dependency 'liquid', '~> 4.0.
|
28
|
+
spec.add_dependency 'liquid', '~> 4.0.4'
|
31
29
|
|
32
30
|
spec.add_dependency 'rack-rewrite', '~> 1.5.1'
|
33
31
|
spec.add_dependency 'rack-cache', '~> 1.7.0'
|
@@ -35,12 +33,7 @@ Gem::Specification.new do |spec|
|
|
35
33
|
spec.add_dependency 'dragonfly', '>= 1.2', '< 1.5'
|
36
34
|
spec.add_dependency 'moneta', '~> 1.0.0'
|
37
35
|
|
38
|
-
spec.add_dependency '
|
39
|
-
spec.add_dependency 'sass', '~> 3.4.25'
|
40
|
-
spec.add_dependency 'uglifier', '~> 4.1.3'
|
41
|
-
spec.add_dependency 'coffee-script', '~> 2.4.1'
|
42
|
-
spec.add_dependency 'compass', '~> 1.0.3'
|
43
|
-
spec.add_dependency 'autoprefixer-rails', '~> 8.0.0'
|
36
|
+
spec.add_dependency 'execjs', '~> 2.8.1'
|
44
37
|
|
45
38
|
spec.add_dependency 'kramdown', '~> 2.3.0'
|
46
39
|
spec.add_dependency 'RedCloth', '~> 4.3.2'
|
@@ -49,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
49
42
|
spec.add_dependency 'duktape', '~> 2.0.1.1'
|
50
43
|
spec.add_dependency 'pony', '~> 1.12'
|
51
44
|
|
52
|
-
spec.add_dependency 'locomotivecms_common', '~> 0.
|
45
|
+
spec.add_dependency 'locomotivecms_common', '~> 0.5.0'
|
53
46
|
|
54
|
-
spec.required_ruby_version = ['>= 2.
|
47
|
+
spec.required_ruby_version = ['>= 2.7', '< 3.1']
|
55
48
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
window.on('load', () => { alert('hello world') })
|
@@ -43,7 +43,7 @@ describe Locomotive::Steam::MongoDBAdapter do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def current_connections
|
46
|
-
`
|
46
|
+
`mongosh --eval "db.serverStatus().connections.current"`.split("\n").last.to_i
|
47
47
|
end
|
48
48
|
|
49
49
|
end
|
@@ -33,26 +33,16 @@ describe Locomotive::Steam::Server do
|
|
33
33
|
expect(last_response.status).to eq(200)
|
34
34
|
end
|
35
35
|
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'dynamic assets (SCSS + Coffeescript)' do
|
39
|
-
|
40
36
|
it 'renders a stylesheet' do
|
41
37
|
get '/stylesheets/application.css'
|
42
38
|
expect(last_response.status).to eq(200)
|
43
|
-
expect(last_response.body).to include('body{background
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'renders a SCSS asset' do
|
47
|
-
get '/stylesheets/other/style.css'
|
48
|
-
expect(last_response.status).to eq(200)
|
49
|
-
expect(last_response.body).to include('body{background:red}')
|
39
|
+
expect(last_response.body).to include('body { background: #f0eee3')
|
50
40
|
end
|
51
41
|
|
52
|
-
it 'renders a
|
42
|
+
it 'renders a javascript' do
|
53
43
|
get '/javascripts/application.js'
|
54
44
|
expect(last_response.status).to eq(200)
|
55
|
-
expect(last_response.body).to include(
|
45
|
+
expect(last_response.body).to include("alert('hello world')")
|
56
46
|
end
|
57
47
|
|
58
48
|
end
|
data/spec/support/helpers.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
require_relative '../../../lib/locomotive/steam/middlewares/thread_safe'
|
4
|
+
require_relative '../../../lib/locomotive/steam/middlewares/concerns/auth_helpers'
|
4
5
|
require_relative '../../../lib/locomotive/steam/middlewares/concerns/helpers'
|
5
6
|
require_relative '../../../lib/locomotive/steam/middlewares/concerns/recaptcha'
|
6
7
|
require_relative '../../../lib/locomotive/steam/middlewares/auth'
|
@@ -55,11 +55,11 @@ describe Locomotive::Steam::Middlewares::Cache do
|
|
55
55
|
|
56
56
|
let(:response) { nil }
|
57
57
|
|
58
|
-
before { expect(cache).to receive(:read).with('
|
58
|
+
before { expect(cache).to receive(:read).with('57f157d0981a09b1565fb31f250229d4').and_return(response) }
|
59
59
|
|
60
60
|
context 'the cache is empty' do
|
61
61
|
|
62
|
-
before { expect(cache).to receive(:write).with('
|
62
|
+
before { expect(cache).to receive(:write).with('57f157d0981a09b1565fb31f250229d4', Marshal.dump([200, {}, ["Hello world!"]])) }
|
63
63
|
|
64
64
|
it 'tells the CDN to cache the page and also cache it internally' do
|
65
65
|
is_expected.to eq ['max-age=0, s-maxage=3600, public, must-revalidate', 'Accept-Language']
|
@@ -69,7 +69,7 @@ describe Locomotive::Steam::Middlewares::Cache do
|
|
69
69
|
|
70
70
|
subject { send_request[:env]['steam.cache_etag'] }
|
71
71
|
|
72
|
-
it { is_expected.to eq '
|
72
|
+
it { is_expected.to eq '57f157d0981a09b1565fb31f250229d4' }
|
73
73
|
|
74
74
|
end
|
75
75
|
|
@@ -104,7 +104,7 @@ describe Locomotive::Steam::Middlewares::Cache do
|
|
104
104
|
|
105
105
|
context 'based on the ETag' do
|
106
106
|
|
107
|
-
let(:etag) { '
|
107
|
+
let(:etag) { '57f157d0981a09b1565fb31f250229d4' }
|
108
108
|
|
109
109
|
it 'returns a 304 (Not modified) without no cache headers' do
|
110
110
|
expect(subject.first).to eq 304
|
@@ -26,7 +26,7 @@ describe Locomotive::Steam::Middlewares::Sitemap do
|
|
26
26
|
describe 'no pages' do
|
27
27
|
|
28
28
|
it 'renders a blank sitemap' do
|
29
|
-
is_expected.to eq [200, { "Content-Type"=>"
|
29
|
+
is_expected.to eq [200, { "Content-Type"=>"application/xml" }, ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n\n</urlset>\n"]]
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -36,7 +36,7 @@ describe Locomotive::Steam::Middlewares::Sitemap do
|
|
36
36
|
let(:pages) { [instance_double('Page', index?: false, not_found?: false, layout?: true)] }
|
37
37
|
|
38
38
|
it 'renders a blank sitemap' do
|
39
|
-
is_expected.to eq [200, { "Content-Type"=>"
|
39
|
+
is_expected.to eq [200, { "Content-Type"=>"application/xml" }, ["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n\n</urlset>\n"]]
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
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
|
@@ -423,14 +333,14 @@ dependencies:
|
|
423
333
|
requirements:
|
424
334
|
- - "~>"
|
425
335
|
- !ruby/object:Gem::Version
|
426
|
-
version: 0.
|
336
|
+
version: 0.5.0
|
427
337
|
type: :runtime
|
428
338
|
prerelease: false
|
429
339
|
version_requirements: !ruby/object:Gem::Requirement
|
430
340
|
requirements:
|
431
341
|
- - "~>"
|
432
342
|
- !ruby/object:Gem::Version
|
433
|
-
version: 0.
|
343
|
+
version: 0.5.0
|
434
344
|
description: The LocomotiveCMS Steam is the rendering stack used by both Wagon and
|
435
345
|
Engine
|
436
346
|
email:
|
@@ -513,7 +423,6 @@ files:
|
|
513
423
|
- lib/locomotive/steam/initializers.rb
|
514
424
|
- lib/locomotive/steam/initializers/dragonfly.rb
|
515
425
|
- lib/locomotive/steam/initializers/i18n.rb
|
516
|
-
- lib/locomotive/steam/initializers/sprockets.rb
|
517
426
|
- lib/locomotive/steam/liquid.rb
|
518
427
|
- lib/locomotive/steam/liquid/drops/base.rb
|
519
428
|
- lib/locomotive/steam/liquid/drops/content_entry.rb
|
@@ -591,7 +500,6 @@ files:
|
|
591
500
|
- lib/locomotive/steam/middlewares/concerns/recaptcha.rb
|
592
501
|
- lib/locomotive/steam/middlewares/concerns/rendering.rb
|
593
502
|
- lib/locomotive/steam/middlewares/default_env.rb
|
594
|
-
- lib/locomotive/steam/middlewares/dynamic_assets.rb
|
595
503
|
- lib/locomotive/steam/middlewares/encoded_link_redirection.rb
|
596
504
|
- lib/locomotive/steam/middlewares/entry_submission.rb
|
597
505
|
- lib/locomotive/steam/middlewares/favicon.rb
|
@@ -755,7 +663,7 @@ files:
|
|
755
663
|
- spec/fixtures/default/public/images/photo_frame.png
|
756
664
|
- spec/fixtures/default/public/images/sep.png
|
757
665
|
- spec/fixtures/default/public/images/top.jpg
|
758
|
-
- spec/fixtures/default/public/javascripts/application.js
|
666
|
+
- spec/fixtures/default/public/javascripts/application.js
|
759
667
|
- spec/fixtures/default/public/javascripts/common.js
|
760
668
|
- spec/fixtures/default/public/samples/asset_collections/cover.jpg
|
761
669
|
- spec/fixtures/default/public/samples/photo.jpg
|
@@ -858,7 +766,6 @@ files:
|
|
858
766
|
- spec/unit/entities/snippet_spec.rb
|
859
767
|
- spec/unit/errors_spec.rb
|
860
768
|
- spec/unit/initializers/dragonfly_spec.rb
|
861
|
-
- spec/unit/initializers/sprockets_spec.rb
|
862
769
|
- spec/unit/liquid/drops/content_entry_collection_spec.rb
|
863
770
|
- spec/unit/liquid/drops/content_entry_spec.rb
|
864
771
|
- spec/unit/liquid/drops/content_types_spec.rb
|
@@ -914,7 +821,6 @@ files:
|
|
914
821
|
- spec/unit/liquid/tags/with_scope_spec.rb
|
915
822
|
- spec/unit/middlewares/auth_spec.rb
|
916
823
|
- spec/unit/middlewares/cache_spec.rb
|
917
|
-
- spec/unit/middlewares/dynamic_assets_spec.rb
|
918
824
|
- spec/unit/middlewares/encoded_link_redirection_spec.rb
|
919
825
|
- spec/unit/middlewares/entry_submission_spec.rb
|
920
826
|
- spec/unit/middlewares/helpers_spec.rb
|
@@ -971,7 +877,7 @@ homepage: https://github.com/locomotivecms/steam
|
|
971
877
|
licenses:
|
972
878
|
- MIT
|
973
879
|
metadata: {}
|
974
|
-
post_install_message:
|
880
|
+
post_install_message:
|
975
881
|
rdoc_options: []
|
976
882
|
require_paths:
|
977
883
|
- lib
|
@@ -979,10 +885,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
979
885
|
requirements:
|
980
886
|
- - ">="
|
981
887
|
- !ruby/object:Gem::Version
|
982
|
-
version: '2.
|
888
|
+
version: '2.7'
|
983
889
|
- - "<"
|
984
890
|
- !ruby/object:Gem::Version
|
985
|
-
version: '3'
|
891
|
+
version: '3.1'
|
986
892
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
987
893
|
requirements:
|
988
894
|
- - ">="
|
@@ -990,7 +896,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
990
896
|
version: '0'
|
991
897
|
requirements: []
|
992
898
|
rubygems_version: 3.1.6
|
993
|
-
signing_key:
|
899
|
+
signing_key:
|
994
900
|
specification_version: 4
|
995
901
|
summary: The LocomotiveCMS Steam is the rendering stack used by both Wagon and Engine
|
996
902
|
test_files:
|
@@ -1077,7 +983,7 @@ test_files:
|
|
1077
983
|
- spec/fixtures/default/public/images/photo_frame.png
|
1078
984
|
- spec/fixtures/default/public/images/sep.png
|
1079
985
|
- spec/fixtures/default/public/images/top.jpg
|
1080
|
-
- spec/fixtures/default/public/javascripts/application.js
|
986
|
+
- spec/fixtures/default/public/javascripts/application.js
|
1081
987
|
- spec/fixtures/default/public/javascripts/common.js
|
1082
988
|
- spec/fixtures/default/public/samples/asset_collections/cover.jpg
|
1083
989
|
- spec/fixtures/default/public/samples/photo.jpg
|
@@ -1180,7 +1086,6 @@ test_files:
|
|
1180
1086
|
- spec/unit/entities/snippet_spec.rb
|
1181
1087
|
- spec/unit/errors_spec.rb
|
1182
1088
|
- spec/unit/initializers/dragonfly_spec.rb
|
1183
|
-
- spec/unit/initializers/sprockets_spec.rb
|
1184
1089
|
- spec/unit/liquid/drops/content_entry_collection_spec.rb
|
1185
1090
|
- spec/unit/liquid/drops/content_entry_spec.rb
|
1186
1091
|
- spec/unit/liquid/drops/content_types_spec.rb
|
@@ -1236,7 +1141,6 @@ test_files:
|
|
1236
1141
|
- spec/unit/liquid/tags/with_scope_spec.rb
|
1237
1142
|
- spec/unit/middlewares/auth_spec.rb
|
1238
1143
|
- spec/unit/middlewares/cache_spec.rb
|
1239
|
-
- spec/unit/middlewares/dynamic_assets_spec.rb
|
1240
1144
|
- spec/unit/middlewares/encoded_link_redirection_spec.rb
|
1241
1145
|
- spec/unit/middlewares/entry_submission_spec.rb
|
1242
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
|