Fork me on GitHub
#tools-deps
<
2019-01-30
>
lilactown01:01:12

is there a way to just get whatevers at master with git deps?

lilactown01:01:25

try to write a quick-try command for a lib

Alex Miller (Clojure team)02:01:16

By design, we want to use stable versions for caching purposes

Alex Miller (Clojure team)02:01:41

But you can use the gitlibs lib to look up what sha master is

Alex Miller (Clojure team)02:01:07

you can even one-line it - clj comes with a built-in :deps alias that includes tools.deps (and tools.gitlib):

Alex Miller (Clojure team)02:01:13

$ clj -A:deps -e "(require 'clojure.tools.gitlibs)" -e '(println (clojure.tools.gitlibs/resolve "" "master"))'
d86fec647b705b5d01d27c32322c9ccc9f65b77c
$ clj -Sdeps '{:deps {org.clojure/tools.gitlibs {:git/url "" :sha "d86fec647b705b5d01d27c32322c9ccc9f65b77c"}}}'
Checking out:  at d86fec647b705b5d01d27c32322c9ccc9f65b77c
Clojure 1.10.0
user=> (require '[clojure.spec-alpha2 :as s])
nil
user=> (s/conform (s/spec int?) 10)
10

Alex Miller (Clojure team)02:01:26

rub some scripting on that and you’ve got something

seancorfield03:01:23

Could you combine that with the add-lib branch and dynamically load the master version into your REPL? (I can't remember whether add-lib works with git libs)

Alex Miller (Clojure team)03:01:27

add-lib works with any dep supported by tools.deps

seancorfield04:01:21

Yeah, nice

user=> (require '[clojure.tools.deps.alpha.repl])
nil
user=> (require '[clojure.tools.gitlibs])
nil
user=> (defn load-master [lib] (let [git (str "" lib ".git")] (clojure.tools.deps.alpha.repl/add-lib lib {:git/url git :sha (clojure.tools.gitlibs/resolve git "master")})))
#'user/load-master
user=> (load-master 'clojure/tools.trace)
Checking out:  at fbba1a5012bae0ac4ed5cd704babf23e9e3fbc44
Downloading: org/clojure/clojure/1.4.0/clojure-1.4.0.pom from 
Downloading: org/clojure/clojure/1.4.0/clojure-1.4.0.jar from 
true
user=>        

❤️ 5
lilactown04:01:39

Clever! Thanks 😁

seancorfield04:01:20

I ❤️ Clojure 🙂

cider 5
seancorfield04:01:07

(interesting that clojure/tools.trace has a dependency on Clojure 1.4.0!)

Alex Miller (Clojure team)04:01:16

a lot of the contribs depend on the oldest version they can support

Alex Miller (Clojure team)04:01:45

CI no longer tests anything older than 1.7 iirc

jvtrigueros17:01:21

I haven't taken the plunge into using tools.dep yet, but absorbing via osmosis through Sean's code snippets! Thanks!