Skip to content

Commit

Permalink
Rename sanitize-dir back to sanitize.
Browse files Browse the repository at this point in the history
Shouldn't have done this in the first place. It breaks all external templates for
no good reason.
  • Loading branch information
Raynes committed Apr 29, 2012
1 parent f123643 commit 067d1d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -1,4 +1,4 @@
(defproject lein-newnew "0.3.0"
(defproject lein-newnew "0.3.1"
:description "A Leiningen plugin for generating new projects based on templates."
:dependencies [[stencil "0.2.0"]
[bultitude "0.1.5"]]
Expand Down
4 changes: 2 additions & 2 deletions src/leiningen/new/plugin.clj
@@ -1,5 +1,5 @@
(ns leiningen.new.plugin
(:use [leiningen.new.templates :only [renderer name-to-path year ->files]]))
(:use [leiningen.new.templates :only [renderer sanitize year ->files]]))

(defn plugin
"A leiningen plugin project template."
Expand All @@ -10,7 +10,7 @@
name)
data {:name name
:unprefixed-name unprefixed
:sanitized (name-to-path unprefixed)
:sanitized (sanitize unprefixed)
:year (year)}]
(println (str "Generating a fresh Leiningen plugin called " name "."))
(->files data
Expand Down
4 changes: 2 additions & 2 deletions src/leiningen/new/template.clj
@@ -1,12 +1,12 @@
(ns leiningen.new.template
(:use [leiningen.new.templates :only [renderer name-to-path year ->files]]))
(:use [leiningen.new.templates :only [renderer sanitize year ->files]]))

(defn template
"A meta-template for 'lein new' templates."
[name]
(let [render (renderer "template")
data {:name name
:sanitized (name-to-path name)
:sanitized (sanitize name)
:placeholder "{{sanitized}}"
:year (year)}]
(println "Generating fresh 'lein new' template project.")
Expand Down
6 changes: 3 additions & 3 deletions src/leiningen/new/templates.clj
Expand Up @@ -26,7 +26,7 @@
[resource-path]
(-> resource-path io/resource io/reader slurp))

(defn sanitize-dir
(defn sanitize
"Replace hyphens with underscores."
[s]
(string/replace s #"-" "_"))
Expand All @@ -39,7 +39,7 @@
and so on. Uses platform-specific file separators."
[s]
(-> s sanitize-dir (string/replace #"\." java.io.File/separator)))
(-> s sanitize (string/replace #"\." java.io.File/separator)))

(defn sanitize-ns
"Returns project namespace name from (possibly group-qualified) project name:
Expand Down Expand Up @@ -81,7 +81,7 @@
[name]
(fn [template & [data]]
(let [path (string/join "/" ["leiningen" "new" name
(sanitize-dir template)])]
(sanitize template)])]
(if data
(render-text (slurp-resource path) data)
(io/reader (io/resource path))))))
Expand Down

0 comments on commit 067d1d9

Please sign in to comment.