]> njoseph.me Git - babashka-scripts.git/blobdiff - lib.clj
Create and use namespace for lib.clj
[babashka-scripts.git] / lib.clj
diff --git a/lib.clj b/lib.clj
index 70fef53590648bb52015649d4ad872c4bc326737..1f88070ba456a7b9e516567a17180a9c3a8cf26c 100644 (file)
--- a/lib.clj
+++ b/lib.clj
@@ -1,8 +1,11 @@
 ; Common utility functions used by scripts
 
-(import '[java.nio.file Files FileSystems CopyOption StandardCopyOption])
-
-(require '[babashka.process :as p] '[org.httpkit.client :as http])
+(ns lib
+  (:require [babashka.process :as p]
+            [org.httpkit.client :as http]
+            [clojure.java.io :as io]
+            [clojure.string :refer [replace-first]])
+  (:import [java.nio.file Files FileSystems CopyOption StandardCopyOption]))
 
 (defn run-cmd
   [command]
@@ -14,7 +17,6 @@
 (defn extract-file-from-zip
   [zip-file-name source destination]
   (let [zip-file (io/file zip-file-name)
-        src (io/file source)
         dest (io/file destination)
         fs (FileSystems/newFileSystem (.toPath zip-file) nil)
         file-in-zip (.getPath fs source (into-array String []))]
@@ -25,7 +27,7 @@
 (defn expand-home
   [s]
   (if (.startsWith s "~")
-    (clojure.string/replace-first s "~" (System/getProperty "user.home"))
+    (replace-first s "~" (System/getProperty "user.home"))
     s))
 
 (defn download-binary