Added predicate is-yaml?

This commit is contained in:
Clemens Geibel 2022-04-13 13:39:55 +02:00
parent bb750ac610
commit 76206a28ba

View file

@ -2,6 +2,7 @@
(:require (:require
[clojure.java.io :as io] [clojure.java.io :as io]
[clj-yaml.core :as yaml] [clj-yaml.core :as yaml]
[clojure.string :as cs]
[clojure.walk] [clojure.walk]
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[dda.c4k-common.predicate :as cp])) [dda.c4k-common.predicate :as cp]))
@ -22,6 +23,12 @@
[edn cp/map-or-seq?] [edn cp/map-or-seq?]
(yaml/generate-string edn :dumper-options {:flow-style :block})) (yaml/generate-string edn :dumper-options {:flow-style :block}))
(defn-spec is-yaml? boolean?
[filename string?]
(or
(cs/ends-with? filename ".yaml")
(cs/ends-with? filename ".yml")))
(defn dispatch-by-resource-name (defn dispatch-by-resource-name
[resource] [resource]
:clj) :clj)