Debian Codegraph @

testscripts/commands/hugo__clean_destination_dir.txt

raw
1
2 # --- Scenario 1: Without static directory ---
3
4 cpr golden_public public
5
6 hugo
7 tree public
8 cmp stdout no_static_default_build.txt
9
10 hugo --cleanDestinationDir
11 tree public
12 cmp stdout no_static_clean_build.txt
13
14 # --- Scenario 2: With static directory ---
15
16 rm public
17
18 cpr golden_public public
19 cpr golden_static static
20
21 hugo
22 tree public
23 cmp stdout with_static_default_build.txt
24
25 hugo --cleanDestinationDir
26 tree public
27 cmp stdout with_static_clean_build.txt
28
29 # --- Scenario 3: Type mismatch between destination and static ---
30
31 rm public static
32
33 cpr golden_public_mismatch public
34 cpr golden_static_mismatch static
35
36 hugo --cleanDestinationDir
37 tree public
38 cmp stdout mismatch_clean_build.txt
39
40 # --- Scenario 4: Custom keepFiles and keepDirs ---
41
42 rm public static
43
44 cpr golden_public_keep public
45
46 hugo --config hugo_keep.toml
47 tree public
48 cmp stdout keep_clean_build.txt
49
50 # --- Scenario 5: Negated keepFiles ---
51
52 rm public
53
54 cpr golden_public_keep public
55
56 hugo --config hugo_keep_negate.toml
57 tree public
58 cmp stdout keep_negate_clean_build.txt
59
60 # --- Scenario 6: Deprecated root cleanDestinationDir key with default keep patterns ---
61
62 rm public
63
64 cpr golden_public_keep public
65
66 hugo --config hugo_legacy.toml
67 tree public
68 cmp stdout legacy_clean_build.txt
69
70 # Files
71
72 -- hugo.toml --
73 disableKinds = ['page','rss','section','sitemap','taxonomy','term']
74 -- hugo_keep.toml --
75 disableKinds = ['page','rss','section','sitemap','taxonomy','term']
76 [build.cleanDestinationDir]
77 enable = true
78 keepFiles = ['.domains', '_redirects']
79 keepDirs = ['keep-me']
80 -- hugo_keep_negate.toml --
81 disableKinds = ['page','rss','section','sitemap','taxonomy','term']
82 # Render home as JSON so no HTML gets rendered.
83 [outputs]
84 home = ['json']
85 [build.cleanDestinationDir]
86 enable = true
87 # Remove all HTML files, keep everything else.
88 keepFiles = ['! **.html']
89 -- hugo_legacy.toml --
90 disableKinds = ['page','rss','section','sitemap','taxonomy','term']
91 cleanDestinationDir = true
92 -- content/_index.md --
93 ---
94 title: home
95 ---
96 -- layouts/home.html --
97 {{ .Title }}
98 -- layouts/home.json --
99 {{ .Title | jsonify }}
100
101 -- golden_public/.dir-a/a.txt --
102 -- golden_public/.b.txt --
103 -- golden_public/.git --
104 -- golden_public/.gitattributes --
105 -- golden_public/.gitignore --
106 -- golden_public/c.txt --
107 -- golden_public/dir-b/.dir-c/d.txt --
108 -- golden_public/dir-b/.e.txt --
109 -- golden_public/dir-b/.git --
110 -- golden_public/dir-b/.gitignore --
111 -- golden_public/dir-b/f.txt --
112 -- golden_public/dir-d/g.txt --
113 -- golden_public/dir-e/.dir-f/h.txt --
114 -- golden_public/dir-e/.i.txt --
115 -- golden_public/dir-e/.gitattributes --
116 -- golden_public/dir-e/j.txt --
117
118 -- golden_static/.k.txt --
119 -- golden_static/l.txt --
120 -- golden_static/dir-e/.m.txt --
121 -- golden_static/dir-e/n.txt --
122
123 -- golden_public_keep/.domains --
124 -- golden_public_keep/.gitignore --
125 -- golden_public_keep/.hidden/x.txt --
126 -- golden_public_keep/_redirects --
127 -- golden_public_keep/a.html --
128 -- golden_public_keep/b.txt --
129 -- golden_public_keep/dir/.domains --
130 -- golden_public_keep/keep-me/x.html --
131 -- golden_public_keep/keep-me/y.txt --
132
133 -- golden_public_mismatch/type-a/x.txt --
134 -- golden_public_mismatch/type-b --
135
136 -- golden_static_mismatch/type-a --
137 -- golden_static_mismatch/type-b/y.txt --
138
139 -- no_static_default_build.txt --
140 .
141 └─.b.txt
142 └─.dir-a/
143 └─a.txt
144 └─.git
145 └─.gitattributes
146 └─.gitignore
147 └─c.txt
148 └─dir-b/
149 └─.dir-c/
150 └─d.txt
151 └─.e.txt
152 └─.git
153 └─.gitignore
154 └─f.txt
155 └─dir-d/
156 └─g.txt
157 └─dir-e/
158 └─.dir-f/
159 └─h.txt
160 └─.gitattributes
161 └─.i.txt
162 └─j.txt
163 └─index.html
164 -- no_static_clean_build.txt --
165 .
166 └─.dir-a/
167 └─a.txt
168 └─.git
169 └─.gitattributes
170 └─.gitignore
171 └─dir-b/
172 └─.dir-c/
173 └─d.txt
174 └─.git
175 └─.gitignore
176 └─dir-e/
177 └─.dir-f/
178 └─h.txt
179 └─.gitattributes
180 └─index.html
181 -- with_static_default_build.txt --
182 .
183 └─.b.txt
184 └─.dir-a/
185 └─a.txt
186 └─.git
187 └─.gitattributes
188 └─.gitignore
189 └─.k.txt
190 └─c.txt
191 └─dir-b/
192 └─.dir-c/
193 └─d.txt
194 └─.e.txt
195 └─.git
196 └─.gitignore
197 └─f.txt
198 └─dir-d/
199 └─g.txt
200 └─dir-e/
201 └─.dir-f/
202 └─h.txt
203 └─.gitattributes
204 └─.i.txt
205 └─.m.txt
206 └─j.txt
207 └─n.txt
208 └─index.html
209 └─l.txt
210 -- with_static_clean_build.txt --
211 .
212 └─.dir-a/
213 └─a.txt
214 └─.git
215 └─.gitattributes
216 └─.gitignore
217 └─.k.txt
218 └─dir-b/
219 └─.dir-c/
220 └─d.txt
221 └─.git
222 └─.gitignore
223 └─dir-e/
224 └─.dir-f/
225 └─h.txt
226 └─.gitattributes
227 └─.m.txt
228 └─n.txt
229 └─index.html
230 └─l.txt
231 -- mismatch_clean_build.txt --
232 .
233 └─index.html
234 └─type-a
235 └─type-b/
236 └─y.txt
237 -- keep_clean_build.txt --
238 .
239 └─.domains
240 └─_redirects
241 └─index.html
242 └─keep-me/
243 └─x.html
244 └─y.txt
245 -- keep_negate_clean_build.txt --
246 .
247 └─.domains
248 └─.gitignore
249 └─.hidden/
250 └─x.txt
251 └─_redirects
252 └─b.txt
253 └─dir/
254 └─.domains
255 └─index.json
256 └─keep-me/
257 └─y.txt
258 -- legacy_clean_build.txt --
259 .
260 └─.gitignore
261 └─.hidden/
262 └─x.txt
263 └─index.html