Merge pull request #78 from tuhlmann/master
Provided fixes make cryogen work on Windows.
This commit is contained in:
commit
31d51def2f
4 changed files with 23 additions and 13 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,3 +8,5 @@ pom.xml.asc
|
||||||
/.lein-*
|
/.lein-*
|
||||||
/.nrepl-port
|
/.nrepl-port
|
||||||
.DS*
|
.DS*
|
||||||
|
/.idea/
|
||||||
|
/cryogen-core.iml
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(defproject cryogen-core "0.1.43"
|
(defproject cryogen-core "0.1.44"
|
||||||
:description "Cryogen's compiler"
|
:description "Cryogen's compiler"
|
||||||
:url "https://github.com/cryogen-project/cryogen-core"
|
:url "https://github.com/cryogen-project/cryogen-core"
|
||||||
:license {:name "Eclipse Public License"
|
:license {:name "Eclipse Public License"
|
||||||
|
|
|
@ -85,7 +85,8 @@
|
||||||
[^java.io.File page config markup]
|
[^java.io.File page config markup]
|
||||||
(with-open [rdr (java.io.PushbackReader. (reader page))]
|
(with-open [rdr (java.io.PushbackReader. (reader page))]
|
||||||
(let [re-root (re-pattern (str "^.*?(" (:page-root config) "|" (:post-root config) ")/"))
|
(let [re-root (re-pattern (str "^.*?(" (:page-root config) "|" (:post-root config) ")/"))
|
||||||
page-name (s/replace (str page) re-root "")
|
page-fwd (s/replace (str page) "\\" "/") ;; make it work on Windows
|
||||||
|
page-name (s/replace page-fwd re-root "")
|
||||||
file-name (s/replace page-name (re-pattern-from-ext (m/ext markup)) ".html")
|
file-name (s/replace page-name (re-pattern-from-ext (m/ext markup)) ".html")
|
||||||
page-meta (read-page-meta page-name rdr)
|
page-meta (read-page-meta page-name rdr)
|
||||||
content ((m/render-fn markup) rdr config)]
|
content ((m/render-fn markup) rdr config)]
|
||||||
|
@ -434,6 +435,8 @@
|
||||||
(update-in [:rss-filters] (fnil seq []))
|
(update-in [:rss-filters] (fnil seq []))
|
||||||
(update-in [:sass-src] (fnil str "css"))
|
(update-in [:sass-src] (fnil str "css"))
|
||||||
(update-in [:sass-dest] (fnil str "css"))
|
(update-in [:sass-dest] (fnil str "css"))
|
||||||
|
(update-in [:sass-path] (fnil str "sass"))
|
||||||
|
(update-in [:compass-path] (fnil str "compass"))
|
||||||
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
|
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
|
||||||
(update-in [:keep-files] (fnil seq []))
|
(update-in [:keep-files] (fnil seq []))
|
||||||
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])))]
|
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])))]
|
||||||
|
@ -448,7 +451,7 @@
|
||||||
"Generates all the html and copies over resources specified in the config"
|
"Generates all the html and copies over resources specified in the config"
|
||||||
[]
|
[]
|
||||||
(println (green "compiling assets..."))
|
(println (green "compiling assets..."))
|
||||||
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-src sass-dest keep-files ignored-files previews? author-root-uri] :as config} (read-config)
|
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-src sass-dest sass-path compass-path keep-files ignored-files previews? author-root-uri] :as config} (read-config)
|
||||||
posts (add-prev-next (read-posts config))
|
posts (add-prev-next (read-posts config))
|
||||||
pages (add-prev-next (read-pages config))
|
pages (add-prev-next (read-pages config))
|
||||||
[navbar-pages sidebar-pages] (group-pages pages)
|
[navbar-pages sidebar-pages] (group-pages pages)
|
||||||
|
@ -495,7 +498,9 @@
|
||||||
(rss/make-filtered-channels config posts-by-tag)
|
(rss/make-filtered-channels config posts-by-tag)
|
||||||
(println (blue "compiling sass"))
|
(println (blue "compiling sass"))
|
||||||
(sass/compile-sass->css!
|
(sass/compile-sass->css!
|
||||||
{:src-sass sass-src
|
{:path-sass sass-path
|
||||||
|
:path-compass compass-path
|
||||||
|
:src-sass sass-src
|
||||||
:dest-sass (path ".." "public" blog-prefix sass-dest)
|
:dest-sass (path ".." "public" blog-prefix sass-dest)
|
||||||
:ignored-files ignored-files
|
:ignored-files ignored-files
|
||||||
:base-dir "resources/templates/"})))
|
:base-dir "resources/templates/"})))
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
(defn sass-installed?
|
(defn sass-installed?
|
||||||
"Checks for the installation of Sass."
|
"Checks for the installation of Sass."
|
||||||
[]
|
[path-sass]
|
||||||
(= 0 (:exit (sh "sass" "--version"))))
|
(= 0 (:exit (sh path-sass "--version"))))
|
||||||
|
|
||||||
(defn compass-installed?
|
(defn compass-installed?
|
||||||
"Checks for the installation of Compass."
|
"Checks for the installation of Compass."
|
||||||
[]
|
[path-compass]
|
||||||
(try
|
(try
|
||||||
(= 0 (:exit (sh "compass" "--version")))
|
(= 0 (:exit (sh path-compass "--version")))
|
||||||
(catch java.io.IOException _
|
(catch java.io.IOException _
|
||||||
false)))
|
false)))
|
||||||
|
|
||||||
|
@ -38,11 +38,13 @@
|
||||||
done by sh / launching the sass command."
|
done by sh / launching the sass command."
|
||||||
[{:keys [src-sass
|
[{:keys [src-sass
|
||||||
dest-sass
|
dest-sass
|
||||||
|
path-sass
|
||||||
|
path-compass
|
||||||
base-dir]}]
|
base-dir]}]
|
||||||
(shell/with-sh-dir base-dir
|
(shell/with-sh-dir base-dir
|
||||||
(if (compass-installed?)
|
(if (compass-installed? path-compass)
|
||||||
(sh "sass" "--compass" "--update" (str src-sass ":" dest-sass))
|
(sh path-sass "--compass" "--update" (str src-sass ":" dest-sass))
|
||||||
(sh "sass" "--update" (str src-sass ":" dest-sass)))))
|
(sh path-sass "--update" (str src-sass ":" dest-sass)))))
|
||||||
|
|
||||||
(defn compile-sass->css!
|
(defn compile-sass->css!
|
||||||
"Given a directory src-sass, looks for all sass files and compiles them into
|
"Given a directory src-sass, looks for all sass files and compiles them into
|
||||||
|
@ -50,10 +52,11 @@ dest-sass. Prompts you to install sass if he finds sass files and can't find
|
||||||
the command. Shows you any problems it comes across when compiling. "
|
the command. Shows you any problems it comes across when compiling. "
|
||||||
[{:keys [src-sass
|
[{:keys [src-sass
|
||||||
dest-sass
|
dest-sass
|
||||||
|
path-sass
|
||||||
ignored-files
|
ignored-files
|
||||||
base-dir] :as opts}]
|
base-dir] :as opts}]
|
||||||
(when-let [sass-files (seq (find-sass-files base-dir src-sass ignored-files))]
|
(when-let [sass-files (seq (find-sass-files base-dir src-sass ignored-files))]
|
||||||
(if (sass-installed?)
|
(if (sass-installed? path-sass)
|
||||||
;; I found sass files,
|
;; I found sass files,
|
||||||
;; If sass is installed
|
;; If sass is installed
|
||||||
(do
|
(do
|
||||||
|
|
Loading…
Reference in a new issue