added an error check for parsing the config.edn

This commit is contained in:
Yogthos 2015-04-02 22:22:17 -04:00
parent 97de91ca90
commit e0d3676196
2 changed files with 21 additions and 18 deletions

View file

@ -1,4 +1,4 @@
(defproject cryogen-core "0.1.20"
(defproject cryogen-core "0.1.21"
:description "Cryogen's compiler"
:url "https://github.com/lacarmen/cryogen-core"
:license {:name "Eclipse Public License"

View file

@ -266,23 +266,26 @@
(defn read-config
"Reads the config file"
[]
(let [config (-> "templates/config.edn"
get-resource
slurp
read-string
(update-in [:blog-prefix] (fnil str ""))
(update-in [:rss-name] (fnil str "rss.xml"))
(update-in [:rss-filters] (fnil seq []))
(update-in [:sass-src] (fnil str "css"))
(update-in [:sass-dest] (fnil str "css"))
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
(update-in [:keep-files] (fnil seq []))
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])))]
(merge
config
{:page-root (root-path :page-root config)
:post-root (root-path :post-root config)
:tag-root (root-path :tag-root config)})))
(try
(let [config (-> "templates/config.edn"
get-resource
slurp
read-string
(update-in [:blog-prefix] (fnil str ""))
(update-in [:rss-name] (fnil str "rss.xml"))
(update-in [:rss-filters] (fnil seq []))
(update-in [:sass-src] (fnil str "css"))
(update-in [:sass-dest] (fnil str "css"))
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
(update-in [:keep-files] (fnil seq []))
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])))]
(merge
config
{:page-root (root-path :page-root config)
:post-root (root-path :post-root config)
:tag-root (root-path :tag-root config)}))
(catch Exception _
(throw (IllegalArgumentException. "Failed to parse config.edn")))))
(defn compile-assets
"Generates all the html and copies over resources specified in the config"