diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index 3f3d015..8c8d1de 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -30,11 +30,16 @@ (defn copy-dir - [source-dir target-file ignore-patterns] + [source-dir target-dir ignore-patterns] (let [source-list (.list source-dir)] - (io/make-parents target-file) (doseq [f source-list] - (io/copy f target-file)))) + (let [target-file (io/file target-dir f) + source-file (io/file source-dir f)] + (if (.isDirectory source-file) + (copy-dir source-file target-file ignore-patterns) + (do + (io/make-parents target-file) + (io/copy f target-file))))))) (defn copy-resources [fs-prefix source-path target-path ignore-patterns] @@ -52,8 +57,7 @@ ))) (defn copy-resources-from-theme - [fs-prefix theme target] - (let [source-path (str "templates/themes/" theme "/js") - target-path (str target "/js")] + [fs-prefix theme target-path] + (let [source-path (str "templates/themes/" theme "/js")] (copy-resources fs-prefix source-path target-path ""))) diff --git a/test-resources/templates/themes/bootstrap4-test/js/subdir/subdummy.js b/test-resources/templates/themes/bootstrap4-test/js/subdir/subdummy.js new file mode 100644 index 0000000..e69de29 diff --git a/test/cryogen_core/classpath_able_io_test.clj b/test/cryogen_core/classpath_able_io_test.clj index 07af03f..0e12146 100644 --- a/test/cryogen_core/classpath_able_io_test.clj +++ b/test/cryogen_core/classpath_able_io_test.clj @@ -30,7 +30,12 @@ (deftest test-copy-resources-from-theme (is (do (sut/copy-resources-from-theme "./" theme target) - (and (verify-dir-exists + (and (verify-dir-exists (str target "/templates/themes/bootstrap4-test/js")) - (verify-file-exists - (str target "/templates/themes/bootstrap4-test/js/dummy.js")))))) \ No newline at end of file + (verify-file-exists + (str target "/templates/themes/bootstrap4-test/js/dummy.js")) + (verify-dir-exists + (str target "/templates/themes/bootstrap4-test/js/subdir")) + (verify-file-exists + (str target "/templates/themes/bootstrap4-test/js/subdir/subdummy.js")) + )))) \ No newline at end of file