dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
2016-03-11T04:50:05.000464Z

(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))

2016-03-11T04:50:30.000465Z

That’s a first pass at it. with-pre-wrap is boot.core/with-pre-wrap

2016-03-11T06:08:16.000467Z

Is this typical behavior? Gives me undefined variable, though it’s obviously able to call the function?

2016-03-11T06:12:22.000469Z

Never mind, found the problem under github issues. Must (require ‘my.ns).

jaen 2016-03-11T12:41:38.000470Z

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.

2016-03-11T18:44:17.000471Z

@jaen you appear to be exactly right. Does putting it before (watch) fix that?

2016-03-11T18:44:48.000472Z

Or do I need to do something like inject a file into the fileset and check that to ensure idempotency?

jaen 2016-03-11T20:20:53.000473Z

Both options sound like hacks to me instead of solving the problem TBH.

jaen 2016-03-11T20:20:54.000474Z

I just type (start-dirac!) manually each time and don't mind it, but I can see how it could be a bother.

jaen 2016-03-11T20:21:02.000475Z

There was this one thing, let me check…

jaen 2016-03-11T20:21:57.000478Z

:eval option

jaen 2016-03-11T20:22:13.000480Z

I tried to use this, since it seemed like the most appropriate solution

jaen 2016-03-11T20:22:21.000481Z

But I couldn't get it to work for some reason.

jaen 2016-03-11T20:22:29.000482Z

I suggest asking on the #C053K90BR channel about that

jaen 2016-03-11T20:22:54.000483Z

There certainly must be an appropriate way to inject some code to run when the REPL server boots

jaen 2016-03-11T20:23:08.000485Z

I thought it was that, but maybe I did something wrong.

jaen 2016-03-11T20:27:26.000486Z

Though now I checked #C053K90BR I see they suggested using delay, that also sounds sensible.

2016-03-11T20:28:19.000487Z

(deftask dirac
  "run dirac agent"
  []
  (let [dirac (delay (start-dirac!))]
    (cleanup (.stop @dirac))
    (with-pass-thru _ @dirac)))

2016-03-11T20:28:21.000488Z

Yeah :simple_smile:

2016-03-11T20:28:40.000489Z

that lets you use it the same way you’d use (cljs-repl)

2016-03-11T20:28:58.000491Z

I’ll see if I can make a redistributable boot task.

jaen 2016-03-11T20:33:02.000492Z

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!

jaen 2016-03-11T20:33:07.000493Z

It's always one less thing to remember.

2016-03-11T20:39:07.000494Z

Yep. I think if it were just me, I might consider living with the extra thing to type

2016-03-11T20:39:37.000495Z

but tooling is so important for adoption, in my opinion. Even among developers, the number of people who won’t read directions is staggering.