"mob next [ci-skip]"

master
Jan Krebs 5 years ago
parent 88cf7dd3df
commit ea3f626283

@ -10,6 +10,16 @@
(:require [clojure.java.io :as io]
[clojure.string :as s]))
(def public "resources/public")
(defn path
"Creates path from given parts, ignore empty elements"
[& path-parts]
(->> path-parts
(remove s/blank?)
(s/join "/")
(#(s/replace % #"/+" "/"))))
(defn filter-for-ignore-patterns
[ignore-patterns source-list]
(filter #(not (re-matches ignore-patterns %)) source-list))
@ -75,8 +85,8 @@
(do-copy source-file target-file ignore-patterns))))
(defn copy-resources-from-theme
[fs-prefix theme target-path]
[fs-prefix theme target-path ignore-patterns]
(let [theme-path (str "templates/themes/" theme)]
(copy-resources fs-prefix (str theme-path "/css") target-path "")
(copy-resources fs-prefix (str theme-path "/js") target-path "")
(copy-resources fs-prefix (str theme-path "/html/") target-path "")))
(copy-resources fs-prefix (str theme-path "/css") target-path ignore-patterns)
(copy-resources fs-prefix (str theme-path "/js") target-path ignore-patterns)
(copy-resources fs-prefix (str theme-path "/html/") target-path ignore-patterns)))

@ -8,6 +8,7 @@
[selmer.util :refer [set-custom-resource-path!]]
[text-decoration.core :refer :all]
[cryogen-core.io :as cryogen-io]
[cryogen-core.classpath-able-io :as cp-io]
[cryogen-core.klipse :as klipse]
[cryogen-core.markup :as m]
[cryogen-core.rss :as rss]
@ -533,8 +534,10 @@
(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)
(cp-io/copy-resources-from-theme "resources/templates/themes/"
theme
(cp-io/path "resources/public" blog-prefix)
ignored-files)
(println (blue "copying resources"))
(cryogen-io/copy-resources config)
(copy-resources-from-markup-folders config)

@ -42,7 +42,7 @@
(deftest test-copy-resources-from-theme
(is (do
(sut/copy-resources-from-theme "./" theme target)
(sut/copy-resources-from-theme "./" theme target "")
(and (verify-dir-exists
(str target "/templates/themes/bootstrap4-test/js"))
(verify-file-exists

Loading…
Cancel
Save