added ignore-patterns to delete
Co-authored-by: Jan Krebs <jan.krebs@student.uni-tuebingen.de>
This commit is contained in:
parent
ba678e848f
commit
137705e81c
1 changed files with 16 additions and 13 deletions
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
(defn filter-for-ignore-patterns
|
(defn filter-for-ignore-patterns
|
||||||
[ignore-patterns source-list]
|
[ignore-patterns source-list]
|
||||||
(filter #(not (re-matches ignore-patterns %)) source-list))
|
(filter #(not (re-matches (re-pattern ignore-patterns) %)) source-list))
|
||||||
|
|
||||||
(defn filter-resources-for-ignore-patterns
|
(defn filter-resources-for-ignore-patterns
|
||||||
[ignore-patterns resources]
|
[ignore-patterns resources]
|
||||||
|
@ -107,7 +107,8 @@
|
||||||
|
|
||||||
; TODO: Add files to keep
|
; TODO: Add files to keep
|
||||||
(s/defn delete-resources!
|
(s/defn delete-resources!
|
||||||
[virtual-path :- s/Str]
|
([virtual-path :- s/Str] (delete-resources! virtual-path nil))
|
||||||
|
([virtual-path :- s/Str ignore-patterns]
|
||||||
(let [resource-paths
|
(let [resource-paths
|
||||||
(reverse
|
(reverse
|
||||||
(sort
|
(sort
|
||||||
|
@ -115,9 +116,11 @@
|
||||||
(str (fs/user-dir) "/")
|
(str (fs/user-dir) "/")
|
||||||
virtual-path
|
virtual-path
|
||||||
[""]
|
[""]
|
||||||
:from-cp false)))]
|
:from-cp false)))
|
||||||
(do
|
resource-paths-filtered (if ignore-patterns
|
||||||
(doseq [resource-path resource-paths]
|
(filter-for-ignore-patterns ignore-patterns resource-paths)
|
||||||
|
resource-paths)]
|
||||||
|
(doseq [resource-path resource-paths-filtered]
|
||||||
(Files/delete (fs/absolut-path virtual-path resource-path))))))
|
(Files/delete (fs/absolut-path virtual-path resource-path))))))
|
||||||
|
|
||||||
(defn copy-resources!
|
(defn copy-resources!
|
||||||
|
|
Loading…
Reference in a new issue