meyvn.nrepl_middleware.clojars.clj Maven / Gradle / Ivy
The newest version!
(ns meyvn.nrepl-middleware.clojars
(:require [clj-http.client :as client]
[clojure.edn :as edn]
[clojure.string :as str])
(:import [java.io BufferedReader StringReader]))
(defn catalog []
(let [resp (-> (client/get "http://clojars.org/repo/all-jars.clj")
:body)
seq (line-seq (BufferedReader. (StringReader. resp)))
xs (for [line seq]
(try
(edn/read-string line)
(catch Exception e (.getMessage e))))]
(distinct (map (comp str first) xs))))
(defn versions [artifact]
(let [resp (-> (client/get (str "https://clojars.org/api/artifacts/" artifact) {:headers {"Accept" "application/edn"}})
:body
edn/read-string)
versions (:recent_versions resp)
candidates (map (comp #(str artifact " " %) :version) versions)]
(str/join "\n" candidates)))
© 2015 - 2024 Weber Informatics LLC | Privacy Policy