Browse files

Use project/defaults for lein search, if needed. Issue #762

  • Loading branch information...
1 parent 26572bc commit 50cbdf909085d81d876899735c588c2e141c0d7a @bruceadams bruceadams committed Sep 1, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/leiningen/search.clj
7 src/leiningen/search.clj
@@ -3,6 +3,7 @@
[clojure.string :as string]
[leiningen.core.user :as user]
[leiningen.core.main :as main]
+ [leiningen.core.project :as core-project]
[clj-http.client :as http])
(:import (org.apache.maven.index IteratorSearchRequest MAVEN NexusIndexer)
(org.apache.maven.index.context IndexingContext)
@@ -109,15 +110,15 @@ Also accepts a second parameter for fetching successive pages."
;; Maven's indexer requires over 1GB of free space for a <100M index
(let [orig-tmp (System/getProperty "")
new-tmp (io/file (user/leiningen-home) "indices" "tmp")
- ;; TODO: check when project is nil
+ project (or project core-project/defaults)
contexts (doall (map add-context (:repositories project)))]
(.mkdirs new-tmp)
(System/setProperty "" (str new-tmp))
(doseq [context contexts]
(when (refresh? (.getRepositoryUrl context) project)
- (update-index context)))
+ (update-index context)))
(search-repository query contexts (Integer. page))
(doall (map remove-context contexts))
- (System/setProperty "" orig-tmp))))))
+ (System/setProperty "" orig-tmp))))))

0 comments on commit 50cbdf9

Please sign in to comment.