From 1c7720bdbf57827ddb9dfc1567ed1ca2c08e15cc Mon Sep 17 00:00:00 2001 From: Jan Krebs Date: Fri, 6 Dec 2019 16:59:44 +0100 Subject: [PATCH] "mob next [ci-skip]" --- src/cryogen_core/classpath_able_io.clj | 7 ++++++- test/cryogen_core/classpath_able_io_test.clj | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index f1b9510..da2aace 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -10,6 +10,10 @@ (:require [clojure.java.io :as io] [clojure.string :as s])) +(defn filter-for-ignore-patterns + [ignore-patterns source-list] + (filter #(not (re-matches ignore-patterns %)) source-list)) + (defn file-from-cp [resource-path] (let [file-from-cp (io/file (io/resource resource-path))] @@ -35,6 +39,7 @@ from-fs (file-from-cp resource-path)))) +; TODO: fix recursion as we put function calls on callstack here (defn copy-dir [source-dir target-dir ignore-patterns] (let [source-list (.list source-dir)] @@ -45,7 +50,7 @@ (do (io/make-parents target-file) (io/copy f target-file)) - (recur source-file target-file ignore-patterns)))))) + (copy-dir source-file target-file ignore-patterns)))))) (defn copy-resources [fs-prefix source-path target-path ignore-patterns] diff --git a/test/cryogen_core/classpath_able_io_test.clj b/test/cryogen_core/classpath_able_io_test.clj index f7272e3..1755c96 100644 --- a/test/cryogen_core/classpath_able_io_test.clj +++ b/test/cryogen_core/classpath_able_io_test.clj @@ -26,7 +26,7 @@ (deftest test-filter-for-ignore-patterns (is (= ["file.js"] - (sut/filter-for-ignore-patterns #".*\\.ignore" ["file.js" "file.ignore"])))) + (sut/filter-for-ignore-patterns #".*\.ignore" ["file.js" "file.ignore"])))) (deftest test-file-from-cp (is