Fork me on GitHub
#boot
<
2017-01-07
>
richiardiandrea00:01:19

so newbie question, how can I have doc, apropos, ... in all the namespaces of my project?

richiardiandrea00:01:36

(without require-ing them)

micha00:01:01

you can add those to the clojure.core namespace

micha00:01:09

which is automatically required

richiardiandrea00:01:01

oh nice idea, I wonder why it is not the default 😄

micha00:01:15

haha right

richiardiandrea00:01:44

I can even use boot repl :eval I guess for that or :init

micha00:01:01

or in profile.boot maybe?

richiardiandrea00:01:24

using replace-task! ?

micha00:01:52

oh, i was saying like

richiardiandrea00:01:25

yeah I am trying too

micha00:01:26

macros are not so easy

richiardiandrea00:01:02

(var-get (ns-resolve 'clojure.repl 'doc)) needs two args

micha00:01:10

clojure.core/intern

richiardiandrea00:01:59

actually maybe three

richiardiandrea00:01:38

no sorry that is garbage

richiardiandrea00:01:34

but it is replacing, not interning

richiardiandrea00:01:45

anyways no big deal 😄

micha00:01:58

sweet yeah

richiardiandrea00:01:05

maybe a boot task for this is a good idea 😉

micha00:01:10

then you need to refer i think too

micha00:01:30

if the namespace you're in was alraedy compiled

richiardiandrea00:01:48

I think it works without, I am doing it at runtime...

micha00:01:53

you could use the boot-shim.clj file to inject your things

micha00:01:05

that is evaluated before any namespaces are compiled

richiardiandrea00:01:14

boot-shim.clj is new to me let me check

micha00:01:28

you can put clojure expressions in there

micha00:01:40

it's most useful for monkeypatching clojure.core

richiardiandrea00:01:30

yeah, but where does it need to go? $HOME/.boot ?

richiardiandrea00:01:43

source does not really work dunno why, but ok

micha00:01:13

you could probably make something fancy that uses ns-publics to find the vars in the repl namespace and automatically intern them

richiardiandrea00:01:36

but I like copy paste lol

richiardiandrea00:01:33

(not true, but I feel always in a rush when I spend time these kind of things)

richiardiandrea00:01:10

yeah I used to use it with lein

richiardiandrea00:01:03

there is quite a lot in there

richiardiandrea01:01:33

probably the :injections part can just be copied in boot-shim.clj the problem is what happens when a pod does not have it on the classpath?

micha01:01:15

you can use boot.pod/add-dependencies perhaps

micha01:01:37

sneakily add the dependency without affecting :dependencies in the env

micha01:01:48

you can add it in a pod even

micha01:01:10

and the functions/macros you intern could call in to functions in the pod

richiardiandrea01:01:32

Ah right, or just use a when I guess

micha01:01:07

doing boot.pod/make-pod in your boot-shim.clj thing would be pretty slick

micha01:01:21

or i suppose you could add the dependency to the worker pod

micha01:01:36

save the overhead of another pod

richiardiandrea01:01:00

Yeah I think this is more needed in the repl pod

micha01:01:11

oh yeah durr

richiardiandrea01:01:17

Now that I think of it

richiardiandrea01:01:43

yeah I will explore more, vyniasa is something I have always wanted to port to boot

richiardiandrea01:01:53

Editors mask the need of doc but the other functions are super useful, I wonder if dep hotload works ..Will try more

zilti14:01:53

What's the boot equivalent to java-source-paths?

flyboarder16:01:42

@zilti: are you just looking to add files to the classpath?

zilti16:01:07

@flyboarder: Sorta. I have a .java file in the src dir. "boot javac" compiles it correctly, but I can't access the class from a subsequent repl or when starting the prog from a task. Well, for now I think I'm working with lein for this...

juhoteperi16:01:33

@zilti You need to run javac in the same pipeline as repl or app

juhoteperi16:01:41

boot javac app or boot javac repl

juhoteperi16:01:10

or you can add it as part of your existing dev or such task

Chris Bidler22:01:04

so I have in build.boot (set-env! :resource-paths #{”src” “js”} …) and this fileset:

build.boot
src/
| ...
js/
| index.cljs.edn
…
and, at a REPL, I execute: boot.user => (boot (comp (cljs) (target))

Chris Bidler22:01:18

would I not expect there to be an index.jssomewhere?

Chris Bidler22:01:49

oh, hm, that seems to not be what I actually want to do anyway - when I run boot cljs -c '{:target :nodejs}’ target from a terminal I just get the index.js I want instead of main.js

Chris Bidler22:01:53

huh, so boot cljs -c '{:target :nodejs}’ creates index.js, but boot.user> (boot (cljs :compiler-options {:target :nodejs})) creates main.js

Chris Bidler22:01:08

I’m not sure what I’m doing wrong there

Chris Bidler22:01:12

aaand nevermind again - must be that the REPL had an out-of-date view of the files on disk because after a couple rounds of rm and touch I’ve convinced myself that the CLI will also make main.js if there’s no index.cljs.edn lying about