"Mob Session DONE [ci-skip]"

This commit is contained in:
jem 2019-12-06 15:34:41 +01:00
parent bbfc535c3b
commit 8b0ac5e800
2 changed files with 17 additions and 14 deletions

View file

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

View file

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