"Mob Session DONE [ci-skip]"

master
jem 5 years ago
parent bbfc535c3b
commit 8b0ac5e800

@ -30,29 +30,30 @@
(defn copy-dir (defn copy-dir
[source-dir target-path ignore-patterns] [source-dir target-file ignore-patterns]
(let [source-list (.list source-dir)] (let [source-list (.list source-dir)]
(io/make-parents target-file)
(doseq [f source-list] (doseq [f source-list]
(io/copy f (io/file target-path)))) (io/copy f target-file))))
)
(defn copy-resources (defn copy-resources
[fs-prefix source-path target-path ignore-patterns] [fs-prefix source-path target-path ignore-patterns]
(let [file (file-from-cp-or-filesystem fs-prefix source-path) (let [source-file (file-from-cp-or-filesystem fs-prefix source-path)
is-dir? (.isDirectory file)] target-file (io/file target-path source-path)
is-source-dir? (.isDirectory source-file)]
(cond (cond
(nil? file) (nil? source-file)
(throw (IllegalArgumentException. (str "resource " source-path " not found"))) (throw (IllegalArgumentException. (str "resource " source-path " not found")))
is-dir? is-source-dir?
(copy-dir file target-path ignore-patterns) (copy-dir source-file target-file ignore-patterns)
:else :else
nil nil
;(fs/copy src target) ;(fs/copy src target)
))) )))
(defn copy-resources-from-theme (defn copy-resources-from-theme
[theme target] [fs-prefix theme target]
(let [source-path (str "templates/themes/" theme "/js") (let [source-path (str "templates/themes/" theme "/js")
target-path (str target "/js")] target-path (str target "/js")]
copy-resources source-path target-path)) (copy-resources fs-prefix source-path target-path "")))

@ -29,6 +29,8 @@
(deftest test-copy-resources-from-theme (deftest test-copy-resources-from-theme
(is (do (is (do
(sut/copy-resources-from-theme theme target) (sut/copy-resources-from-theme "./" theme target)
(and (verify-dir-exists (str target "/js")) (and (verify-dir-exists
(verify-file-exists (str target "/js/dummy.js")))))) (str target "/templates/themes/bootstrap4-test/js"))
(verify-file-exists
(str target "/templates/themes/bootstrap4-test/js/dummy.js"))))))
Loading…
Cancel
Save