1 ; Common utility functions used by scripts
3 (import '[java.nio.file Files FileSystems CopyOption StandardCopyOption])
5 (require '[org.httpkit.client :as http])
7 (defn extract-file-from-zip
8 [zip-file-name source destination]
9 (let [zip-file (io/file zip-file-name)
11 dest (io/file destination)
12 fs (FileSystems/newFileSystem (.toPath zip-file) nil)
13 file-in-zip (.getPath fs source (into-array String []))]
14 (Files/copy file-in-zip
16 (into-array CopyOption [StandardCopyOption/REPLACE_EXISTING]))))
20 (if (.startsWith s "~")
21 (clojure.string/replace-first s "~" (System/getProperty "user.home"))
26 (io/copy (:body @(http/get url)) (io/file destination)))