Remove clj-http dependency, and all transitive deps too.

This commit is contained in:
Phil Hagelberg 2017-04-25 10:33:41 -07:00
parent 1c4a435b60
commit 9e556c2762
2 changed files with 11 additions and 13 deletions

View file

@ -16,11 +16,10 @@
org.thnetos/cd-client]]
[org.clojure/tools.nrepl "0.2.12"]
[clojure-complete "0.2.4"]
[cheshire "5.6.3"]
;; bump versions of various common transitive deps
[scout "0.1.1"]
[slingshot "0.12.2"]
[cheshire "5.6.3"]
[clj-http "2.0.1"]
[net.cgrand/parsley "0.9.3" :exclusions [org.clojure/clojure]]]
;; checkout-deps don't work with :eval-in :leiningen
:profiles {:dev {:resource-paths ["leiningen-core/dev-resources"]

View file

@ -2,12 +2,12 @@
"Search Central and Clojars for published artifacts."
(:require [clojure.string :as string]
[leiningen.core.project :as project]
[clj-http.client :as http]
[cheshire.core :as json]))
[cheshire.core :as json])
(:import (java.net URLEncoder)))
(defn search-central [query]
(let [url (str "https://search.maven.org/solrsearch/select?wt=json&q=" query)]
(doseq [result (get-in (json/decode (:body (http/get url)))
(doseq [result (get-in (json/decode (slurp url))
["response" "docs"])]
(let [dep (if (= (result "a") (result "g"))
(result "a")
@ -16,7 +16,7 @@
(defn search-clojars [query]
(let [url (str "https://clojars.org/search?format=json&q=" query)]
(doseq [result (get (json/decode (:body (http/get url))) "results")]
(doseq [result (get (json/decode (slurp url)) "results")]
(let [dep (if (= (result "jar_name") (result "group_name"))
(result "jar_name")
(str (result "group_name") "/" (result "jar_name")))]
@ -34,10 +34,9 @@
["clojars" search-clojars]]]
(when (repos repo)
(try (println "Searching" repo "...")
(searcher query)
(catch clojure.lang.ExceptionInfo e
(when-not (re-find #"clj-http" (.getMessage e))
(throw e))
(if (= 400 (:status (ex-data e)))
(println "Query syntax unsupported.")
(println "Remote error" (.getMessage e)))))))))
(searcher (URLEncoder/encode query "UTF-8"))
(catch java.io.IOException e
(binding [*out* *err*]
(if (re-find #"HTTP response code: (400|505)" (str e))
(println "Query syntax unsupported.")
(println "Remote error" (.getMessage e))))))))))