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 75
75
:add-linters [:performance :boxed-math ]
76
76
:config-files [" eastwood.clj" ]}}
77
77
:clj-kondo [:test
78
- {:dependencies [[clj-kondo " 2021.06.18 " ]]}]}
78
+ {:dependencies [[clj-kondo " 2021.09.15 " ]]}]}
79
79
80
80
:jvm-opts ~(cond-> []
81
81
(System/getenv " CI" )
Original file line number Diff line number Diff line change 51
51
; ; Ignore artifact if not readable. See #255
52
52
nil )))
53
53
54
- (defn get-clojars-artifacts!
54
+ (defn- get-clojars-artifacts!
55
55
" Returns a vector of [[some/lib \" 0.1\" ]...]."
56
56
[]
57
57
(try
68
68
(defn- get-mvn-artifacts!
69
69
" All the artifacts under org.clojure in mvn central"
70
70
[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"
72
72
search-suffix " %22+AND+p:%22jar%22&rows=2000&wt=json"
73
73
search-url (str search-prefix group-id search-suffix)
74
74
{:keys [_ _ body _]} @(http/get search-url (assoc (get-proxy-opts ) :as :text ))
75
75
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 ))))
77
80
78
81
(defn- get-mvn-versions!
79
82
" Fetches all the versions of particular artifact from maven repository."
80
83
[artifact]
81
84
(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"
83
86
{:keys [_ _ body _]} @(http/get (str search-prefix
84
87
group-id
85
88
" %22+AND+a:%22"
89
92
(->> (json/read-str body :key-fn keyword)
90
93
:response
91
94
:docs
92
- (map :v ))))
95
+ (keep :v ))))
93
96
94
97
(defn- get-artifacts-from-mvn-central!
95
98
[]
105
108
(let [{:keys [body status]} @(http/get (str " https://clojars.org/api/artifacts/"
106
109
artifact))]
107
110
(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 )))))
109
114
110
115
(defn- get-artifacts-from-clojars!
111
116
[]
Original file line number Diff line number Diff line change 18
18
(def clojure-artifacts [" clojure" ])
19
19
(def clojars-artifacts (resource " clojars-artifacts.edn" ))
20
20
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
+
21
37
(deftest creates-a-map-of-artifacts
22
38
(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)]
28
43
29
44
(is (#'artifacts/stale-cache? ))
30
45
You can’t perform that action at this time.
0 commit comments