Skip to content

Commit

Permalink
Use leiningen.core.project's idea of default repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
eraserhd committed Jun 17, 2014
1 parent 9258dc6 commit 1f5013c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/leiningen/new.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(:refer-clojure :exclude [new list])
(:require [bultitude.core :as bultitude]
[leiningen.core.classpath :as cp]
[leiningen.core.project :as project]
[leiningen.core.user :as user]
[leiningen.core.main :refer [abort parse-options option-arg]]
[leiningen.new.templates :refer [*dir* *force?*]])
Expand All @@ -11,15 +12,16 @@
(def ^:dynamic *use-snapshots?* false)

(defn- fake-project [name]
{:templates [[(symbol name "lein-template") (if *use-snapshots?*
"(0.0.0,)" "RELEASE")]]
:repositories (reduce
conj
[["clojars" {:url "http://clojars.org/repo/"
:update :always}]
["central" {:url "http://repo1.maven.org/maven2"
:update :always}]]
(-> (user/profiles) :user :plugin-repositories))})
(let [template-symbol (symbol name "lein-template")
template-version (if *use-snapshots?*
"(0.0.0,)"
"RELEASE")
repositories (reduce
(:reduce (meta project/default-repositories))
project/default-repositories
(-> (user/profiles) :user :plugin-repositories))]
{:templates [[template-symbol template-version]]
:repositories repositories}))

(defn resolve-remote-template [name sym]
(try (cp/resolve-dependencies :templates (fake-project name) :add-classpath? true)
Expand Down

0 comments on commit 1f5013c

Please sign in to comment.