|
67 | 67 | "Return a sequence of clojure files that represent the custom code in 'code/"
|
68 | 68 | (filter clojure-file? (file-seq (io/file in-dir "code"))))
|
69 | 69 |
|
70 |
| -(defn create-directory-scaffold [base-dir] |
| 70 | +(def example-site-files ["/src/resources/stylesheets/default.css" |
| 71 | + "/src/snippets/ga.clj" |
| 72 | + "/src/posts/2014-01-27-lorem-markdownum.md" |
| 73 | + "/src/posts/2014-01-01-foo-bar.md" |
| 74 | + |
| 75 | + "/src/templates/index.clj" |
| 76 | + "/src/templates/post.clj" |
| 77 | + "/src/templates/base.clj" |
| 78 | + "/src/templates/page.clj" |
| 79 | + |
| 80 | + "/src/code/code.clj" |
| 81 | + "/src/config.clj" |
| 82 | + |
| 83 | + "/src/pages/tags.clj" |
| 84 | + "/src/pages/archives.clj"]) |
| 85 | + |
| 86 | +(defn create-directory-scaffold [site-name] |
71 | 87 | "Create the scaffold for a new website project under 'base-dir'."
|
72 | 88 | (println "Creating directory scaffold.")
|
73 |
| - (doseq [dir ["pages" |
74 |
| - "posts" |
75 |
| - "resources" |
76 |
| - "templates" |
77 |
| - "snippets" |
78 |
| - "code"]] |
79 |
| - (io/make-parents (io/file base-dir "src" dir "dummy"))) |
80 |
| - (io/make-parents (io/file base-dir "site" "dummy")) |
81 |
| - (doseq [path [["templates" "base.clj"] |
82 |
| - ["templates" "index.clj"] |
83 |
| - ["templates" "page.clj"] |
84 |
| - ["templates" "post.clj"]]] |
85 |
| - (spit (apply io/file base-dir "src" path) "")) |
86 |
| - |
87 |
| - (let [scaffold-config {:site-name "FIXME: My Ecstatic Site" |
88 |
| - :site-url "http://FIXME.com" |
89 |
| - :site-description "FIXME: Enter a site description" |
90 |
| - :site-author "FIXME: Enter author's name"}] |
91 |
| - (spit (io/file base-dir "src" "config.clj") |
92 |
| - (with-out-str (pp/pprint scaffold-config)))) |
93 |
| - |
94 |
| - (spit (io/file base-dir ".gitignore") "site/*\nsrc/target/*") |
95 |
| - nil) |
| 89 | + (doseq [f example-site-files] |
| 90 | + (io/make-parents (str site-name f)) |
| 91 | + (spit (str site-name f) (slurp (io/resource (str "example" f)))))) |
0 commit comments