Compare commits
10 commits
137705e81c
...
eb709b9555
Author | SHA1 | Date | |
---|---|---|---|
eb709b9555 | |||
c19068c872 | |||
3e2581f475 | |||
7e365f9c22 | |||
243d3679c2 | |||
|
ee937e05fe | ||
|
afeef539b5 | ||
|
0d9fd29ea7 | ||
|
dc7d345094 | ||
|
423790edb1 |
5 changed files with 31 additions and 11 deletions
|
@ -13,7 +13,7 @@
|
||||||
Additional Features:
|
Additional Features:
|
||||||
|
|
||||||
* Navmap feature for nested navigation (see: https://github.com/cryogen-project/cryogen-core/pull/81)
|
* Navmap feature for nested navigation (see: https://github.com/cryogen-project/cryogen-core/pull/81)
|
||||||
* Theme default can be read from classpath, filesystem overwrites.
|
* Spring like Overlay-Filesystem: Theme can be published bundled in a jar but you can easily place your overwrites in filesystem.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
15
project.clj
15
project.clj
|
@ -1,11 +1,11 @@
|
||||||
(defproject dda/cryogen-core "0.2.1-SNAPSHOT"
|
(defproject dda/cryogen-core "0.2.4-SNAPSHOT"
|
||||||
: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"
|
||||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.10.1"]
|
:dependencies [[org.clojure/clojure "1.10.1"]
|
||||||
[camel-snake-kebab "0.4.1"]
|
[camel-snake-kebab "0.4.1"]
|
||||||
[cheshire "5.9.0"]
|
[cheshire "5.10.0"]
|
||||||
[clj-rss "0.2.5"]
|
[clj-rss "0.2.5"]
|
||||||
[clj-text-decoration "0.0.3"]
|
[clj-text-decoration "0.0.3"]
|
||||||
[enlive "1.1.6"]
|
[enlive "1.1.6"]
|
||||||
|
@ -29,4 +29,13 @@
|
||||||
:exclusions [commons-logging]}}
|
:exclusions [commons-logging]}}
|
||||||
:test {:source-paths ["test"]
|
:test {:source-paths ["test"]
|
||||||
:resource-paths ["test-resources"]
|
:resource-paths ["test-resources"]
|
||||||
:dependencies [[dda/dummy "0.1.0-SNAPSHOT"]]}})
|
:dependencies [[dda/dummy "0.1.0-SNAPSHOT"]]}}
|
||||||
|
:release-tasks [["vcs" "assert-committed"]
|
||||||
|
["change" "version" "leiningen.release/bump-version" "release"]
|
||||||
|
["vcs" "commit"]
|
||||||
|
["vcs" "tag"]
|
||||||
|
["deploy"]
|
||||||
|
["uberjar"]
|
||||||
|
["change" "version" "leiningen.release/bump-version"]
|
||||||
|
["vcs" "commit"]
|
||||||
|
["vcs" "push"]])
|
||||||
|
|
|
@ -34,10 +34,19 @@
|
||||||
[ignore-patterns source-list]
|
[ignore-patterns source-list]
|
||||||
(filter #(not (re-matches (re-pattern ignore-patterns) %)) source-list))
|
(filter #(not (re-matches (re-pattern ignore-patterns) %)) source-list))
|
||||||
|
|
||||||
|
(defn filter-one-pattern
|
||||||
|
[ignore-patterns resources]
|
||||||
|
(if (not (empty? (:virtual-path (first resources))))
|
||||||
|
(filter #(not (re-matches ignore-patterns (:virtual-path %))) resources)
|
||||||
|
resources))
|
||||||
|
|
||||||
(defn filter-resources-for-ignore-patterns
|
(defn filter-resources-for-ignore-patterns
|
||||||
[ignore-patterns resources]
|
[ignore-patterns resources]
|
||||||
(filter #(not (re-matches (re-pattern ignore-patterns) (:virtual-path %)))
|
(let [ignore-patterns (into [] ignore-patterns)
|
||||||
resources))
|
pattern (peek ignore-patterns)]
|
||||||
|
(if pattern
|
||||||
|
(filter-resources-for-ignore-patterns (pop ignore-patterns) (filter-one-pattern pattern resources))
|
||||||
|
resources)))
|
||||||
|
|
||||||
(defn resource-from-cp-or-fs ;:- Resource
|
(defn resource-from-cp-or-fs ;:- Resource
|
||||||
[fs-prefix ;:- Prefix
|
[fs-prefix ;:- Prefix
|
||||||
|
|
|
@ -41,8 +41,9 @@
|
||||||
(let [base-path "templates/md"
|
(let [base-path "templates/md"
|
||||||
resources (cp-io/get-resources
|
resources (cp-io/get-resources
|
||||||
fs-prefix base-path [pages posts])
|
fs-prefix base-path [pages posts])
|
||||||
filtered-resources (->> (filter #(= (:resource-type %) :dir) resources)
|
filtered-resources (cp-io/filter-resources-for-ignore-patterns ignore-patterns
|
||||||
(cp-io/distinct-resources-by-path))]
|
(->> (filter #(= (:resource-type %) :dir) resources)
|
||||||
|
(cp-io/distinct-resources-by-path)))]
|
||||||
filtered-resources))
|
filtered-resources))
|
||||||
|
|
||||||
(defn create-dirs-from-markup-folders!
|
(defn create-dirs-from-markup-folders!
|
||||||
|
@ -75,6 +76,7 @@ if no, return empty vector."
|
||||||
(->> assets
|
(->> assets
|
||||||
filter-file
|
filter-file
|
||||||
filter-ext
|
filter-ext
|
||||||
|
(cp-io/filter-resources-for-ignore-patterns ignored-files)
|
||||||
(map get-java-file))))
|
(map get-java-file))))
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
(sut/get-distinct-markup-dirs
|
(sut/get-distinct-markup-dirs
|
||||||
"./not-existing-get-from-cp"
|
"./not-existing-get-from-cp"
|
||||||
"test_posts" "test_pages"
|
"test_posts" "test_pages"
|
||||||
""))))))
|
[#""]))))))
|
||||||
|
|
||||||
(deftest test-create-dirs-from-markup-folders!
|
(deftest test-create-dirs-from-markup-folders!
|
||||||
(is
|
(is
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
"./not-existing-get-from-cp"
|
"./not-existing-get-from-cp"
|
||||||
"test_posts"
|
"test_posts"
|
||||||
"test_pages"
|
"test_pages"
|
||||||
target-tmp "")
|
target-tmp [#""])
|
||||||
(and (ftt/verify-dir-exists
|
(and (ftt/verify-dir-exists
|
||||||
(str target-tmp "/test_pages"))
|
(str target-tmp "/test_pages"))
|
||||||
(ftt/verify-dir-exists
|
(ftt/verify-dir-exists
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
(is
|
(is
|
||||||
(let [target-tmp "target/tmp-test-copy-resources-from-theme"]
|
(let [target-tmp "target/tmp-test-copy-resources-from-theme"]
|
||||||
(sut/delete-resources! target-tmp)
|
(sut/delete-resources! target-tmp)
|
||||||
(sut/copy-resources-from-theme! "./" theme target-tmp "")
|
(sut/copy-resources-from-theme! "./" theme target-tmp [#""])
|
||||||
(and (ftt/verify-dir-exists
|
(and (ftt/verify-dir-exists
|
||||||
(str target-tmp "/js"))
|
(str target-tmp "/js"))
|
||||||
(ftt/verify-file-exists
|
(ftt/verify-file-exists
|
||||||
|
|
Loading…
Reference in a new issue