diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index a4f014b..02baaf5 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -34,12 +34,19 @@ [ignore-patterns source-list] (filter #(not (re-matches (re-pattern ignore-patterns) %)) source-list)) +(defn filter-one-pattern + [ignore-patterns resources] + (if (not (empty? (:virtual-path (first resources)))) + (filter #(not (re-matches ignore-patterns (:virtual-path %))) resources) + resources)) + (defn filter-resources-for-ignore-patterns [ignore-patterns resources] - (if ignore-patterns - (filter #(not (re-matches (re-pattern ignore-patterns) (:virtual-path %))) - resources) - resources)) + (let [ignore-patterns (into [] ignore-patterns) + pattern (peek ignore-patterns)] + (if pattern + (filter-resources-for-ignore-patterns (pop ignore-patterns) (filter-one-pattern pattern resources)) + resources))) (defn resource-from-cp-or-fs ;:- Resource [fs-prefix ;:- Prefix diff --git a/test/cryogen_core/new_io_test.clj b/test/cryogen_core/new_io_test.clj index dbd5e48..c0d57ef 100644 --- a/test/cryogen_core/new_io_test.clj +++ b/test/cryogen_core/new_io_test.clj @@ -28,7 +28,7 @@ (sut/get-distinct-markup-dirs "./not-existing-get-from-cp" "test_posts" "test_pages" - "")))))) + [#""])))))) (deftest test-create-dirs-from-markup-folders! (is @@ -38,7 +38,7 @@ "./not-existing-get-from-cp" "test_posts" "test_pages" - target-tmp "") + target-tmp [#""]) (and (ftt/verify-dir-exists (str target-tmp "/test_pages")) (ftt/verify-dir-exists @@ -50,7 +50,7 @@ (is (let [target-tmp "target/tmp-test-copy-resources-from-theme"] (sut/delete-resources! target-tmp) - (sut/copy-resources-from-theme! "./" theme target-tmp "") + (sut/copy-resources-from-theme! "./" theme target-tmp [#""]) (and (ftt/verify-dir-exists (str target-tmp "/js")) (ftt/verify-file-exists