[#15]: removing "clojure.tools.logging" dep
as part of minimizing library dependencies, removing clojure.tools.logging not to force it on mount clients
This commit is contained in:
parent
2e0279aef7
commit
f967e8e11a
2 changed files with 6 additions and 12 deletions
|
|
@ -7,12 +7,12 @@
|
||||||
:source-paths ["src"]
|
:source-paths ["src"]
|
||||||
|
|
||||||
:dependencies [[org.clojure/clojure "1.7.0"]
|
:dependencies [[org.clojure/clojure "1.7.0"]
|
||||||
[ch.qos.logback/logback-classic "1.1.3"]
|
|
||||||
[org.clojure/tools.logging "0.3.1"]
|
|
||||||
[org.clojure/tools.macro "0.1.2"]]
|
[org.clojure/tools.macro "0.1.2"]]
|
||||||
|
|
||||||
:profiles {:dev {:source-paths ["dev" "test/app"]
|
:profiles {:dev {:source-paths ["dev" "test/app"]
|
||||||
:dependencies [[yesql "0.5.1"]
|
:dependencies [[yesql "0.5.1"]
|
||||||
|
[ch.qos.logback/logback-classic "1.1.3"]
|
||||||
|
[org.clojure/tools.logging "0.3.1"]
|
||||||
[org.clojure/tools.namespace "0.2.11"]
|
[org.clojure/tools.namespace "0.2.11"]
|
||||||
[org.clojure/tools.nrepl "0.2.11"]
|
[org.clojure/tools.nrepl "0.2.11"]
|
||||||
[com.datomic/datomic-free "0.9.5327" :exclusions [joda-time]]]}})
|
[com.datomic/datomic-free "0.9.5327" :exclusions [joda-time]]]}})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
(ns mount.core
|
(ns mount.core
|
||||||
(:require [clojure.tools.macro :as macro]
|
(:require [clojure.tools.macro :as macro]))
|
||||||
[clojure.tools.logging :refer [info]]))
|
|
||||||
|
|
||||||
;; (defonce ^:private session-id (System/currentTimeMillis))
|
;; (defonce ^:private session-id (System/currentTimeMillis))
|
||||||
(defonce ^:private mount-state 42)
|
(defonce ^:private mount-state 42)
|
||||||
|
|
@ -46,16 +45,14 @@
|
||||||
|
|
||||||
(defn- record! [{:keys [ns name]} f done]
|
(defn- record! [{:keys [ns name]} f done]
|
||||||
(let [state (f)]
|
(let [state (f)]
|
||||||
(swap! done conj (str ns "/" name))
|
(swap! done conj (ns-resolve ns name))
|
||||||
state))
|
state))
|
||||||
|
|
||||||
(defn- up [var {:keys [ns name start started? resume suspended?] :as state} done]
|
(defn- up [var {:keys [ns name start started? resume suspended?] :as state} done]
|
||||||
(when-not started?
|
(when-not started?
|
||||||
(let [s (try (if suspended?
|
(let [s (try (if suspended?
|
||||||
(do (info ">> resuming.. " name)
|
(record! state resume done)
|
||||||
(record! state resume done))
|
(record! state start done))
|
||||||
(do (info ">> starting.. " name)
|
|
||||||
(record! state start done)))
|
|
||||||
(catch Throwable t
|
(catch Throwable t
|
||||||
(throw (RuntimeException. (str "could not start [" name "] due to") t))))]
|
(throw (RuntimeException. (str "could not start [" name "] due to") t))))]
|
||||||
(intern ns (symbol name) s)
|
(intern ns (symbol name) s)
|
||||||
|
|
@ -63,7 +60,6 @@
|
||||||
|
|
||||||
(defn- down [var {:keys [ns name stop started? suspended?] :as state} done]
|
(defn- down [var {:keys [ns name stop started? suspended?] :as state} done]
|
||||||
(when (or started? suspended?)
|
(when (or started? suspended?)
|
||||||
(info "<< stopping.. " name)
|
|
||||||
(when stop
|
(when stop
|
||||||
(try
|
(try
|
||||||
(record! state stop done)
|
(record! state stop done)
|
||||||
|
|
@ -74,7 +70,6 @@
|
||||||
|
|
||||||
(defn- sigstop [var {:keys [ns name started? suspend resume] :as state} done]
|
(defn- sigstop [var {:keys [ns name started? suspend resume] :as state} done]
|
||||||
(when (and started? resume) ;; can't have suspend without resume, but the reverse is possible
|
(when (and started? resume) ;; can't have suspend without resume, but the reverse is possible
|
||||||
(info ">> suspending.. " name)
|
|
||||||
(when suspend ;; don't suspend if there is only resume function (just mark it :suspended?)
|
(when suspend ;; don't suspend if there is only resume function (just mark it :suspended?)
|
||||||
(let [s (try (record! state suspend done)
|
(let [s (try (record! state suspend done)
|
||||||
(catch Throwable t
|
(catch Throwable t
|
||||||
|
|
@ -86,7 +81,6 @@
|
||||||
(when (instance? NotStartedState var)
|
(when (instance? NotStartedState var)
|
||||||
(throw (RuntimeException. (str "could not resume [" name "] since it is stoppped (i.e. not suspended)"))))
|
(throw (RuntimeException. (str "could not resume [" name "] since it is stoppped (i.e. not suspended)"))))
|
||||||
(when suspended?
|
(when suspended?
|
||||||
(info ">> resuming.. " name)
|
|
||||||
(let [s (try (record! state resume done)
|
(let [s (try (record! state resume done)
|
||||||
(catch Throwable t
|
(catch Throwable t
|
||||||
(throw (RuntimeException. (str "could not resume [" name "] due to") t))))]
|
(throw (RuntimeException. (str "could not resume [" name "] due to") t))))]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue