Skip to content

Instantly share code, notes, and snippets.

@borkdude
Created January 12, 2020 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borkdude/9577ee77f02f62217a8fd709e3e7f9f3 to your computer and use it in GitHub Desktop.
Save borkdude/9577ee77f02f62217a8fd709e3e7f9f3 to your computer and use it in GitHub Desktop.
Managing babashka deps manually with git
(require '[babashka.classpath :refer [add-classpath]]
'[clojure.java.shell :refer [sh with-sh-dir]]
'[clojure.java.io :as io])
(def script-dir (.getParentFile (io/file *file*)))
(def libs-dir (.getPath (io/file script-dir "lib")))
(defn add-github-lib [username libname sha]
(let [lib-dir (io/file libs-dir libname)]
(when-not (.exists lib-dir)
(sh "mkdir" "-p" libs-dir)
(with-sh-dir libs-dir (sh "git" "clone" (str "https://github.com/" username "/" libname) ))
(with-sh-dir lib-dir (sh "git" "reset" "--hard" sha)))
(add-classpath (.getPath (io/file lib-dir "src")))))
(add-github-lib "borkdude" "spartan.spec" "ff7317d67ec15f188afb856d37090e5c9509374e")
(add-github-lib "borkdude" "medley" "91adfb5da33f8d23f75f0894da1defe567a625c0")
(require '[spartan.spec :as s])
(s/explain (s/cat :i int? :j string?) [10 :foo])
(require '[medley.core :refer [map-vals]])
(prn (map-vals inc {:a 1 :b 1}))
@borkdude
Copy link
Author

Screenshot 2020-01-12 22 58 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment