From 52fdd2cdbe45668692fab7b7097058ea5a5435c9 Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Fri, 14 Feb 2020 15:27:23 +0100 Subject: [PATCH] mob wip --- src/cryogen_core/classpath_able_io.clj | 7 ++- test/cryogen_core/classpath_able_io_test.clj | 11 ++-- test/cryogen_core/new_io_test.clj | 59 ++++++++++---------- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index 227ab6e..bf30c07 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -230,9 +230,10 @@ virtual-path [""] :from-cp false))] - (doseq [resource-path resource-paths] - (Files/delete (fs/absolut-path virtual-path resource-path)) - ))) + (do + (println resource-paths) + (doseq [resource-path resource-paths] + (Files/delete (fs/absolut-path virtual-path resource-path)))))) ; TODO: add ignore patterns filtering (defn copy-resources! diff --git a/test/cryogen_core/classpath_able_io_test.clj b/test/cryogen_core/classpath_able_io_test.clj index f3e4b19..45422f4 100644 --- a/test/cryogen_core/classpath_able_io_test.clj +++ b/test/cryogen_core/classpath_able_io_test.clj @@ -17,8 +17,6 @@ (def theme "bootstrap4-test") -(def target "target/tmp") - (deftest test-get-resources-recursive (is (= [] @@ -83,7 +81,8 @@ (deftest test-delete-resource-recursive! (is - (do - (.mkdir (io/file target)) - (sut/delete-resource-recursive! target) - (not (ftt/verify-dir-exists target))))) + (let [target-tmp "target/tmp3"] + (.mkdir (io/file target-tmp)) + (.createNewFile (io/file (str target-tmp "/file-tmp"))) + (sut/delete-resource-recursive! target-tmp) + (not (ftt/verify-dir-exists target-tmp))))) diff --git a/test/cryogen_core/new_io_test.clj b/test/cryogen_core/new_io_test.clj index a8e7122..da7533a 100644 --- a/test/cryogen_core/new_io_test.clj +++ b/test/cryogen_core/new_io_test.clj @@ -31,32 +31,35 @@ "")))))) (deftest test-create-dirs-from-markup-folders! - (is (do - (sut/delete-resource-recursive! (str target "2")) - (sut/create-dirs-from-markup-folders! - "./not-existing-get-from-cp" - "test_posts" - "test_pages" - (str target "2") "") - (and (ftt/verify-dir-exists - (str (str target "2") "/test_pages")) - (ftt/verify-dir-exists - (str (str target "2") "/test_posts")) - (ftt/verify-dir-exists - (str (str target "2") "/test_pages/home")))))) + (is + (let [target-tmp "target/tmp-test-create-dirs-from-markup-folders"] + (sut/delete-resource-recursive! target-tmp) + (sut/create-dirs-from-markup-folders! + "./not-existing-get-from-cp" + "test_posts" + "test_pages" + target-tmp "") + (and (ftt/verify-dir-exists + (str target-tmp "/test_pages")) + (ftt/verify-dir-exists + (str target-tmp "/test_posts")) + (ftt/verify-dir-exists + (str target-tmp "/test_pages/home")))))) -(deftest test-copy-resources-from-theme! (is (do - (sut/delete-resource-recursive! target) - (sut/copy-resources-from-theme! "./" theme target "") - (and (ftt/verify-dir-exists - (str target "/js")) - (ftt/verify-file-exists - (str target "/js/dummy.js")) - (ftt/verify-dir-exists - (str target "/js/subdir")) - (ftt/verify-file-exists - (str target "/js/subdir/subdummy.js")) - (ftt/verify-file-exists - (str target "/css/dummy.css")) - (ftt/verify-file-exists - (str target "/404.html")))))) +(deftest test-copy-resources-from-theme! + (is + (let [target-tmp "target/tmp-test-copy-resources-from-theme"] + (sut/delete-resource-recursive! target-tmp) + (sut/copy-resources-from-theme! "./" theme target-tmp "") + (and (ftt/verify-dir-exists + (str target-tmp "/js")) + (ftt/verify-file-exists + (str target-tmp "/js/dummy.js")) + (ftt/verify-dir-exists + (str target-tmp "/js/subdir")) + (ftt/verify-file-exists + (str target-tmp "/js/subdir/subdummy.js")) + (ftt/verify-file-exists + (str target-tmp "/css/dummy.css")) + (ftt/verify-file-exists + (str target-tmp "/404.html"))))))