Skip to content

Commit

Permalink
Try solving #640 with BC
Browse files Browse the repository at this point in the history
  • Loading branch information
winks committed Jun 20, 2012
1 parent b9c1178 commit fedb6ba
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/leiningen/pom.clj
Expand Up @@ -94,6 +94,22 @@
(defmulti ^:private xml-tags (defmulti ^:private xml-tags
(fn [tag value] (keyword "leiningen.pom" (name tag)))) (fn [tag value] (keyword "leiningen.pom" (name tag))))


(defn- guess-scm [project]
"Returns the name of the SCM used in project.clj or \"auto\" if nonexistant.
Example: :scm {:name \"git\" :tag \"deadbeef\"}"
(or (-> project :scm :name) "auto"))

(defn- xmlify [scm]
"Converts the map identified by :scm"
(map #(xml-tags (first %) (second %)) scm))

(defn- write-scm-tag [scm project]
"Write the <scm> tag for pom.xml.
Retains backwards compatibility without an :scm map."
(if
(= "auto" scm)
(make-git-scm (io/file (:root project) ".git"))
(xml-tags :scm (xmlify (:scm project)))))
(defmethod xml-tags :default (defmethod xml-tags :default
([tag value] ([tag value]
(when value (when value
Expand Down Expand Up @@ -276,7 +292,7 @@
(xml-tags :url (:url project)) (xml-tags :url (:url project))
(xml-tags :license (:license project)) (xml-tags :license (:license project))
(xml-tags :mailing-list (:mailing-list project)) (xml-tags :mailing-list (:mailing-list project))
(make-git-scm (io/file (:root project) ".git")) (write-scm-tag (guess-scm project) project)
(xml-tags :build [project test-project]) (xml-tags :build [project test-project])
(xml-tags :repositories (:repositories project)) (xml-tags :repositories (:repositories project))
(xml-tags :dependencies (xml-tags :dependencies
Expand Down

0 comments on commit fedb6ba

Please sign in to comment.