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
[""]
: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!

View file

@ -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)))))

View file

@ -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"))))))