jekyll-minibundle 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +96 -42
- data/LICENSE.txt +1 -1
- data/README.md +232 -52
- data/Rakefile +16 -0
- data/jekyll-minibundle.gemspec +7 -6
- data/lib/jekyll/minibundle/asset_bundle.rb +3 -3
- data/lib/jekyll/minibundle/asset_file_drop.rb +45 -0
- data/lib/jekyll/minibundle/asset_file_properties.rb +12 -8
- data/lib/jekyll/minibundle/asset_file_registry.rb +4 -4
- data/lib/jekyll/minibundle/asset_tag_markup.rb +21 -20
- data/lib/jekyll/minibundle/bundle_file.rb +6 -1
- data/lib/jekyll/minibundle/development_file.rb +2 -1
- data/lib/jekyll/minibundle/development_file_collection.rb +2 -2
- data/lib/jekyll/minibundle/environment.rb +13 -15
- data/lib/jekyll/minibundle/files.rb +16 -18
- data/lib/jekyll/minibundle/hashes.rb +10 -12
- data/lib/jekyll/minibundle/log.rb +5 -7
- data/lib/jekyll/minibundle/mini_bundle_block.rb +35 -12
- data/lib/jekyll/minibundle/mini_stamp_tag.rb +108 -16
- data/lib/jekyll/minibundle/stamp_file.rb +1 -0
- data/lib/jekyll/minibundle/variable_template.rb +145 -0
- data/lib/jekyll/minibundle/variable_template_registry.rb +19 -0
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/fixture/site/_bin/with_count +1 -1
- data/test/integration/minibundle_development_mode_test.rb +146 -61
- data/test/integration/minibundle_production_mode_test.rb +271 -143
- data/test/integration/ministamp_development_mode_test.rb +66 -25
- data/test/integration/ministamp_production_mode_test.rb +129 -37
- data/test/integration/static_files_as_asset_sources_test.rb +10 -10
- data/test/support/assertions.rb +1 -1
- data/test/support/{static_file_api_config.rb → static_file_config.rb} +6 -3
- data/test/support/test_case.rb +7 -4
- data/test/unit/asset_bundle_test.rb +6 -6
- data/test/unit/asset_file_drop_test.rb +65 -0
- data/test/unit/asset_file_registry_test.rb +136 -98
- data/test/unit/asset_tag_markup_test.rb +11 -5
- data/test/unit/bundle_file_properties_test.rb +44 -23
- data/test/unit/bundle_file_writing_test.rb +50 -32
- data/test/unit/development_file_properties_test.rb +95 -0
- data/test/unit/development_file_writing_test.rb +15 -6
- data/test/unit/environment_test.rb +3 -3
- data/test/unit/files_test.rb +7 -7
- data/test/unit/hashes_test.rb +12 -12
- data/test/unit/jekyll_static_file_api_test.rb +91 -20
- data/test/unit/mini_bundle_block_test.rb +59 -9
- data/test/unit/mini_stamp_tag_test.rb +37 -6
- data/test/unit/stamp_file_properties_test.rb +47 -24
- data/test/unit/stamp_file_writing_test.rb +33 -24
- data/test/unit/variable_template_test.rb +121 -0
- metadata +27 -6
- data/test/unit/development_file_collection_properties_test.rb +0 -106
@@ -7,8 +7,8 @@ module Jekyll::Minibundle::Test
|
|
7
7
|
|
8
8
|
def test_asset_destination_path_has_no_stamp
|
9
9
|
with_precompiled_site(:development) do
|
10
|
-
assert_equal
|
11
|
-
assert
|
10
|
+
assert_equal(STAMP_DESTINATION_PATH, find_css_path_from_index)
|
11
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -16,7 +16,7 @@ module Jekyll::Minibundle::Test
|
|
16
16
|
with_precompiled_site(:development) do
|
17
17
|
source_contents = File.read(site_fixture_path(STAMP_SOURCE_PATH))
|
18
18
|
destination_contents = File.read(destination_path(STAMP_DESTINATION_PATH))
|
19
|
-
assert_equal
|
19
|
+
assert_equal(source_contents, destination_contents)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -30,7 +30,7 @@ module Jekyll::Minibundle::Test
|
|
30
30
|
generate_site(:development, clear_cache: false)
|
31
31
|
|
32
32
|
new_mtime = file_mtime_of(destination_path(STAMP_DESTINATION_PATH))
|
33
|
-
assert_operator
|
33
|
+
assert_operator(new_mtime, :>, org_mtime)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -44,7 +44,7 @@ module Jekyll::Minibundle::Test
|
|
44
44
|
generate_site(:development, clear_cache: false)
|
45
45
|
|
46
46
|
new_mtime = file_mtime_of(destination_path(STAMP_DESTINATION_PATH))
|
47
|
-
assert_operator
|
47
|
+
assert_operator(new_mtime, :>, org_mtime)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -68,7 +68,7 @@ module Jekyll::Minibundle::Test
|
|
68
68
|
|
69
69
|
new_mtime = file_mtime_of(destination_path(STAMP_DESTINATION_PATH))
|
70
70
|
|
71
|
-
assert_operator
|
71
|
+
assert_operator(new_mtime, :>, org_mtime)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -76,7 +76,7 @@ module Jekyll::Minibundle::Test
|
|
76
76
|
with_site_dir do
|
77
77
|
generate_site(:development)
|
78
78
|
|
79
|
-
assert
|
79
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
80
80
|
|
81
81
|
ensure_file_mtime_changes do
|
82
82
|
find_and_gsub_in_file(
|
@@ -88,12 +88,12 @@ module Jekyll::Minibundle::Test
|
|
88
88
|
|
89
89
|
generate_site(:development, clear_cache: false)
|
90
90
|
|
91
|
-
refute
|
91
|
+
refute(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
92
92
|
|
93
93
|
new_destination = 'assets/screen2.css'
|
94
94
|
|
95
|
-
assert_equal
|
96
|
-
assert
|
95
|
+
assert_equal(new_destination, find_css_path_from_index)
|
96
|
+
assert(File.file?(destination_path(new_destination)))
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -101,7 +101,7 @@ module Jekyll::Minibundle::Test
|
|
101
101
|
with_site_dir do
|
102
102
|
generate_site(:development)
|
103
103
|
|
104
|
-
assert
|
104
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
105
105
|
|
106
106
|
ensure_file_mtime_changes do
|
107
107
|
find_and_gsub_in_file(
|
@@ -113,12 +113,12 @@ module Jekyll::Minibundle::Test
|
|
113
113
|
|
114
114
|
generate_site(:development, clear_cache: false)
|
115
115
|
|
116
|
-
refute
|
116
|
+
refute(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
117
117
|
|
118
118
|
new_destination = 'assets/screen2.css'
|
119
119
|
|
120
|
-
assert_equal
|
121
|
-
assert
|
120
|
+
assert_equal(new_destination, find_css_path_from_index)
|
121
|
+
assert(File.file?(destination_path(new_destination)))
|
122
122
|
|
123
123
|
ensure_file_mtime_changes do
|
124
124
|
find_and_gsub_in_file(
|
@@ -130,10 +130,10 @@ module Jekyll::Minibundle::Test
|
|
130
130
|
|
131
131
|
generate_site(:development, clear_cache: false)
|
132
132
|
|
133
|
-
refute
|
133
|
+
refute(File.file?(destination_path(new_destination)))
|
134
134
|
|
135
|
-
assert_equal
|
136
|
-
assert
|
135
|
+
assert_equal(STAMP_DESTINATION_PATH, find_css_path_from_index)
|
136
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -144,8 +144,8 @@ module Jekyll::Minibundle::Test
|
|
144
144
|
destination = destination_path(STAMP_DESTINATION_PATH)
|
145
145
|
org_mtime = file_mtime_of(destination)
|
146
146
|
|
147
|
-
assert
|
148
|
-
assert_equal
|
147
|
+
assert(File.file?(destination))
|
148
|
+
assert_equal(STAMP_DESTINATION_PATH, find_css_path_from_index)
|
149
149
|
|
150
150
|
ensure_file_mtime_changes do
|
151
151
|
find_and_gsub_in_file(
|
@@ -157,13 +157,28 @@ module Jekyll::Minibundle::Test
|
|
157
157
|
|
158
158
|
generate_site(:development, clear_cache: false)
|
159
159
|
|
160
|
-
assert
|
161
|
-
assert_equal
|
162
|
-
assert_equal
|
160
|
+
assert(File.file?(destination))
|
161
|
+
assert_equal(org_mtime, file_mtime_of(destination))
|
162
|
+
assert_equal("/#{STAMP_DESTINATION_PATH}", find_css_path_from_index)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
def
|
166
|
+
def test_supports_yaml_hash_argument_with_render_basename_only_option
|
167
|
+
with_site_dir do
|
168
|
+
find_and_gsub_in_file(
|
169
|
+
source_path('_layouts/default.html'),
|
170
|
+
'{% ministamp _tmp/site.css assets/screen.css',
|
171
|
+
%({% ministamp { source_path: _tmp/site.css, destination_path: /assets/screen.css, render_basename_only: true })
|
172
|
+
)
|
173
|
+
|
174
|
+
generate_site(:development)
|
175
|
+
|
176
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_PATH)))
|
177
|
+
assert_equal('screen.css', find_css_path_from_index)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_does_not_rewrite_destination_when_changing_nonsource_files
|
167
182
|
with_site_dir do
|
168
183
|
generate_site(:development)
|
169
184
|
|
@@ -173,13 +188,39 @@ module Jekyll::Minibundle::Test
|
|
173
188
|
|
174
189
|
generate_site(:development, clear_cache: false)
|
175
190
|
|
176
|
-
assert_equal
|
191
|
+
assert_equal(org_mtime, file_mtime_of(expected_path))
|
177
192
|
|
178
193
|
ensure_file_mtime_changes { FileUtils.touch('index.html') }
|
179
194
|
|
180
195
|
generate_site(:development, clear_cache: false)
|
181
196
|
|
182
|
-
assert_equal
|
197
|
+
assert_equal(org_mtime, file_mtime_of(expected_path))
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_does_not_rewrite_destination_when_changing_render_basename_only_option
|
202
|
+
with_site_dir do
|
203
|
+
generate_site(:development)
|
204
|
+
|
205
|
+
destination = destination_path(STAMP_DESTINATION_PATH)
|
206
|
+
org_mtime = file_mtime_of(destination)
|
207
|
+
|
208
|
+
assert(File.file?(destination))
|
209
|
+
assert_equal(STAMP_DESTINATION_PATH, find_css_path_from_index)
|
210
|
+
|
211
|
+
ensure_file_mtime_changes do
|
212
|
+
find_and_gsub_in_file(
|
213
|
+
source_path('_layouts/default.html'),
|
214
|
+
'<link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">',
|
215
|
+
%(<link rel="stylesheet" href="{% ministamp { source_path: _tmp/site.css, destination_path: assets/screen.css, render_basename_only: true } %}" media="screen">)
|
216
|
+
)
|
217
|
+
end
|
218
|
+
|
219
|
+
generate_site(:development, clear_cache: false)
|
220
|
+
|
221
|
+
assert(File.file?(destination))
|
222
|
+
assert_equal(org_mtime, file_mtime_of(destination))
|
223
|
+
assert_equal('screen.css', find_css_path_from_index)
|
183
224
|
end
|
184
225
|
end
|
185
226
|
|
@@ -7,8 +7,8 @@ module Jekyll::Minibundle::Test
|
|
7
7
|
|
8
8
|
def test_asset_destination_path_has_stamp
|
9
9
|
with_precompiled_site(:production) do
|
10
|
-
assert_equal
|
11
|
-
assert
|
10
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
11
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -16,7 +16,7 @@ module Jekyll::Minibundle::Test
|
|
16
16
|
with_precompiled_site(:production) do
|
17
17
|
source_contents = File.read(site_fixture_path(STAMP_SOURCE_PATH))
|
18
18
|
destination_contents = File.read(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH))
|
19
|
-
assert_equal
|
19
|
+
assert_equal(source_contents, destination_contents)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -28,12 +28,12 @@ module Jekyll::Minibundle::Test
|
|
28
28
|
|
29
29
|
generate_site(:production, clear_cache: false)
|
30
30
|
|
31
|
-
refute
|
31
|
+
refute(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
32
32
|
|
33
33
|
new_destination = 'assets/screen-0f5dbd1e527a2bee267e85007b08d2a5.css'
|
34
34
|
|
35
|
-
assert_equal
|
36
|
-
assert
|
35
|
+
assert_equal(new_destination, find_css_path_from_index)
|
36
|
+
assert(File.file?(destination_path(new_destination)))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -45,10 +45,10 @@ module Jekyll::Minibundle::Test
|
|
45
45
|
ensure_file_mtime_changes { FileUtils.touch(source_path(STAMP_SOURCE_PATH)) }
|
46
46
|
generate_site(:production, clear_cache: false)
|
47
47
|
|
48
|
-
assert_equal
|
48
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
49
49
|
|
50
50
|
new_mtime = file_mtime_of(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH))
|
51
|
-
assert_operator
|
51
|
+
assert_operator(new_mtime, :>, org_mtime)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -72,7 +72,7 @@ module Jekyll::Minibundle::Test
|
|
72
72
|
|
73
73
|
new_mtime = file_mtime_of(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH))
|
74
74
|
|
75
|
-
assert_operator
|
75
|
+
assert_operator(new_mtime, :>, org_mtime)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -80,7 +80,7 @@ module Jekyll::Minibundle::Test
|
|
80
80
|
with_site_dir do
|
81
81
|
generate_site(:production)
|
82
82
|
|
83
|
-
assert
|
83
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
84
84
|
|
85
85
|
ensure_file_mtime_changes do
|
86
86
|
find_and_gsub_in_file(
|
@@ -92,12 +92,12 @@ module Jekyll::Minibundle::Test
|
|
92
92
|
|
93
93
|
generate_site(:production, clear_cache: false)
|
94
94
|
|
95
|
-
refute
|
95
|
+
refute(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
96
96
|
|
97
97
|
new_destination = "assets/screen2-#{STAMP_FINGERPRINT}.css"
|
98
98
|
|
99
|
-
assert_equal
|
100
|
-
assert
|
99
|
+
assert_equal(new_destination, find_css_path_from_index)
|
100
|
+
assert(File.file?(destination_path(new_destination)))
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -105,7 +105,7 @@ module Jekyll::Minibundle::Test
|
|
105
105
|
with_site_dir do
|
106
106
|
generate_site(:production)
|
107
107
|
|
108
|
-
assert
|
108
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
109
109
|
|
110
110
|
ensure_file_mtime_changes do
|
111
111
|
find_and_gsub_in_file(
|
@@ -117,12 +117,12 @@ module Jekyll::Minibundle::Test
|
|
117
117
|
|
118
118
|
generate_site(:production, clear_cache: false)
|
119
119
|
|
120
|
-
refute
|
120
|
+
refute(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
121
121
|
|
122
122
|
new_destination = "assets/screen2-#{STAMP_FINGERPRINT}.css"
|
123
123
|
|
124
|
-
assert_equal
|
125
|
-
assert
|
124
|
+
assert_equal(new_destination, find_css_path_from_index)
|
125
|
+
assert(File.file?(destination_path(new_destination)))
|
126
126
|
|
127
127
|
ensure_file_mtime_changes do
|
128
128
|
find_and_gsub_in_file(
|
@@ -134,10 +134,10 @@ module Jekyll::Minibundle::Test
|
|
134
134
|
|
135
135
|
generate_site(:production, clear_cache: false)
|
136
136
|
|
137
|
-
refute
|
137
|
+
refute(File.file?(destination_path(new_destination)))
|
138
138
|
|
139
|
-
assert_equal
|
140
|
-
assert
|
139
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
140
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -148,8 +148,8 @@ module Jekyll::Minibundle::Test
|
|
148
148
|
destination = destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)
|
149
149
|
org_mtime = file_mtime_of(destination)
|
150
150
|
|
151
|
-
assert
|
152
|
-
assert_equal
|
151
|
+
assert(File.file?(destination))
|
152
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
153
153
|
|
154
154
|
ensure_file_mtime_changes do
|
155
155
|
find_and_gsub_in_file(
|
@@ -161,9 +161,9 @@ module Jekyll::Minibundle::Test
|
|
161
161
|
|
162
162
|
generate_site(:production, clear_cache: false)
|
163
163
|
|
164
|
-
assert
|
165
|
-
assert_equal
|
166
|
-
assert_equal
|
164
|
+
assert(File.file?(destination))
|
165
|
+
assert_equal(org_mtime, file_mtime_of(destination))
|
166
|
+
assert_equal("/#{STAMP_DESTINATION_FINGERPRINT_PATH}", find_css_path_from_index)
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
@@ -180,16 +180,16 @@ module Jekyll::Minibundle::Test
|
|
180
180
|
destination = destination_path("screen-#{STAMP_FINGERPRINT}.css")
|
181
181
|
org_mtime = file_mtime_of(destination)
|
182
182
|
|
183
|
-
assert
|
184
|
-
assert_equal
|
183
|
+
assert(File.file?(destination))
|
184
|
+
assert_equal("screen-#{STAMP_FINGERPRINT}.css", find_css_path_from_index)
|
185
185
|
|
186
186
|
ensure_file_mtime_changes do
|
187
187
|
generate_site(:production, clear_cache: false)
|
188
188
|
end
|
189
189
|
|
190
|
-
assert
|
191
|
-
assert_equal
|
192
|
-
assert_equal
|
190
|
+
assert(File.file?(destination))
|
191
|
+
assert_equal(org_mtime, file_mtime_of(destination))
|
192
|
+
assert_equal("screen-#{STAMP_FINGERPRINT}.css", find_css_path_from_index)
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
@@ -206,16 +206,65 @@ module Jekyll::Minibundle::Test
|
|
206
206
|
destination = destination_path("screen-#{STAMP_FINGERPRINT}.css")
|
207
207
|
org_mtime = file_mtime_of(destination)
|
208
208
|
|
209
|
-
assert
|
210
|
-
assert_equal
|
209
|
+
assert(File.file?(destination))
|
210
|
+
assert_equal("screen-#{STAMP_FINGERPRINT}.css", find_css_path_from_index)
|
211
211
|
|
212
212
|
ensure_file_mtime_changes do
|
213
213
|
generate_site(:production, clear_cache: false)
|
214
214
|
end
|
215
215
|
|
216
|
-
assert
|
217
|
-
assert_equal
|
218
|
-
assert_equal
|
216
|
+
assert(File.file?(destination))
|
217
|
+
assert_equal(org_mtime, file_mtime_of(destination))
|
218
|
+
assert_equal("screen-#{STAMP_FINGERPRINT}.css", find_css_path_from_index)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_supports_yaml_hash_argument_with_source_and_destination_paths
|
223
|
+
with_site_dir do
|
224
|
+
find_and_gsub_in_file(
|
225
|
+
source_path('_layouts/default.html'),
|
226
|
+
'<link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">',
|
227
|
+
%(<link rel="stylesheet" href="{% ministamp { source_path: _tmp/site.css, destination_path: assets/screen.css } %}" media="screen">)
|
228
|
+
)
|
229
|
+
|
230
|
+
generate_site(:production)
|
231
|
+
|
232
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
233
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_supports_yaml_hash_argument_with_source_and_destination_paths_with_liquid_variables
|
238
|
+
with_site_dir do
|
239
|
+
find_and_gsub_in_file(
|
240
|
+
source_path('_layouts/default.html'),
|
241
|
+
' <link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">',
|
242
|
+
<<-END
|
243
|
+
{% assign stamp_source_filename = 'site' %}
|
244
|
+
{% assign stamp_destination_url = 'assets/screen.css' %}
|
245
|
+
<link rel="stylesheet" href="{% ministamp { source_path: '_tmp/{{ stamp_source_filename }}.css', destination_path: '{{ stamp_destination_url }}' } %}" media="screen">
|
246
|
+
END
|
247
|
+
)
|
248
|
+
|
249
|
+
generate_site(:production)
|
250
|
+
|
251
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
252
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_supports_yaml_hash_argument_with_render_basename_only_option
|
257
|
+
with_site_dir do
|
258
|
+
find_and_gsub_in_file(
|
259
|
+
source_path('_layouts/default.html'),
|
260
|
+
'{% ministamp _tmp/site.css assets/screen.css',
|
261
|
+
%({% ministamp { source_path: _tmp/site.css, destination_path: /assets/screen.css, render_basename_only: true })
|
262
|
+
)
|
263
|
+
|
264
|
+
generate_site(:production)
|
265
|
+
|
266
|
+
assert(File.file?(destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)))
|
267
|
+
assert_equal("screen-#{STAMP_FINGERPRINT}.css", find_css_path_from_index)
|
219
268
|
end
|
220
269
|
end
|
221
270
|
|
@@ -229,13 +278,56 @@ module Jekyll::Minibundle::Test
|
|
229
278
|
|
230
279
|
generate_site(:production, clear_cache: false)
|
231
280
|
|
232
|
-
assert_equal
|
281
|
+
assert_equal(org_mtime, file_mtime_of(expected_path))
|
233
282
|
|
234
283
|
ensure_file_mtime_changes { FileUtils.touch('index.html') }
|
235
284
|
|
236
285
|
generate_site(:production, clear_cache: false)
|
237
286
|
|
238
|
-
assert_equal
|
287
|
+
assert_equal(org_mtime, file_mtime_of(expected_path))
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_does_not_rewrite_destination_when_changing_render_basename_only_option
|
292
|
+
with_site_dir do
|
293
|
+
generate_site(:production)
|
294
|
+
|
295
|
+
destination = destination_path(STAMP_DESTINATION_FINGERPRINT_PATH)
|
296
|
+
org_mtime = file_mtime_of(destination)
|
297
|
+
|
298
|
+
assert(File.file?(destination))
|
299
|
+
assert_equal(STAMP_DESTINATION_FINGERPRINT_PATH, find_css_path_from_index)
|
300
|
+
|
301
|
+
ensure_file_mtime_changes do
|
302
|
+
find_and_gsub_in_file(
|
303
|
+
source_path('_layouts/default.html'),
|
304
|
+
'<link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">',
|
305
|
+
%(<link rel="stylesheet" href="{% ministamp { source_path: _tmp/site.css, destination_path: assets/screen.css, render_basename_only: true } %}" media="screen">)
|
306
|
+
)
|
307
|
+
end
|
308
|
+
|
309
|
+
generate_site(:production, clear_cache: false)
|
310
|
+
|
311
|
+
assert(File.file?(destination))
|
312
|
+
assert_equal(org_mtime, file_mtime_of(destination))
|
313
|
+
assert_equal("screen-#{STAMP_FINGERPRINT}.css", find_css_path_from_index)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_escapes_generated_url
|
318
|
+
with_site_dir do
|
319
|
+
find_and_gsub_in_file(
|
320
|
+
source_path('_layouts/default.html'),
|
321
|
+
'{% ministamp _tmp/site.css assets/screen.css %}',
|
322
|
+
%({% ministamp { source_path: '_tmp/site.css', destination_path: 'scre">en.css' } %})
|
323
|
+
)
|
324
|
+
|
325
|
+
generate_site(:production)
|
326
|
+
|
327
|
+
filename = %(scre">en-#{STAMP_FINGERPRINT}.css)
|
328
|
+
|
329
|
+
assert(File.file?(destination_path(filename)))
|
330
|
+
assert_equal(filename, find_css_path_from_index)
|
239
331
|
end
|
240
332
|
end
|
241
333
|
|