Merge pull request #1489 from CraZySacX/group-name

Add group-name to templates.clj
This commit is contained in:
Phil Hagelberg 2014-04-03 13:27:48 -07:00
commit b9fc0d24c5

View file

@ -87,6 +87,17 @@
(string/replace "/" ".")
(string/replace "_" "-")))
(defn group-name
"Returns group name from (a possibly unqualified) name:
my.long.group/myproj => my.long.group
mygroup/myproj => mygroup
myproj => nil"
[s]
(let [grpseq (butlast (string/split (sanitize-ns s) #"\."))]
(if (seq grpseq)
(->> grpseq (interpose ".") (apply str)))))
(defn year
"Get the current year. Useful for setting copyright years and such."
[] (+ (.getYear (java.util.Date.)) 1900))