Created
June 3, 2016 21:13
-
-
Save SevereOverfl0w/0a99ad1b84d7a998d98a643d95646eaf to your computer and use it in GitHub Desktop.
Boot, Asciidoctor, Blogging, Spec
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
(set-env! :dependencies '[[adzerk/boot-test "1.1.0"] | |
[im.chit/hara.event "2.2.17"] | |
[im.chit/hara.time "2.2.17"] | |
[org.asciidoctor/asciidoctorj "1.5.4"]] | |
:source-paths #{"test" "src"}) | |
(require '[adzerk.boot-test :refer :all]) | |
(require '[boot.util :refer [dosh]]) | |
(require '[clojure.java.io :as io]) | |
(require '[hara.time :as t]) | |
(defn convert-files | |
[doctor output files] | |
(let [opts (-> (org.asciidoctor.OptionsBuilder/options) | |
(.toDir output) | |
(.baseDir (io/file "")) | |
(.safe org.asciidoctor.SafeMode/UNSAFE) | |
(.mkDirs true) | |
(.get))] | |
(.convertFiles doctor files opts))) | |
(deftask asciidoc | |
[] | |
(let [output-dir (tmp-dir!) | |
doctor (org.asciidoctor.Asciidoctor$Factory/create)] | |
(with-pre-wrap fs | |
(let [output-files | |
(->> fs | |
input-files | |
(by-ext [".ad" ".asciidoc" ".adoc"]) | |
(map tmp-file) | |
(convert-files doctor output-dir))] | |
(println "Compiling asciidoc...") | |
(-> fs | |
(add-resource output-dir) | |
commit!))))) | |
(deftask dev | |
[] | |
(comp | |
(watch) | |
;; (speak) | |
(asciidoc) | |
(test) | |
(target))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment