Manifest dir with env var (#50)
This commit is contained in:
parent
66867eee7f
commit
93081b75e6
1 changed files with 17 additions and 17 deletions
|
|
@ -104,11 +104,20 @@
|
||||||
(with-open [is (.getInputStream conn)]
|
(with-open [is (.getInputStream conn)]
|
||||||
(io/copy is dest))))
|
(io/copy is dest))))
|
||||||
|
|
||||||
(def pod-manifests-dir
|
(defn repo-dir []
|
||||||
|
(io/file (if-let [pods-dir (System/getenv "BABASHKA_PODS_DIR")]
|
||||||
|
(io/file pods-dir)
|
||||||
|
(io/file (or
|
||||||
|
(System/getenv "XDG_DATA_HOME")
|
||||||
|
(System/getProperty "user.home"))
|
||||||
|
".babashka"
|
||||||
|
"pods"))
|
||||||
|
"repository"))
|
||||||
|
|
||||||
|
(def pods-repo-dir
|
||||||
;; wrapped in delay for GraalVM native-image
|
;; wrapped in delay for GraalVM native-image
|
||||||
(delay (io/file (or (System/getenv "XDG_DATA_HOME")
|
(delay
|
||||||
(System/getProperty "user.home"))
|
(repo-dir)))
|
||||||
".babashka" "pods" "repository")))
|
|
||||||
|
|
||||||
(defn github-url [qsym version]
|
(defn github-url [qsym version]
|
||||||
(format
|
(format
|
||||||
|
|
@ -117,7 +126,7 @@
|
||||||
|
|
||||||
(defn pod-manifest
|
(defn pod-manifest
|
||||||
[qsym version force?]
|
[qsym version force?]
|
||||||
(let [f (io/file @pod-manifests-dir (str qsym) (str version) "manifest.edn")]
|
(let [f (io/file @pods-repo-dir (str qsym) (str version) "manifest.edn")]
|
||||||
(if (and (not force?)
|
(if (and (not force?)
|
||||||
(.exists f))
|
(.exists f))
|
||||||
(edn/read-string (slurp f))
|
(edn/read-string (slurp f))
|
||||||
|
|
@ -145,18 +154,9 @@
|
||||||
^java.io.File
|
^java.io.File
|
||||||
[{pod-name :pod/name
|
[{pod-name :pod/name
|
||||||
pod-version :pod/version}]
|
pod-version :pod/version}]
|
||||||
(let [base-file
|
(io/file @pods-repo-dir
|
||||||
(if-let [pods-dir (System/getenv "BABASHKA_PODS_DIR")]
|
(str pod-name)
|
||||||
(io/file pods-dir)
|
pod-version))
|
||||||
(io/file (or
|
|
||||||
(System/getenv "XDG_DATA_HOME")
|
|
||||||
(System/getProperty "user.home"))
|
|
||||||
".babashka"
|
|
||||||
"pods"))]
|
|
||||||
(io/file base-file
|
|
||||||
"repository"
|
|
||||||
(str pod-name)
|
|
||||||
pod-version)))
|
|
||||||
|
|
||||||
(defn sha256 [file]
|
(defn sha256 [file]
|
||||||
(let [buf (byte-array 8192)
|
(let [buf (byte-array 8192)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue