(defn start-dirac! []
(require 'dirac.agent)
(let [dirac-boot! (resolve 'dirac.agent/boot!)]
(dirac-boot!)))
(deftask dirac
"run dirac agent"
[]
(with-pre-wrap fileset
(start-dirac!)
fileset))
That’s a first pass at it. with-pre-wrap
is boot.core/with-pre-wrap
Is this typical behavior? Gives me undefined variable, though it’s obviously able to call the function?
Never mind, found the problem under github issues. Must (require ‘my.ns).
But won't doing start-dirac!
try to start it each time you re-run the pipeline (like when you watch and something changes?). I don't think that call is idempotent so it could be a problem.
@jaen you appear to be exactly right. Does putting it before (watch) fix that?
Or do I need to do something like inject a file into the fileset and check that to ensure idempotency?
Both options sound like hacks to me instead of solving the problem TBH.
I just type (start-dirac!)
manually each time and don't mind it, but I can see how it could be a bother.
There was this one thing, let me check…
https://github.com/boot-clj/boot/blob/master/doc/boot.task.built-in.md#repl
:eval
option
I tried to use this, since it seemed like the most appropriate solution
But I couldn't get it to work for some reason.
I suggest asking on the #C053K90BR channel about that
There certainly must be an appropriate way to inject some code to run when the REPL server boots
I thought it was that, but maybe I did something wrong.
Though now I checked #C053K90BR I see they suggested using delay, that also sounds sensible.
(deftask dirac
"run dirac agent"
[]
(let [dirac (delay (start-dirac!))]
(cleanup (.stop @dirac))
(with-pass-thru _ @dirac)))
Yeah :simple_smile:
that lets you use it the same way you’d use (cljs-repl)
I’ll see if I can make a redistributable boot task.
Well, it's not much of a problem to evaluate one form at the start of the session (that's why I didn't bother after :eval
didn't work out), but if that can be automated then - why not!
It's always one less thing to remember.
Yep. I think if it were just me, I might consider living with the extra thing to type
but tooling is so important for adoption, in my opinion. Even among developers, the number of people who won’t read directions is staggering.