using spec & fixing expound
This commit is contained in:
parent
9138ba5764
commit
4664f6b5d3
4 changed files with 25 additions and 14 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,17 +1,22 @@
|
|||
# pybuilder
|
||||
.pybuilder/
|
||||
__pycache__/
|
||||
|
||||
# lein
|
||||
target/
|
||||
.lein-repl-history
|
||||
.lein-failures
|
||||
|
||||
# cljs
|
||||
.shadow-cljs
|
||||
.nrepl-*
|
||||
package-lock.json
|
||||
node_modules/
|
||||
public/js/
|
||||
|
||||
# ide
|
||||
.calva
|
||||
|
||||
*.iml
|
||||
.idea/
|
||||
.lein-repl-history
|
||||
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
(:gen-class)
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[expound.alpha :as expound]
|
||||
[clojure.java.io :as io]
|
||||
[dda.k8s-mastodon-bot.core :as core]))
|
||||
|
||||
(alter-var-root #'s/*explain-out* (constantly expound/printer))
|
||||
|
||||
(s/def ::options (s/* #{"-h"}))
|
||||
(s/def ::args (s/cat :options ::options))
|
||||
|
||||
(def usage
|
||||
"usage:
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
(ns dda.k8s-mastodon-bot.core
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as cs]
|
||||
[expound.alpha :as expound]
|
||||
[orchestra.core :refer-macros [defn-spec]]
|
||||
[mastodon-bot.core-domain :as cd]
|
||||
[dda.k8s-mastodon-bot.yaml :as yaml]
|
||||
))
|
||||
|
||||
(alter-var-root #'s/*explain-out* (constantly expound/printer))
|
||||
|
||||
(s/def ::options (s/* #{"-h"}))
|
||||
(s/def ::config map?)
|
||||
(s/def ::auth map?)
|
||||
(s/def ::args (s/cat :options ::options
|
||||
:config ::config
|
||||
:auth ::auth))
|
||||
|
||||
(defn generate-config [my-config my-auth]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "config.yaml"))
|
||||
|
@ -26,7 +17,9 @@
|
|||
(->
|
||||
(yaml/from-string (yaml/load-resource "deployment.yaml"))))
|
||||
|
||||
(defn generate [my-config my-auth]
|
||||
(defn-spec generate any?
|
||||
[my-config cd/config?
|
||||
my-auth cd/auth?]
|
||||
(cs/join "\n"
|
||||
[(yaml/to-string (generate-config my-config my-auth))
|
||||
"---"
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
(ns dda.k8s-mastodon-bot.browser
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.spec.test.alpha :as st]
|
||||
[expound.alpha :as expound]
|
||||
[dda.k8s-mastodon-bot.core :as core]))
|
||||
|
||||
(set! s/*explain-out* expound/printer)
|
||||
|
||||
(defn config-from-document []
|
||||
(-> js/document
|
||||
(.getElementById "config")
|
||||
|
@ -25,3 +30,6 @@
|
|||
(.addEventListener "click"
|
||||
#(-> (core/generate (config-from-document) (auth-from-document))
|
||||
(render-to-document)))))
|
||||
|
||||
|
||||
(st/instrument 'dda.k8s-mastodon-bot.core)
|
||||
|
|
Loading…
Reference in a new issue