File tree Expand file tree Collapse file tree 3 files changed +32
-12
lines changed Expand file tree Collapse file tree 3 files changed +32
-12
lines changed Original file line number Diff line number Diff line change 7575 :add-linters [:performance :boxed-math ]
7676 :config-files [" eastwood.clj" ]}}
7777 :clj-kondo [:test
78- {:dependencies [[clj-kondo " 2021.06.18 " ]]}]}
78+ {:dependencies [[clj-kondo " 2021.09.15 " ]]}]}
7979
8080 :jvm-opts ~(cond-> []
8181 (System/getenv " CI" )
Original file line number Diff line number Diff line change 5151 ; ; Ignore artifact if not readable. See #255
5252 nil )))
5353
54- (defn get-clojars-artifacts!
54+ (defn- get-clojars-artifacts!
5555 " Returns a vector of [[some/lib \" 0.1\" ]...]."
5656 []
5757 (try
6868(defn- get-mvn-artifacts!
6969 " All the artifacts under org.clojure in mvn central"
7070 [group-id]
71- (let [search-prefix " http ://search.maven.org/solrsearch/select?q=g:%22"
71+ (let [search-prefix " https ://search.maven.org/solrsearch/select?q=g:%22"
7272 search-suffix " %22+AND+p:%22jar%22&rows=2000&wt=json"
7373 search-url (str search-prefix group-id search-suffix)
7474 {:keys [_ _ body _]} @(http/get search-url (assoc (get-proxy-opts ) :as :text ))
7575 search-result (json/read-str body :key-fn keyword)]
76- (map :a (-> search-result :response :docs ))))
76+ (->> search-result
77+ :response
78+ :docs
79+ (keep :a ))))
7780
7881(defn- get-mvn-versions!
7982 " Fetches all the versions of particular artifact from maven repository."
8083 [artifact]
8184 (let [[group-id artifact] (str/split artifact #"/" )
82- search-prefix " http ://search.maven.org/solrsearch/select?q=g:%22"
85+ search-prefix " https ://search.maven.org/solrsearch/select?q=g:%22"
8386 {:keys [_ _ body _]} @(http/get (str search-prefix
8487 group-id
8588 " %22+AND+a:%22"
8992 (->> (json/read-str body :key-fn keyword)
9093 :response
9194 :docs
92- (map :v ))))
95+ (keep :v ))))
9396
9497(defn- get-artifacts-from-mvn-central!
9598 []
105108 (let [{:keys [body status]} @(http/get (str " https://clojars.org/api/artifacts/"
106109 artifact))]
107110 (when (= 200 status)
108- (map :version (:recent_versions (json/read-str body :key-fn keyword))))))
111+ (->> (json/read-str body :key-fn keyword)
112+ :recent_versions
113+ (keep :version )))))
109114
110115(defn- get-artifacts-from-clojars!
111116 []
Original file line number Diff line number Diff line change 1818(def clojure-artifacts [" clojure" ])
1919(def clojars-artifacts (resource " clojars-artifacts.edn" ))
2020
21+ (deftest get-mvn-artifacts!-test
22+ (is (> (count (#'artifacts/get-mvn-artifacts! " org.clojure" ))
23+ 10 )))
24+
25+ (deftest get-clojars-artifacts!-test
26+ (is (> (count (#'artifacts/get-clojars-artifacts! ))
27+ 1000 )))
28+
29+ (deftest get-mvn-versions!-test
30+ (is (> (count (#'artifacts/get-mvn-versions! " org.clojure/clojure" ))
31+ 20 )))
32+
33+ (deftest get-clojars-versions!-test
34+ (is (> (count (#'artifacts/get-clojars-versions! " refactor-nrepl/refactor-nrepl" ))
35+ 30 )))
36+
2137(deftest creates-a-map-of-artifacts
2238 (reset! artifacts/artifacts {})
23- (with-redefs
24- [artifacts/get-clojars-artifacts! (constantly clojars-artifacts)
25- artifacts/get-clojars-versions! (constantly aero-versions)
26- artifacts/get-mvn-artifacts! (constantly clojure-artifacts)
27- artifacts/get-mvn-versions! (constantly clojure-versions)]
39+ (with-redefs [artifacts/get-clojars-artifacts! (constantly clojars-artifacts)
40+ artifacts/get-clojars-versions! (constantly aero-versions)
41+ artifacts/get-mvn-artifacts! (constantly clojure-artifacts)
42+ artifacts/get-mvn-versions! (constantly clojure-versions)]
2843
2944 (is (#'artifacts/stale-cache? ))
3045
You can’t perform that action at this time.
0 commit comments