You can use grenade if you want to just run it in REPL (it seems that this will be the only suitable use case, right?). You can view the latest versions using the Maven Central API. I think this is better than supporting some kind of dependency project, generated or otherwise.
(require '[cemerick.pomegranate :refer [add-dependencies]]) (add-dependencies :coordinates '[[clj-http "0.5.8"]] :repositories {"clojars" "http://clojars.org/repo"}) (require '[clj-http.client :as client]) ;; contrib project names from https://github.com/clojure (def contrib ["tools.nrepl" "tools.trace" "tools.namespace" "tools.macro" "test.generative" "math.numeric-tower" "core.match" "core.logic" "data.priority-map" "core.contracts" "tools.cli" "java.jmx" "java.jdbc" "java.classpath" "data.xml" "data.json" "core.unify" "core.incubator" "core.cache" "algo.monads" "data.generators" "core.memoize" "math.combinatorics" "java.data" "tools.logging" "data.zip" "data.csv" "algo.generic" "data.codec" "data.finger-tree"]) (defn add-contrib-dependencies "look up the latest version of every contrib project in maven central, and add them as dependencies using pomegranate." [project-names] (add-dependencies :coordinates (map (juxt (comp symbol (partial format "org.clojure/%s")) (fn [proj] (Thread/sleep 100) (-> "http://search.maven.org/solrsearch/select?q=%s&rows=1&wt=json" (format proj) (client/get {:as :json}) :body :response :docs first :latestVersion))) project-names)))
Now you can simply call this function in the list of project names:
user=> (add-contrib-dependencies contrib) {[org.clojure/data.zip "0.1.1"] nil, [org.clojure/java.classpath "0.2.0"] nil, [org.clojure/core.cache "0.6.2"] nil, ...}
UPDATE: as suggested earlier, I made this answer in the library. It can be used either as nREPL middleware or manually called from the current REPL session. The code can be found at https://github.com/rplevy/contrib-repl , where you can also find instructions for use.
rplevy
source share