Fork me on GitHub
#cursive
<
2019-01-18
>
daniel.spaniel11:01:42

I have a ring app which uses mount to refresh stateful components. How do I refresh the server from a running REPL in cursive?

joelsanchez11:01:18

(mount/stop #'server) (mount/start #'server), or just clojure.tools.namespace.repl/refresh if you changed code and it affects the server, because the server will be restarted automatically

daniel.spaniel11:01:25

should i run that command in a REPL running in cusrive/IntelliJ or ? command line ?

daniel.spaniel11:01:21

i am super newbie and you can picture a squid flailing in the ocean to describe me apptitude with clojre right now

daniel.spaniel11:01:47

i loaded dev.user.clj file into the repl and with that command (mount/start .. ) i got N-> o such namespace: mount, ...

daniel.spaniel11:01:04

even though mount is required and declared in the require section of dev.user

joelsanchez11:01:53

sure, alias it

joelsanchez11:01:00

(require '[mount.core :as mount])

joelsanchez11:01:12

yes, you should run it from the repl

joelsanchez11:01:31

also you should switch to the namespace where the server is, or refer to it

joelsanchez11:01:52

assuming it is my.app.server, (in-ns 'my.app.server)

joelsanchez11:01:21

and assuming you want to stay in the user ns, (require '[my.app.server :as server]) and then (mount/start #'server/server)

daniel.spaniel12:01:38

what do you mean by my.app.server ? i am aiming to run server locally for development

daniel.spaniel12:01:43

thanks for your help though .. i think what your telling me is correct, i am using datomic though so that is my sticking point. if it were not for that library ( not loading ) it would work fine

joelsanchez12:01:00

ok so you say you have a server as a stateful component. that component must be in a namespace

joelsanchez12:01:17

that namespace is what I mean by my.app.server, I don't know which name it has in your app

daniel.spaniel13:01:48

@U5LPUJ7AP thanks again for your help/time .. i think i got it ( i set up a REPL and had to set the alias to -> dev <- so it would be able to find the datomic libraries and i was able to mount/start the server

gphilipp11:01:16

Hi @cfleming We’ve been doing some work involving tools.depsand we sometimes depend on sub-modules (sub-directories really). I have noticed that Cursive (wrongly) highlights some valid occurrences of symbols. Is there any reason you would mark those as invalid ?

boris16:01:34

@gphilipp while clojure will allow you to use a symbol with multiple slashes in it, those are considered invalid symbols according to the language spec https://clojure.org/reference/reader#_symbols. If you try the same symbol in clojurescript instead, you would get that "Invalid Symbol" exception.

boris16:01:38

Another place where I've run into issues with clj and cljs parity in the past (seems better now) is allowing keywords to start with a number. Technically the spec forbids it but it seems like both implementations are pretty permissive on that front.

kenny19:01:31

Every time I hit the refresh button in the Clojure Deps panel, I've noticed all of the tabs switch to show the file name. Then when I click on a tab, it switches to the namespace name (i.e. from foo.clj -> c.c.foo).