formatting
This commit is contained in:
parent
c6559f8a3e
commit
87901a0e91
13 changed files with 131 additions and 136 deletions
|
@ -78,7 +78,7 @@
|
||||||
[]
|
[]
|
||||||
(vals resulting-map))))
|
(vals resulting-map))))
|
||||||
|
|
||||||
(defn get-resource-paths-recursive ;:- [VirtualPath]
|
(defn get-resource-paths-recursive ;:- [VirtualPath]
|
||||||
[fs-prefix ;:- Prefix
|
[fs-prefix ;:- Prefix
|
||||||
base-path ;:- VirtualPath
|
base-path ;:- VirtualPath
|
||||||
paths ;:- [VirtualPath]
|
paths ;:- [VirtualPath]
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
:from-fs from-fs)))
|
:from-fs from-fs)))
|
||||||
|
|
||||||
; 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]
|
||||||
(let [resource-paths
|
(let [resource-paths
|
||||||
(reverse
|
(reverse
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
(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!
|
||||||
[fs-prefix ;:- Prefix
|
[fs-prefix ;:- Prefix
|
||||||
base-path ;:- VirtualPath
|
base-path ;:- VirtualPath
|
||||||
source-paths ;:- [VirtualPath]
|
source-paths ;:- [VirtualPath]
|
||||||
|
@ -127,10 +127,9 @@
|
||||||
(when (this/is-dir? resource)
|
(when (this/is-dir? resource)
|
||||||
(Files/createDirectories target-path fs/no-attributes))
|
(Files/createDirectories target-path fs/no-attributes))
|
||||||
(when (this/is-file? resource)
|
(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]
|
[resources]
|
||||||
(loop [paths (set (map :virtual-path resources))
|
(loop [paths (set (map :virtual-path resources))
|
||||||
resources resources
|
resources resources
|
||||||
|
|
|
@ -42,8 +42,7 @@
|
||||||
(when (some? java-path)
|
(when (some? java-path)
|
||||||
(if is-jar-resource
|
(if is-jar-resource
|
||||||
(jar/create-resource virtual-path java-path)
|
(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]
|
(s/defn get-resources ;:- [this/Resource]
|
||||||
"base-path is sensible for getting the right jar from classpath. So base-path
|
"base-path is sensible for getting the right jar from classpath. So base-path
|
||||||
|
|
|
@ -59,12 +59,12 @@
|
||||||
source-type]
|
source-type]
|
||||||
(create-resource virtual-path (path-if-exists fs-prefix base-path virtual-path) source-type)))
|
(create-resource virtual-path (path-if-exists fs-prefix base-path virtual-path) source-type)))
|
||||||
|
|
||||||
(defn
|
(defn
|
||||||
list-entries-for-dir
|
list-entries-for-dir
|
||||||
[resource]
|
[resource]
|
||||||
(.list (.toFile (:java-path resource))))
|
(.list (.toFile (:java-path resource))))
|
||||||
|
|
||||||
(defn get-resources ;:- [Resource]
|
(defn get-resources ;:- [Resource]
|
||||||
([fs-prefix ;:- Prefix
|
([fs-prefix ;:- Prefix
|
||||||
base-path ;:- VirtualPath
|
base-path ;:- VirtualPath
|
||||||
paths ;:- [VirtualPath]
|
paths ;:- [VirtualPath]
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
result)
|
result)
|
||||||
:else []))
|
:else []))
|
||||||
(remove nil? result))))
|
(remove nil? result))))
|
||||||
([fs-prefix ;:- Prefix
|
([fs-prefix ;:- Prefix
|
||||||
base-path ;:- VirtualPath
|
base-path ;:- VirtualPath
|
||||||
paths ;:- [VirtualPath]
|
paths ;:- [VirtualPath]
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
(is
|
(is
|
||||||
(sut/path-if-exists "dummy_only_in_cp_fs")))
|
(sut/path-if-exists "dummy_only_in_cp_fs")))
|
||||||
|
|
||||||
|
|
||||||
(deftest should-get-resources-from-jar-and-fs-classpath
|
(deftest should-get-resources-from-jar-and-fs-classpath
|
||||||
(is (=
|
(is (=
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
(is
|
(is
|
||||||
(sut/path-if-exists fs-root nil "/dummy/dummy_from_fs")))
|
(sut/path-if-exists fs-root nil "/dummy/dummy_from_fs")))
|
||||||
|
|
||||||
|
|
||||||
(deftest test-list-entries-for-dir
|
(deftest test-list-entries-for-dir
|
||||||
(is
|
(is
|
||||||
(= ["dummy2"
|
(= ["dummy2"
|
||||||
|
|
|
@ -16,13 +16,12 @@
|
||||||
|
|
||||||
(deftest test-is-from-classpath-jar?
|
(deftest test-is-from-classpath-jar?
|
||||||
(is
|
(is
|
||||||
(sut/is-from-classpath-jar? (.toURI (io/resource "dummy"))))
|
(sut/is-from-classpath-jar? (.toURI (io/resource "dummy")))))
|
||||||
)
|
|
||||||
|
|
||||||
(deftest test-path-if-exists
|
(deftest test-path-if-exists
|
||||||
(is
|
(is
|
||||||
(sut/path-if-exists "dummy/dummy_from_jar")))
|
(sut/path-if-exists "dummy/dummy_from_jar")))
|
||||||
(is
|
(is
|
||||||
(= nil
|
(= nil
|
||||||
(sut/path-if-exists "not-existing")))
|
(sut/path-if-exists "not-existing")))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue