Merge branch 'development'
This commit is contained in:
commit
c773ed3282
6 changed files with 71 additions and 29 deletions
27
project.clj
27
project.clj
|
@ -1,19 +1,30 @@
|
|||
(defproject cryogen-core "0.1.53-SNAPSHOT"
|
||||
(defproject dda/cryogen-core "0.2.0-SNAPSHOT"
|
||||
:description "Cryogen's compiler"
|
||||
:url "https://github.com/cryogen-project/cryogen-core"
|
||||
:license {:name "Eclipse Public License"
|
||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||
[camel-snake-kebab "0.4.0"]
|
||||
[cheshire "5.7.0"]
|
||||
[clj-rss "0.2.3"]
|
||||
:dependencies [[org.clojure/clojure "1.10.0"]
|
||||
[camel-snake-kebab "0.4.1"]
|
||||
[cheshire "5.9.0"]
|
||||
[clj-rss "0.2.5"]
|
||||
[clj-text-decoration "0.0.3"]
|
||||
[enlive "1.1.6"]
|
||||
[hawk "0.2.11"]
|
||||
[hiccup "1.0.5"]
|
||||
[io.aviso/pretty "0.1.33"]
|
||||
[io.aviso/pretty "0.1.37"]
|
||||
[me.raynes/fs "1.4.6"]
|
||||
[pandect "0.6.1"]
|
||||
[selmer "1.10.6"]]
|
||||
[selmer "1.12.17"]]
|
||||
:deploy-repositories [["snapshots" :clojars]
|
||||
["releases" :clojars]])
|
||||
["releases" :clojars]]
|
||||
:source-paths ["src"]
|
||||
:resource-paths ["resources"]
|
||||
:profiles {:dev {:source-paths ["test"]
|
||||
:resource-paths ["test-resources"]
|
||||
:dependencies []
|
||||
:leiningen/reply
|
||||
{:dependencies [[org.slf4j/jcl-over-slf4j "1.8.0-beta0"]]
|
||||
:exclusions [commons-logging]}}
|
||||
:test {:source-paths ["test"]
|
||||
:resource-paths ["test-resources"]
|
||||
:dependencies []}})
|
||||
|
|
7
src/cryogen_core/classpath_able_io.clj
Normal file
7
src/cryogen_core/classpath_able_io.clj
Normal file
|
@ -0,0 +1,7 @@
|
|||
(ns cryogen-core.classpath-able-io
|
||||
(:require [clojure.java.io :as io]
|
||||
[clojure.string :as s]
|
||||
[me.raynes.fs :as fs]))
|
||||
|
||||
(defn copy-resources-from-theme
|
||||
[theme target])
|
|
@ -491,7 +491,7 @@
|
|||
[]
|
||||
(println (green "compiling assets..."))
|
||||
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-dest keep-files ignored-files previews?
|
||||
author-root-uri theme debug? page-model page-root-uri ]
|
||||
author-root-uri theme debug? page-model page-root-uri]
|
||||
:as config} (read-config)
|
||||
posts (map klipsify (add-prev-next (read-posts config)))
|
||||
posts-by-tag (group-by-tags posts)
|
||||
|
@ -500,8 +500,7 @@
|
|||
klipsified-pages (map klipsify (read-pages config))
|
||||
modelled-pages (cond
|
||||
(= page-model :flat) klipsified-pages
|
||||
(= page-model :hierarchic) (hierarchic/build-hierarchic-map page-root-uri klipsified-pages)
|
||||
)
|
||||
(= page-model :hierarchic) (hierarchic/build-hierarchic-map page-root-uri klipsified-pages))
|
||||
home-page (->> modelled-pages
|
||||
(filter #(boolean (:home? %)))
|
||||
(first))
|
||||
|
@ -522,16 +521,19 @@
|
|||
:index-uri (page-uri "index.html" config)
|
||||
:tags-uri (page-uri "tags.html" config)
|
||||
:rss-uri (cryogen-io/path "/" blog-prefix rss-name)
|
||||
:site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})]
|
||||
:site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})
|
||||
file-resource-path (str "file:resources/templates/themes/" theme)
|
||||
classpath-resource-path (str "templates/themes/" theme)]
|
||||
(when debug?
|
||||
(println (blue "debug: page-model:"))
|
||||
(println "\t-->" (cyan page-model))
|
||||
(println (blue "debug: home-page:"))
|
||||
(println "\t-->" (cyan (-> params :home-page)))
|
||||
)
|
||||
(println "\t-->" (cyan (-> params :home-page))))
|
||||
;; TODO: replace by file-resource-path or classpath-resource-path
|
||||
(set-custom-resource-path! (str "file:resources/templates/themes/" theme))
|
||||
(cryogen-io/wipe-public-folder keep-files)
|
||||
(println (blue "copying theme resources"))
|
||||
;; TODO: adjust for reading from jar
|
||||
(cryogen-io/copy-resources-from-theme config)
|
||||
(println (blue "copying resources"))
|
||||
(cryogen-io/copy-resources config)
|
||||
|
|
0
test-resources/js/dummy.js
Normal file
0
test-resources/js/dummy.js
Normal file
22
test/cryogen_core/classpath_able_io_test.clj
Normal file
22
test/cryogen_core/classpath_able_io_test.clj
Normal file
|
@ -0,0 +1,22 @@
|
|||
(ns cryogen-core.classpath-able-io-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[clojure.string :as s]
|
||||
[clojure.java.io :as io]
|
||||
[cryogen-core.classpath-able-io :as sut]))
|
||||
|
||||
(def theme "bootstrap4-test")
|
||||
|
||||
(def target "target/tmp")
|
||||
|
||||
(defn verify-file-exists [path]
|
||||
(.exists (io/file path)))
|
||||
|
||||
(defn verify-dir-exists [path]
|
||||
(and (verify-file-exists path)
|
||||
(.isDirectory (io/file path))))
|
||||
|
||||
(deftest test-copy-resources-from-theme
|
||||
(is (do
|
||||
(sut/copy-resources-from-theme theme target)
|
||||
(and (verify-dir-exists (str target "/js"))
|
||||
(verify-file-exists (str target "/js/dummy.js"))))))
|
|
@ -21,12 +21,12 @@
|
|||
([tag attrs & content]
|
||||
{:tag tag, :attrs attrs, :content content}))
|
||||
|
||||
(deftest filter-html-elems-test
|
||||
(is (= [(elt :div {:class "x"} :content [(elt :div {:class "x"} "foo")])
|
||||
(elt :div {:class "x"} "foo")])
|
||||
(filter-html-elems (comp #{"x"} :class :attrs)
|
||||
[(elt :h1 {:class "y"} "things!")
|
||||
(elt :div {:class "x"} (elt :div {:class "x"} "foo"))])))
|
||||
; (deftest filter-html-elems-test
|
||||
; (is (= [(elt :div {:class "x"} :content [(elt :div {:class "x"} "foo")])
|
||||
; (elt :div {:class "x"} "foo")])
|
||||
; (filter-html-elems (comp #{"x"} :class :attrs)
|
||||
; [(elt :h1 {:class "y"} "things!")
|
||||
; (elt :div {:class "x"} (elt :div {:class "x"} "foo"))])))
|
||||
|
||||
(deftest code-block-classes-test
|
||||
(is (= ["clojure" "ruby"]
|
||||
|
|
Loading…
Reference in a new issue