boot-check to 0.1.1 + fixing what it caught
This commit is contained in:
parent
0bb137d53f
commit
d2b14d0cb5
3 changed files with 13 additions and 12 deletions
|
|
@ -25,7 +25,7 @@
|
|||
[adzerk/bootlaces "0.1.13" :scope "test"]
|
||||
[adzerk/boot-logservice "1.0.1" :scope "test"]
|
||||
[adzerk/boot-test "1.0.6" :scope "test"]
|
||||
[tolitius/boot-check "0.1.0-SNAPSHOT" :scope "test"]
|
||||
[tolitius/boot-check "0.1.1" :scope "test"]
|
||||
|
||||
;; boot cljs
|
||||
[adzerk/boot-cljs "1.7.170-3" :scope "test"]
|
||||
|
|
@ -96,6 +96,7 @@
|
|||
(set-env! :source-paths #(conj % "dev/clj" "dev/cljs" "test/core" "test/clj" "test/cljs"))
|
||||
;; (load-data-readers!)
|
||||
(comp
|
||||
(check/with-bikeshed)
|
||||
(check/with-eastwood)
|
||||
;; (check/with-yagni) ;; yagni does not yet support (throws on) "cljc"
|
||||
(check/with-kibit)))
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@
|
|||
(or (:order (@meta-state state))
|
||||
(swap! state-seq inc)))
|
||||
|
||||
(deftype NotStartedState [state]
|
||||
Object
|
||||
(toString [this]
|
||||
(deftype NotStartedState [state]
|
||||
Object
|
||||
(toString [this]
|
||||
(str "'" state "' is not started (to start all the states call mount/start)")))
|
||||
|
||||
;;TODO validate the whole lifecycle
|
||||
(defn- validate [{:keys [start stop suspend resume] :as lifecycle}]
|
||||
(cond
|
||||
(cond
|
||||
(not start) (throw-runtime "can't start a stateful thing without a start function. (i.e. missing :start fn)")
|
||||
(and suspend
|
||||
(and suspend
|
||||
(not resume)) (throw-runtime "suspendable state should have a resume function (i.e. missing :resume fn)")))
|
||||
|
||||
(defn- with-ns [ns name]
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
(defn- down [state {:keys [stop status] :as current} done]
|
||||
(when (some status #{:started :suspended})
|
||||
(when stop
|
||||
(when stop
|
||||
(on-error (str "could not stop [" state "] due to")
|
||||
(record! state stop done)))
|
||||
(alter-state! current (NotStartedState. state)) ;; (!) if a state does not have :stop when _should_ this might leak
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
(alter-state! current s)))
|
||||
(update-meta! [state :status] #{:suspended})))
|
||||
|
||||
(defn- sigcont [state {:keys [resume status] :as current} done]
|
||||
(defn- sigcont [state {:keys [resume status] :as current} done]
|
||||
(when (:suspended status)
|
||||
(let [s (on-error (str "could not resume [" state "] due to")
|
||||
(record! state resume done))]
|
||||
|
|
@ -198,7 +198,7 @@
|
|||
|
||||
(defn- bring [states fun order]
|
||||
(let [done (atom [])]
|
||||
(as-> states $
|
||||
(as-> states $
|
||||
(map var-to-str $)
|
||||
(select-keys @meta-state $)
|
||||
(sort-by (comp :order val) order $)
|
||||
|
|
@ -206,13 +206,13 @@
|
|||
@done))
|
||||
|
||||
(defn- merge-lifecycles
|
||||
"merges with overriding _certain_ non existing keys.
|
||||
"merges with overriding _certain_ non existing keys.
|
||||
i.e. :suspend is in a 'state', but not in a 'substitute': it should be overriden with nil
|
||||
however other keys of 'state' (such as :ns,:name,:order) should not be overriden"
|
||||
([state sub]
|
||||
(merge-lifecycles state nil sub))
|
||||
([state origin {:keys [start stop suspend resume status]}]
|
||||
(assoc state :origin origin
|
||||
(assoc state :origin origin
|
||||
:status status
|
||||
:start start :stop stop :suspend suspend :resume resume)))
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
deps (->> (filter (comp any val) refers)
|
||||
(map (comp str second))
|
||||
set)]
|
||||
(assoc (dissoc state :ns)
|
||||
(assoc (dissoc state :ns)
|
||||
:deps deps))))
|
||||
|
||||
#?(:clj
|
||||
|
|
|
|||
Loading…
Reference in a new issue