Switch fully qualified namespace to use require
This commit is contained in:
parent
84c201c6e1
commit
a091a377b0
|
@ -1,7 +1,9 @@
|
||||||
(ns shapey-shifty.posts.posts-io
|
(ns shapey-shifty.posts.posts-io
|
||||||
(:require
|
(:require
|
||||||
[shapey-shifty.posts.core :as core]
|
[shapey-shifty.posts.core :as core]
|
||||||
[shapey-shifty.authors.author-core :as author]))
|
[shapey-shifty.authors.author-core :as author]
|
||||||
|
[clojure.java.io :as io]
|
||||||
|
))
|
||||||
|
|
||||||
(def post-filename "post.edn")
|
(def post-filename "post.edn")
|
||||||
(def base-posts-path "resources/posts")
|
(def base-posts-path "resources/posts")
|
||||||
|
@ -16,7 +18,7 @@
|
||||||
(let [path (pathmap-to-path dt-path)
|
(let [path (pathmap-to-path dt-path)
|
||||||
final-path (format "%s/%s" base-posts-path path)]
|
final-path (format "%s/%s" base-posts-path path)]
|
||||||
(->> final-path
|
(->> final-path
|
||||||
clojure.java.io/file
|
io/file
|
||||||
file-seq
|
file-seq
|
||||||
(filter #(.isDirectory %))
|
(filter #(.isDirectory %))
|
||||||
count
|
count
|
||||||
|
@ -26,7 +28,7 @@
|
||||||
(let [path (pathmap-to-path dt-path)
|
(let [path (pathmap-to-path dt-path)
|
||||||
increment (inc (count-posts-in-date dt-path))
|
increment (inc (count-posts-in-date dt-path))
|
||||||
final-path (format "%d/%d/%d/%d" base-posts-path path increment post-filename)]
|
final-path (format "%d/%d/%d/%d" base-posts-path path increment post-filename)]
|
||||||
(clojure.java.io/make-parents final-path)
|
(io/make-parents final-path)
|
||||||
(spit final-path (pr-str post))))
|
(spit final-path (pr-str post))))
|
||||||
|
|
||||||
(defn assoc-author [post]
|
(defn assoc-author [post]
|
||||||
|
@ -41,5 +43,5 @@
|
||||||
(-> file slurp read-string assoc-author)))
|
(-> file slurp read-string assoc-author)))
|
||||||
([dt-path n]
|
([dt-path n]
|
||||||
(let [path (format "%s/%s/%s/%s" base-posts-path (pathmap-to-path dt-path) n post-filename)
|
(let [path (format "%s/%s/%s/%s" base-posts-path (pathmap-to-path dt-path) n post-filename)
|
||||||
f (clojure.java.io/file path)]
|
f (io/file path)]
|
||||||
(read-post f))))
|
(read-post f))))
|
||||||
|
|
Loading…
Reference in New Issue