|
40 | 40 | (io.perun.print-meta/print-meta ~(vec (map map-fn (perun/get-meta fileset)))))) |
41 | 41 | fileset)) |
42 | 42 |
|
| 43 | +(defn trace |
| 44 | + "Helper function, conj `kw` onto the `:io.perun/trace` metadata |
| 45 | + key of each entry in `entries`" |
| 46 | + [kw entries] |
| 47 | + (map #(update-in % [:io.perun/trace] (fnil conj []) kw) entries)) |
| 48 | + |
43 | 49 | (def ^:private filedata-deps |
44 | 50 | '[[com.novemberain/pantomime "2.8.0"]]) |
45 | 51 |
|
|
55 | 61 | establish metadata structure." |
56 | 62 | [] |
57 | 63 | (boot/with-pre-wrap fileset |
58 | | - (let [updated-files (add-filedata (boot/user-files fileset))] |
| 64 | + (let [updated-files (->> fileset |
| 65 | + boot/user-files |
| 66 | + add-filedata |
| 67 | + (trace :io.perun/base))] |
59 | 68 | (perun/set-meta fileset updated-files)))) |
60 | 69 |
|
61 | 70 | (def ^:private images-dimensions-deps |
|
71 | 80 | files (->> fileset |
72 | 81 | boot/user-files |
73 | 82 | (boot/by-ext ["png" "jpeg" "jpg"]) |
74 | | - add-filedata) |
| 83 | + add-filedata |
| 84 | + (trace :io.perun/images-dimensions)) |
75 | 85 | updated-files (pod/with-call-in @pod |
76 | 86 | (io.perun.contrib.images-dimensions/images-dimensions ~files {}))] |
77 | 87 | (perun/set-meta fileset updated-files)))) |
|
96 | 106 | files (->> fileset |
97 | 107 | boot/user-files |
98 | 108 | (boot/by-ext ["png" "jpeg" "jpg"]) |
99 | | - add-filedata) |
| 109 | + add-filedata |
| 110 | + (trace :io.perun/images-resize)) |
100 | 111 | updated-files (pod/with-call-in @pod |
101 | 112 | (io.perun.contrib.images-resize/images-resize ~(.getPath tmp) ~files ~options))] |
102 | 113 | (perun/report-debug "images-resize" "new resized images" updated-files) |
|
132 | 143 | updated-files (pod/with-call-in @pod |
133 | 144 | (io.perun.markdown/parse-markdown ~md-files ~options)) |
134 | 145 | initial-metadata (perun/merge-meta* (perun/get-meta fileset) @prev-meta) |
135 | | - ; Pure merge instead of `merge-with merge` (meta-meta). |
136 | | - ; This is because updated metadata should replace previous metadata to |
137 | | - ; correctly handle cases where a metadata key is removed from post metadata. |
138 | | - final-metadata (vals (merge (perun/key-meta initial-metadata) (perun/key-meta updated-files))) |
139 | | - final-metadata (remove #(-> % :path removed?) final-metadata)] |
| 146 | + final-metadata (->> updated-files |
| 147 | + perun/key-meta |
| 148 | + ; Pure merge instead of `merge-with merge` (meta-meta). |
| 149 | + ; This is because updated metadata should replace previous metadata to |
| 150 | + ; correctly handle cases where a metadata key is removed from post metadata. |
| 151 | + (merge (perun/key-meta initial-metadata)) |
| 152 | + vals |
| 153 | + (remove #(-> % :path removed?)) |
| 154 | + (trace :io.perun/markdown))] |
140 | 155 | (reset! prev-fs fileset) |
141 | 156 | (reset! prev-meta final-metadata) |
142 | 157 | (perun/set-meta fileset final-metadata))))) |
|
174 | 189 | options (merge +ttr-defaults+ *opts*)] |
175 | 190 | (boot/with-pre-wrap fileset |
176 | 191 | (let [files (filter (:filterer options) (perun/get-meta fileset)) |
177 | | - updated-files (pod/with-call-in @pod |
178 | | - (io.perun.ttr/calculate-ttr ~files))] |
| 192 | + updated-files (trace :io.perun/ttr |
| 193 | + (pod/with-call-in @pod |
| 194 | + (io.perun.ttr/calculate-ttr ~files)))] |
179 | 195 | (perun/report-debug "ttr" "generated time-to-read" (map :ttr updated-files)) |
180 | 196 | (perun/set-meta fileset updated-files))))) |
181 | 197 |
|
|
189 | 205 | options (merge +word-count-defaults+ *opts*)] |
190 | 206 | (boot/with-pre-wrap fileset |
191 | 207 | (let [files (filter (:filterer options) (perun/get-meta fileset)) |
192 | | - updated-files (pod/with-call-in @pod |
193 | | - (io.perun.word-count/count-words ~files))] |
| 208 | + updated-files (trace :io.perun/word-count |
| 209 | + (pod/with-call-in @pod |
| 210 | + (io.perun.word-count/count-words ~files)))] |
194 | 211 | (perun/report-debug "word-count" "counted words" (map :word-count updated-files)) |
195 | 212 | (perun/set-meta fileset updated-files))))) |
196 | 213 |
|
|
209 | 226 | options (merge +gravatar-defaults+ *opts*)] |
210 | 227 | (boot/with-pre-wrap fileset |
211 | 228 | (let [files (filter (:filterer options) (perun/get-meta fileset)) |
212 | | - updated-files (pod/with-call-in @pod |
213 | | - (io.perun.gravatar/find-gravatar ~files ~source-key ~target-key))] |
| 229 | + updated-files (trace :io.perun/gravatar |
| 230 | + (pod/with-call-in @pod |
| 231 | + (io.perun.gravatar/find-gravatar ~files ~source-key ~target-key)))] |
214 | 232 | (perun/report-debug "gravatar" "found gravatars" (map target-key updated-files)) |
215 | 233 | (perun/set-meta fileset updated-files))))) |
216 | 234 |
|
|
220 | 238 | [] |
221 | 239 | (boot/with-pre-wrap fileset |
222 | 240 | (let [files (perun/get-meta fileset) |
223 | | - updated-files (remove #(true? (:draft %)) files)] |
| 241 | + updated-files (->> files |
| 242 | + (remove #(true? (:draft %))) |
| 243 | + (trace :io.perun/draft))] |
224 | 244 | (perun/report-info "draft" "removed draft files. Remaining %s files" (count updated-files)) |
225 | 245 | (perun/set-meta fileset updated-files)))) |
226 | 246 |
|
|
235 | 255 | files (filter (:filterer options) (perun/get-meta fileset)) |
236 | 256 | global-meta (perun/get-global-meta fileset) |
237 | 257 | now (java.util.Date.) |
238 | | - updated-files (map #(assoc % :date-build now) files) |
| 258 | + updated-files (->> files |
| 259 | + (map #(assoc % :date-build now)) |
| 260 | + (trace :io.perun/build-date)) |
239 | 261 | new-global-meta (assoc global-meta :date-build now) |
240 | 262 | updated-fs (perun/set-meta fileset updated-files)] |
241 | 263 | (perun/report-debug "build-date" "added :date-build" (map :date-build updated-files)) |
|
260 | 282 | (let [options (merge +slug-defaults+ *opts*) |
261 | 283 | slug-fn (:slug-fn options) |
262 | 284 | files (filter (:filterer options) (perun/get-meta fileset)) |
263 | | - updated-files (map #(assoc % :slug (-> % :filename slug-fn)) files)] |
| 285 | + updated-files (->> files |
| 286 | + (map #(assoc % :slug (-> % :filename slug-fn))) |
| 287 | + (trace :io.perun/slug))] |
264 | 288 | (perun/report-debug "slug" "generated slugs" (map :slug updated-files)) |
265 | 289 | (perun/report-info "slug" "added slugs to %s files" (count updated-files)) |
266 | 290 | (perun/set-meta fileset updated-files)))) |
|
279 | 303 | (let [options (merge +permalink-defaults+ *opts*) |
280 | 304 | files (filter (:filterer options) (perun/get-meta fileset)) |
281 | 305 | assoc-perma #(assoc % :permalink ((:permalink-fn options) %)) |
282 | | - updated-files (map assoc-perma files)] |
| 306 | + updated-files (->> files |
| 307 | + (map assoc-perma) |
| 308 | + (trace :io.perun/permalink))] |
283 | 309 | (perun/report-debug "permalink" "generated permalinks" (map :permalink updated-files)) |
284 | 310 | (perun/report-info "permalink" "added permalinks to %s files" (count updated-files)) |
285 | 311 | (perun/merge-meta fileset updated-files)))) |
|
302 | 328 | :canonical-url |
303 | 329 | ; we need to call perun/relativize-url to remove leading / because base-url has trailing / |
304 | 330 | (str base-url (perun/relativize-url (:permalink %)))) |
305 | | - updated-files (map assoc-can-url files)] |
| 331 | + updated-files (->> files |
| 332 | + (map assoc-can-url) |
| 333 | + (trace :io.perun/canonical-url))] |
306 | 334 | (perun/report-info "canonical-url" "added canonical urls to %s files" (count updated-files)) |
307 | 335 | (perun/merge-meta fileset updated-files)))) |
308 | 336 |
|
|
514 | 542 | (perun/report-info "collection" "rendered collection %s" page) |
515 | 543 | new-entry))) |
516 | 544 | grouped-files)) |
517 | | - updated-files (apply conj files new-files) |
| 545 | + updated-files (apply conj files (trace :io.perun/collection new-files)) |
518 | 546 | updated-fileset (perun/set-meta fileset updated-files)] |
519 | 547 | (commit updated-fileset tmp)))))) |
520 | 548 |
|
|
0 commit comments