This commit is contained in:
Clemens Geibel 2020-02-14 15:27:23 +01:00
parent d6604e9616
commit 52fdd2cdbe
3 changed files with 40 additions and 37 deletions

View file

@ -230,9 +230,10 @@
virtual-path virtual-path
[""] [""]
:from-cp false))] :from-cp false))]
(doseq [resource-path resource-paths] (do
(Files/delete (fs/absolut-path virtual-path resource-path)) (println resource-paths)
))) (doseq [resource-path resource-paths]
(Files/delete (fs/absolut-path virtual-path resource-path))))))
; TODO: add ignore patterns filtering ; TODO: add ignore patterns filtering
(defn copy-resources! (defn copy-resources!

View file

@ -17,8 +17,6 @@
(def theme "bootstrap4-test") (def theme "bootstrap4-test")
(def target "target/tmp")
(deftest test-get-resources-recursive (deftest test-get-resources-recursive
(is (= (is (=
[] []
@ -83,7 +81,8 @@
(deftest test-delete-resource-recursive! (deftest test-delete-resource-recursive!
(is (is
(do (let [target-tmp "target/tmp3"]
(.mkdir (io/file target)) (.mkdir (io/file target-tmp))
(sut/delete-resource-recursive! target) (.createNewFile (io/file (str target-tmp "/file-tmp")))
(not (ftt/verify-dir-exists target))))) (sut/delete-resource-recursive! target-tmp)
(not (ftt/verify-dir-exists target-tmp)))))

View file

@ -31,32 +31,35 @@
"")))))) ""))))))
(deftest test-create-dirs-from-markup-folders! (deftest test-create-dirs-from-markup-folders!
(is (do (is
(sut/delete-resource-recursive! (str target "2")) (let [target-tmp "target/tmp-test-create-dirs-from-markup-folders"]
(sut/create-dirs-from-markup-folders! (sut/delete-resource-recursive! target-tmp)
"./not-existing-get-from-cp" (sut/create-dirs-from-markup-folders!
"test_posts" "./not-existing-get-from-cp"
"test_pages" "test_posts"
(str target "2") "") "test_pages"
(and (ftt/verify-dir-exists target-tmp "")
(str (str target "2") "/test_pages")) (and (ftt/verify-dir-exists
(ftt/verify-dir-exists (str target-tmp "/test_pages"))
(str (str target "2") "/test_posts")) (ftt/verify-dir-exists
(ftt/verify-dir-exists (str target-tmp "/test_posts"))
(str (str target "2") "/test_pages/home")))))) (ftt/verify-dir-exists
(str target-tmp "/test_pages/home"))))))
(deftest test-copy-resources-from-theme! (is (do (deftest test-copy-resources-from-theme!
(sut/delete-resource-recursive! target) (is
(sut/copy-resources-from-theme! "./" theme target "") (let [target-tmp "target/tmp-test-copy-resources-from-theme"]
(and (ftt/verify-dir-exists (sut/delete-resource-recursive! target-tmp)
(str target "/js")) (sut/copy-resources-from-theme! "./" theme target-tmp "")
(ftt/verify-file-exists (and (ftt/verify-dir-exists
(str target "/js/dummy.js")) (str target-tmp "/js"))
(ftt/verify-dir-exists (ftt/verify-file-exists
(str target "/js/subdir")) (str target-tmp "/js/dummy.js"))
(ftt/verify-file-exists (ftt/verify-dir-exists
(str target "/js/subdir/subdummy.js")) (str target-tmp "/js/subdir"))
(ftt/verify-file-exists (ftt/verify-file-exists
(str target "/css/dummy.css")) (str target-tmp "/js/subdir/subdummy.js"))
(ftt/verify-file-exists (ftt/verify-file-exists
(str target "/404.html")))))) (str target-tmp "/css/dummy.css"))
(ftt/verify-file-exists
(str target-tmp "/404.html"))))))