This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-21
Channels
- # admin-announcements (4)
- # beginners (41)
- # boot (46)
- # cider (8)
- # clojure (132)
- # clojure-austin (15)
- # clojure-belgium (3)
- # clojure-greece (3)
- # clojure-hk (1)
- # clojure-mexico (4)
- # clojure-quebec (5)
- # clojure-russia (46)
- # clojure-spec (225)
- # clojure-taiwan (1)
- # clojure-uk (17)
- # clojurescript (46)
- # clojurewerkz (1)
- # core-async (28)
- # cursive (9)
- # datascript (3)
- # datomic (5)
- # defnpodcast (42)
- # devcards (60)
- # emacs (27)
- # hoplon (7)
- # lein-figwheel (5)
- # leiningen (12)
- # mount (8)
- # om (13)
- # play-clj (2)
- # reagent (47)
- # rethinkdb (5)
- # ring-swagger (7)
- # spacemacs (9)
- # specter (12)
- # testing (1)
- # untangled (1)
- # vim (11)
- # yada (31)
Hey, I have a slightly hypothetical question: I'm writing some shared library code, and in the ideal case I want it to work either with or without mount. Is there an easy way from my code determine if it's running inside mount? (Eg, whether (mount/start)
has been called or not)
@timgilbert: will this work for you?
dev=> (mount/running-states)
nil
dev=> (mount/start)
...
{:started ["#'app.conf/config" "#'app.db/conn" "#'app.www/nyse-app" "#'app.example/nrepl"]}
dev=>
dev=> (mount/running-states)
("#'app.conf/config" "#'app.db/conn" "#'app.www/nyse-app" "#'app.example/nrepl")
dev=> (mount/stop "#'app.db/conn")
INFO app.db - disconnecting from datomic:
{:stopped ["#'app.db/conn"]}
dev=> (mount/running-states)
("#'app.conf/config" "#'app.www/nyse-app" "#'app.example/nrepl")
Oh, that's great, thanks!
I'll mess around with it and let you know. I'm still in the hammock phase of development right now
sure, let me know. I think running-states
is good to have regardless, so thanks for bringing it up. you could also get it via graph, e.g.:
dev=> (require '[mount.tools.graph :as graph])
nil
dev=> (map :name (filter (comp :started :status) (graph/states-with-deps)))
()
dev=> (mount/start)
...
{:started ["#'app.conf/config" "#'app.db/conn" "#'app.www/nyse-app" "#'app.example/nrepl"]}
dev=> (map :name (filter (comp :started :status) (graph/states-with-deps)))
("#'app.conf/config" "#'app.db/conn" "#'app.www/nyse-app" "#'app.example/nrepl")
i.e. (graph/states-with-deps)
returns: https://github.com/tolitius/mount/issues/12#issuecomment-167150505