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))]
(do
(println resource-paths)
(doseq [resource-path resource-paths] (doseq [resource-path resource-paths]
(Files/delete (fs/absolut-path virtual-path resource-path)) (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/delete-resource-recursive! target-tmp)
(sut/create-dirs-from-markup-folders! (sut/create-dirs-from-markup-folders!
"./not-existing-get-from-cp" "./not-existing-get-from-cp"
"test_posts" "test_posts"
"test_pages" "test_pages"
(str target "2") "") target-tmp "")
(and (ftt/verify-dir-exists (and (ftt/verify-dir-exists
(str (str target "2") "/test_pages")) (str target-tmp "/test_pages"))
(ftt/verify-dir-exists (ftt/verify-dir-exists
(str (str target "2") "/test_posts")) (str target-tmp "/test_posts"))
(ftt/verify-dir-exists (ftt/verify-dir-exists
(str (str target "2") "/test_pages/home")))))) (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"]
(sut/delete-resource-recursive! target-tmp)
(sut/copy-resources-from-theme! "./" theme target-tmp "")
(and (ftt/verify-dir-exists (and (ftt/verify-dir-exists
(str target "/js")) (str target-tmp "/js"))
(ftt/verify-file-exists (ftt/verify-file-exists
(str target "/js/dummy.js")) (str target-tmp "/js/dummy.js"))
(ftt/verify-dir-exists (ftt/verify-dir-exists
(str target "/js/subdir")) (str target-tmp "/js/subdir"))
(ftt/verify-file-exists (ftt/verify-file-exists
(str target "/js/subdir/subdummy.js")) (str target-tmp "/js/subdir/subdummy.js"))
(ftt/verify-file-exists (ftt/verify-file-exists
(str target "/css/dummy.css")) (str target-tmp "/css/dummy.css"))
(ftt/verify-file-exists (ftt/verify-file-exists
(str target "/404.html")))))) (str target-tmp "/404.html"))))))