Skip to content

Commit

Permalink
Fix: only copy assets if folder doesn't exist
Browse files Browse the repository at this point in the history
And delete _firn properly when running repl tests.
  • Loading branch information
teesloane committed Mar 28, 2020
1 parent 62b693d commit ec5d679
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/firn/build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[firn.util :as u])
(:gen-class))

(defn- prepare-config
(defn prepare-config
"Takes a path to files (or CWD) and makes a config with it."
[{:keys [path]}]
(let [path (if (empty? path) (.getPath fs/*cwd*) path)
Expand Down Expand Up @@ -63,8 +63,11 @@
org-files (u/find-files-by-ext files-dir "org") ;; could bail if this is empty...
layouts-map (u/file-list->key-file-map layout-files)]

(fs/mkdir (config :out-dirname))
(fs/copy-dir (config :media-dir) (config :out-media-dir))
(fs/mkdir (config :out-dirname)) ;; make _site

(when-not (fs/exists? (config :out-media-dir))
(fs/copy-dir (config :media-dir) (config :out-media-dir)))

(assoc
config :org-files org-files :layouts layouts-map :partials partials-map)))

Expand Down
9 changes: 5 additions & 4 deletions test/firn/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@

(defn main-runner
[dir-to-build]
(fs/delete-dir (config-sample :firn-dir))
(build/all-files {:path dir-to-build}))
(let [config (build/prepare-config {:path dir-to-build})]
(fs/delete-dir (config :firn-dir))
(build/all-files {:path dir-to-build})))

(main-runner wiki-dir)
(main-runner test-dir)
;; (main-runner test-dir)

(build/new-site {:path test-dir})
;; (build/new-site {:path test-dir})


;; (def sample
Expand Down

0 comments on commit ec5d679

Please sign in to comment.