|
72 | 72 | (let [search-prefix "https://search.maven.org/solrsearch/select?q=g:%22"
|
73 | 73 | search-suffix "%22+AND+p:%22jar%22&rows=2000&wt=json"
|
74 | 74 | search-url (str search-prefix group-id search-suffix)
|
75 |
| - {:keys [_ _ body _]} @(http/get search-url (assoc (get-proxy-opts) :as :text)) |
76 |
| - search-result (json/read-str body :key-fn keyword)] |
77 |
| - (->> search-result |
78 |
| - :response |
79 |
| - :docs |
80 |
| - (keep :a)))) |
| 75 | + p (http/get search-url (assoc (get-proxy-opts) :as :text)) |
| 76 | + {:keys [_ _ body _]} (deref p 7 {})] |
| 77 | + (if (empty? body) |
| 78 | + [] |
| 79 | + (->> (json/read-str body :key-fn keyword) |
| 80 | + :response |
| 81 | + :docs |
| 82 | + (keep :a))))) |
81 | 83 |
|
82 | 84 | (defn- get-mvn-versions!
|
83 | 85 | "Fetches all the versions of particular artifact from maven repository."
|
84 | 86 | [artifact]
|
85 | 87 | (let [[group-id artifact] (str/split artifact #"/")
|
86 | 88 | search-prefix "https://search.maven.org/solrsearch/select?q=g:%22"
|
87 |
| - {:keys [_ _ body _]} @(http/get (str search-prefix |
88 |
| - group-id |
89 |
| - "%22+AND+a:%22" |
90 |
| - artifact |
91 |
| - "%22&core=gav&rows=100&wt=json") |
92 |
| - (assoc (get-proxy-opts) :as :text))] |
93 |
| - (->> (json/read-str body :key-fn keyword) |
94 |
| - :response |
95 |
| - :docs |
96 |
| - (keep :v)))) |
97 |
| - |
98 |
| -(defn- get-artifacts-from-mvn-central! |
99 |
| - [] |
100 |
| - (let [group-ids #{"com.cognitect" "org.clojure"}] |
101 |
| - (mapcat (fn [group-id] |
102 |
| - (->> (get-mvn-artifacts! group-id) |
103 |
| - (map #(vector (str group-id "/" %) nil)))) |
104 |
| - group-ids))) |
| 89 | + p (http/get (str search-prefix |
| 90 | + group-id |
| 91 | + "%22+AND+a:%22" |
| 92 | + artifact |
| 93 | + "%22&core=gav&rows=100&wt=json") |
| 94 | + (assoc (get-proxy-opts) :as :text)) |
| 95 | + {:keys [_ _ body _]} (deref p 7 {})] |
| 96 | + (if (empty? body) |
| 97 | + [] |
| 98 | + (->> (json/read-str body :key-fn keyword) |
| 99 | + :response |
| 100 | + :docs |
| 101 | + (keep :v))))) |
| 102 | + |
| 103 | +(defn- get-artifacts-from-mvn-central! [] |
| 104 | + (->> ["org.clojure" "com.cognitect"] |
| 105 | + (pmap (fn [group-id] |
| 106 | + (->> group-id |
| 107 | + get-mvn-artifacts! |
| 108 | + (mapv (fn [artifact] |
| 109 | + [(str group-id "/" artifact), |
| 110 | + nil]))))) |
| 111 | + (reduce into []))) |
105 | 112 |
|
106 | 113 | (defn get-clojars-versions!
|
107 | 114 | "Fetches all the versions of particular artifact from Clojars."
|
108 | 115 | [artifact]
|
109 |
| - (let [{:keys [body status]} @(http/get (str "https://clojars.org/api/artifacts/" |
110 |
| - artifact))] |
| 116 | + (let [p (http/get (str "https://clojars.org/api/artifacts/" |
| 117 | + artifact)) |
| 118 | + {:keys [body status]} (deref p 7 {})] |
111 | 119 | (when (= 200 status)
|
112 | 120 | (->> (json/read-str body :key-fn keyword)
|
113 | 121 | :recent_versions
|
|
0 commit comments