Skip to content

Commit

Permalink
Fix: new-site can now run in cwd
Browse files Browse the repository at this point in the history
was relying on dir-files key to exist.
  • Loading branch information
teesloane committed May 10, 2020
1 parent 4a018ba commit 96c50bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clojure/src/firn/build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
"Creates the folders needed for a new site in your wiki directory.
Copies the _firn_starter from resources, into where you are running the cmd."
[{:keys [dir-files]}]
(let [dir-firn (config/make-dir-firn dir-files)
(let [dir-files (if (empty? dir-files) (u/get-cwd) dir-files)
dir-firn (config/make-dir-firn dir-files)
base-dir "firn/_firn_starter/"
read-files (map #(hash-map :contents (slurp (io/resource (str base-dir %)))
:out-name (str dir-firn "/" %)) default-files)]
(if (fs/exists? dir-firn)
(do
(println "A _firn directory already exists.")
false)
(u/print-err! :error "A _firn directory already exists.")
(do (fs/mkdir dir-firn)
(doseq [f read-files]
(io/make-parents (:out-name f))
Expand Down Expand Up @@ -75,3 +74,4 @@
(->> config
file/process-all
write-files)))

0 comments on commit 96c50bb

Please sign in to comment.