diff --git a/src/cryogen_core/classpath_able_io.clj b/src/cryogen_core/classpath_able_io.clj index a8d6598..0456457 100644 --- a/src/cryogen_core/classpath_able_io.clj +++ b/src/cryogen_core/classpath_able_io.clj @@ -69,7 +69,7 @@ ; TODO: rename? Allow base-path to be ""? ; base-path must not be "" -(defn get-resources-recursive ;:- [Resource] +(defn get-resources ;:- [Resource] [fs-prefix ;:- Prefix base-path ;:- VirtualPath paths ;:- [VirtualPath] @@ -96,7 +96,7 @@ :or {from-cp true from-fs true}}] (map #(:virtual-path %) - (get-resources-recursive + (get-resources fs-prefix base-path paths :from-cp from-cp :from-fs from-fs))) @@ -127,7 +127,7 @@ (let [resources (sort this/compare-resource - (get-resources-recursive fs-prefix base-path source-paths))] + (get-resources fs-prefix base-path source-paths))] (if (empty? resources) (throw (IllegalArgumentException. (str "resource " base-path ", " source-paths " not found"))) diff --git a/src/cryogen_core/new_io.clj b/src/cryogen_core/new_io.clj index c303842..80d2c03 100644 --- a/src/cryogen_core/new_io.clj +++ b/src/cryogen_core/new_io.clj @@ -38,7 +38,7 @@ (defn get-distinct-markup-dirs [fs-prefix posts pages ignore-patterns] (let [base-path "templates/md" - resources (cp-io/get-resources-recursive + resources (cp-io/get-resources fs-prefix base-path [pages posts]) filtered-resources (->> (filter #(= (:resource-type %) :dir) resources) (cp-io/distinct-resources-by-path))] diff --git a/test/cryogen_core/classpath_able_io_test.clj b/test/cryogen_core/classpath_able_io_test.clj index 89175a4..e01ecf7 100644 --- a/test/cryogen_core/classpath_able_io_test.clj +++ b/test/cryogen_core/classpath_able_io_test.clj @@ -23,41 +23,41 @@ "folder21/file212"] (sort (map ftt/filter-path - (sut/get-resources-recursive + (sut/get-resources "fs_root" "base2" ["folder21" "file22"])))))) -(deftest test-get-resources-recursive +(deftest test-get-resources (is (= [] - (sut/get-resources-recursive "" "templates/themes/bootstrap4-test" ["not-existing"]))) + (sut/get-resources "" "templates/themes/bootstrap4-test" ["not-existing"]))) (is (= [{:virtual-path "dummy_from_jar", :source-type :java-classpath-jar, :resource-type :file}] (map ftt/filter-object - (sut/get-resources-recursive "not-existing" "dummy" ["dummy_from_jar"])))) + (sut/get-resources "not-existing" "dummy" ["dummy_from_jar"])))) (is (= (sort ["dummy2/dummy2_from_jar" "dummy2/dummy_common" "dummy2" "dummy_from_jar" "dummy_from_fs" "dummy2/dummy2_from_fs"]) (sort (map ftt/filter-path - (sut/get-resources-recursive "fs_root" "dummy" + (sut/get-resources "fs_root" "dummy" ["dummy_from_jar" "dummy_from_fs" "dummy2"]))))) (is (= [{:virtual-path "js/dummy.js" :source-type :java-classpath-filesystem :resource-type :file}] (map ftt/filter-object - (sut/get-resources-recursive + (sut/get-resources "" "templates/themes/bootstrap4-test" ["js/dummy.js"])))) (is (= [] - (sut/get-resources-recursive + (sut/get-resources "" "templates/themes/bootstrap4-test" ["js/dummy.js"] :from-cp false))) (is (= ["js/subdir" "js/subdir/subdummy.js" "js/subdir/test.js"] (sort (map :virtual-path - (sut/get-resources-recursive + (sut/get-resources "" "templates/themes/bootstrap4-test" ["js/subdir"]))))) (is (= ["." @@ -72,7 +72,7 @@ "./js/subdir/subdummy.js" "./js/subdir/test.js"] (sort (map :virtual-path - (sut/get-resources-recursive + (sut/get-resources "test-resources" "templates/themes/bootstrap4-test" ["."])))))) (deftest test-distinct-resources-by-path