formatting

This commit is contained in:
Jan Krebs 2020-02-20 16:08:38 +01:00
parent c6559f8a3e
commit 87901a0e91
13 changed files with 131 additions and 136 deletions

View file

@ -78,7 +78,7 @@
[]
(vals resulting-map))))
(defn get-resource-paths-recursive ;:- [VirtualPath]
(defn get-resource-paths-recursive ;:- [VirtualPath]
[fs-prefix ;:- Prefix
base-path ;:- VirtualPath
paths ;:- [VirtualPath]
@ -92,7 +92,7 @@
:from-fs from-fs)))
; TODO: Add files to keep
(s/defn delete-resources!
(s/defn delete-resources!
[virtual-path :- s/Str]
(let [resource-paths
(reverse
@ -107,7 +107,7 @@
(Files/delete (fs/absolut-path virtual-path resource-path))))))
; TODO: add ignore patterns filtering
(defn copy-resources!
(defn copy-resources!
[fs-prefix ;:- Prefix
base-path ;:- VirtualPath
source-paths ;:- [VirtualPath]
@ -127,10 +127,9 @@
(when (this/is-dir? resource)
(Files/createDirectories target-path fs/no-attributes))
(when (this/is-file? resource)
(Files/copy source-path target-path fs/overwrite-preserve-attributes)
))))))
(Files/copy source-path target-path fs/overwrite-preserve-attributes)))))))
(defn distinct-resources-by-path
(defn distinct-resources-by-path
[resources]
(loop [paths (set (map :virtual-path resources))
resources resources

View file

@ -42,8 +42,7 @@
(when (some? java-path)
(if is-jar-resource
(jar/create-resource virtual-path java-path)
(fs/create-resource virtual-path java-path :java-classpath-filesystem))
))))
(fs/create-resource virtual-path java-path :java-classpath-filesystem))))))
(s/defn get-resources ;:- [this/Resource]
"base-path is sensible for getting the right jar from classpath. So base-path

View file

@ -59,12 +59,12 @@
source-type]
(create-resource virtual-path (path-if-exists fs-prefix base-path virtual-path) source-type)))
(defn
(defn
list-entries-for-dir
[resource]
(.list (.toFile (:java-path resource))))
(defn get-resources ;:- [Resource]
(defn get-resources ;:- [Resource]
([fs-prefix ;:- Prefix
base-path ;:- VirtualPath
paths ;:- [VirtualPath]
@ -91,7 +91,7 @@
result)
:else []))
(remove nil? result))))
([fs-prefix ;:- Prefix
([fs-prefix ;:- Prefix
base-path ;:- VirtualPath
paths ;:- [VirtualPath]
]

View file

@ -21,7 +21,6 @@
(is
(sut/path-if-exists "dummy_only_in_cp_fs")))
(deftest should-get-resources-from-jar-and-fs-classpath
(is (=
[]

View file

@ -38,7 +38,6 @@
(is
(sut/path-if-exists fs-root nil "/dummy/dummy_from_fs")))
(deftest test-list-entries-for-dir
(is
(= ["dummy2"

View file

@ -16,13 +16,12 @@
(deftest test-is-from-classpath-jar?
(is
(sut/is-from-classpath-jar? (.toURI (io/resource "dummy"))))
)
(sut/is-from-classpath-jar? (.toURI (io/resource "dummy")))))
(deftest test-path-if-exists
(is
(sut/path-if-exists "dummy/dummy_from_jar")))
(is
(is
(= nil
(sut/path-if-exists "not-existing")))