-
-
Save micha/085e94c09376ee52bc97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(boot/deftask yaml-to-json | |
"Convert YAML file to JSON." | |
[] | |
(let [tmp (boot/tmp-dir!)] | |
(comp (boot/with-pre-wrap fileset | |
(doseq [f (->> fileset boot/input-files)] | |
(let [in-file (tmpd/file f) | |
in-path (tmpd/path f) | |
out-path (change-file-ext in-path "json") | |
out-file (io/file tmp out-path) | |
result (yaml/parse-string (slurp in-file))] | |
(doto out-file | |
io/make-parents | |
(spit out-path))) | |
(-> fileset (boot/add-resource tmp) boot/commit!)) | |
(tasks/sift :to-source #{ #"\.yaml$" })))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment