Fork me on GitHub
#boot
<
2017-02-20
>
anmonteiro04:02:51

@micha only now getting to try out your suggestion of boot.pod/add-classpath to add a local JAR to the classpath

anmonteiro04:02:24

The JAR in question is the current master of the ClojureScript compiler

anmonteiro04:02:40

but it seems that it doesn’t get picked up by e.g. boot-cljs

anmonteiro04:02:34

and I’m unsure if it will given that Boot-cljs creates a pod to run the compiler in based on the :dependencies of the current env https://github.com/boot-clj/boot-cljs/blob/master/src/adzerk/boot_cljs.clj#L96

anmonteiro04:02:08

I don’t think I can get away without actually specifying a dependency in my set-env! call

richiardiandrea05:02:41

The problem is exactly what you describe @anmonteiro at the moment there is no easy way to add stuff to it after a pod is created

richiardiandrea05:02:08

By iirc there is a way to get all the pods spinned up

richiardiandrea05:02:59

It think it is boot.pod/pods

richiardiandrea05:02:38

I have never tried myself but I am be curious to see if add-classpath works so if you try please do report back

anmonteiro05:02:05

I tried add-classpath but I couldn’t get it to work

richiardiandrea05:02:01

I mean on a pod in pods .. not the default pod though

richiardiandrea05:02:24

You need to fetch the one created by boot-cljs

anmonteiro05:02:51

I don’t know how I can do that before boot-cljs starting the compilation process

richiardiandrea05:02:31

Yeah It is created after the first "run"

richiardiandrea05:02:12

There have been some talk about this particular problem, I personally wanted to avoid calling set-env! and pass the env to each pipeline, but we haven't got any plan for it

anmonteiro05:02:19

the hack I came up with is having the JAR in a directory in my repo

anmonteiro05:02:29

and I set :local-repo to that directory

anmonteiro05:02:40

let’s see if it works. CI is running now

anmonteiro05:02:27

looks like it’s working

richiardiandrea05:02:04

Great, nice workaround then!

minikomi07:02:00

Hi there. Can someone give me a hand using :checkouts with a leiningen-based clojurescript dependency? I've gotten as far as boot telling me Adding checkout dependency ~~.. but I'm unsure how to edit/update a local version and have it rebuild

micha14:02:34

@minikomi the idea of :checkouts is that the consuming process consumes the checkout jar file

micha14:02:46

it doesn't build the checkout depenedncy

micha14:02:58

so you want to have two separate processes

micha14:02:14

one to build the checkout dependency and install it in your local maven .m2 repo

micha14:02:31

and then the boot process with :checkouts that will consume that jar

micha14:02:43

and rebuild the project when the jar's contents change

pleasetrythisathome14:02:46

so i found a bug with boot-cljs

pleasetrythisathome14:02:51

short discussion here

pleasetrythisathome14:02:18

but wanted to mention it here to make sure my understanding of the intended behavior is correct, and not just what works for my use case

bhagany16:02:38

re-upping this, for the non-weekend crowd. Basic question is - are records supported as input to pods?: https://clojurians.slack.com/archives/boot/p1487515021017257

micha16:02:59

if you use with-call-in you may pass java objects as arguments to the function you are calling

micha16:02:09

that means that the arguments are not serialized

micha16:02:26

however, this does not mean that you can pass clojure objects that way

micha16:02:07

that will not work, because objects created by one clojure runtime do not implement the same interfaces and are not the same classes as the ones with the same name in another clojure runtime

micha16:02:32

that is to say, if i create a vector in pod A and pass it to a function in pod B like this:

micha16:02:08

actually one sec

micha16:02:51

ok sorry, had a momentary lapse of reason

bhagany16:02:11

I'm a frequent sufferer myself 🙂

micha16:02:25

haha i will caffeinate

micha17:02:16

so i think if you make sure that data readers are set up correctly in both pods before you try to pass records back and forth it should work

bhagany17:02:30

ah, yes - I can make it work. I guess I'm asking, should I?

micha17:02:53

i don't know of a reason not to

bhagany17:02:01

okay, works for me. thanks!

micha17:02:06

any time 🙂

micha17:02:14

there is also boot.pod/with-pod

micha17:02:17

which is interesting

bhagany17:02:26

hmm, I'll take a look

micha17:02:47

that will automagically require the record's namespace in the pod

micha17:02:49

for example

bhagany17:02:02

that sounds like exactly what I want

bhagany17:02:45

yep, at first glance, looks perfect

micha17:02:56

boot.user=> (def m 42)
#'boot.user/m
boot.user=> (defn f [x] (+ x m))
#'boot.user/f
boot.user=> (def p (boot.pod/make-pod (get-env)))
#'boot.user/p
boot.user=> (boot.pod/with-pod p (~f 100))
142

micha17:02:16

it will be slow if the expression you send is very large

micha17:02:34

because it needs to use heavy reflection to make things work transparently like that

bhagany17:02:48

okay, that makes sense. is with-pod relatively new?

micha17:02:59

it's been there for the past couple of releases

micha17:02:13

but i'm not so comfortable with the approach

micha17:02:19

because of the performance implications

micha17:02:28

so it's kind of experimental

bhagany17:02:35

okay, I see

micha17:02:54

i hope that maybe it can be improved upon

micha17:02:05

but we won't remove it

micha17:02:32

we may need to make some minor tweaks maybe if there is a huge performance gain that is worthwhile to do

micha17:02:50

but if people are using it for small expressions maybe not even then

bhagany17:02:20

it wouldn't be too hard for me to jury-rig something that does the same stuff as with-call-in, except that it requires the function namespace before deserializing any clojure args, which would be enough for my use case. If the performance takes a significant hit, I'll just do that.

bhagany17:02:57

thanks again

mobileink17:02:41

Hi booters. Anybody interested in producing professional-quality documentation for boot is welcome to contribute to https://github.com/mobileink/boot-documentation-library. The catch is you have to use DITA.

mobileink19:02:03

@micha: just curious, as an old fart, what does an upside down laughing parrot mean? it looks amusing, but i can't interpret it. :)

borkdude17:02:43

How do I make a global exclusion in boot, so I don’t have to exclude cljsjs/react on a lot of libraries?

micha19:02:43

it's the universal symbol for excitement and celebration

mobileink19:02:13

man, i feel old. 😂

micha19:02:26

i believe there is one of those on the plaque they sent witht he voyager spacecraft

micha19:02:37

and also in the dead sea scrolls

mobileink19:02:15

it probably came to us from the aliens.

mobileink20:02:35

i do hope nobody is too frightened or intimidated by DITA. It's a lot like Clojure: bit of a learning curve, but in the end peerless for its purpose. Very compositional, you create lots of pieces that do one thing well, then you compose them.

mobileink20:02:17

for really first-rate documentation it has no competitors.

mobileink20:02:14

i particularly like the indexing capabilities. makes a big difference for noobs groping around the docs.

micha20:02:17

yeah good index is key

mobileink20:02:59

hi again, booters. if you're interested in Alexa/Echo development, check out https://github.com/migae/boot-ask. First cut, I could use some beta testers. Feedback warmly welcomed.

qqq20:02:57

is there a boot task that demonstrates how to do this: (1) on (watch) (2) for each file processed, parse out the symbol after (def or (defn or (defmacro ? I know there are other tools to do this (like etags / imenu), but I want an example for oding this in boot so I can build more complciated exampleson top of it

dominicm20:02:46

@qqq boot-sass does things for each new file. tools.reader is probably what you want for defs

dominicm20:02:25

@qqq sorry, boot-sass doesn't use tools.reader. You'd just operate on the files plainly with tools.reader

qqq20:02:10

related debugging question:

qqq20:02:24

boot works via (comp ..... ) is there a way to see all the intermediate data being passed around?

qqq20:02:43

I know there's some 'fileset' and 'output' being passed around, but if I could somehow 'see' it, it'd help me understand how this works

mobileink20:02:09

watch just kicks off a pipeline, so i'm not sure what you mean by "each file proccessed".

qqq20:02:29

so every time a file is changed, I want to be notified

esanmiguelc20:02:02

qqq: there’s a notify task

qqq20:02:36

so I can reprocess it looking for (def (defn an d(defmacro

mobileink20:02:07

i do this a lot using ns stuff, like ns-interns, ns-publics, etc

qqq20:02:38

great, do you have sample code I can steal?

mobileink20:02:08

to see stuff : show -f

mobileink20:02:30

not for a few days, but jus play around with the ns stuff in a repl, you'll see.

mobileink21:02:51

play with the fns listed at the bottom of https://clojure.org/reference/namespaces.

qqq21:02:57

I know how to use the namespace functions.

qqq21:02:20

What I can't figure out is: how to add a task in boot which (1) looks at modified files, (2) runs tool.reader to prse it for (def (defn (defmacro

qqq21:02:36

Just extracting symbol names from namespaces doesn't work -- I need mre info to output emacs auto completion stuff/docs

qqq21:02:08

I think ou're seeing (def (defn (defmacro and thinking "oh, he just needs the symbol names -> look at namesapce functions" The situation is -- I need to parse *.cljs files to output yasnippets -- and I mention (def (defn (defmacro because once I can parse those, I can utput the yasnippets

mobileink21:02:12

1) modified namespaces, not files (I think?) 2) what more info? fwiw, i decorate the stuff i'm interested in with metadata; of course this requires a macro. e.g. (defcomponent foo .. ) adds metadata to the var. that way my tooling can pull out the vars of interest.

qqq21:02:17

I don't want to jump into the details of whatelse needs to be extrated -- but symbol names / meta data does not suffice, and I need the actual sexp of the def/defn/defmacro.

mobileink21:02:37

you want to generate yasnippets from .cljs files?

qqq21:02:28

I have a clojure function of type "cljs file ==> list of yasnippets" My question is: how do I inject this function into the boot pipeline so it's called whenever a *.cljs file is updated.

mobileink21:02:12

i think (but am not sure) that if you want to manipulate the actual defining code of a fn (the sexp) you need macros. do you have an example?

qqq21:02:39

@mobileink: this is getting off-topic for boot, should I PM you?

mobileink21:02:18

ok. good chance i misunderstand you anyway. 😉

richiardiandrea21:02:10

feedback is welcome folks ^

mobileink22:02:18

example, please?

mobileink22:02:58

what problem does this solve?

richiardiandrea22:02:33

It is a declarative approach for boot tasks

mobileink22:02:49

personally i would prefer deftask-edn.

richiardiandrea22:02:53

Yeah naming is hard 😄

qqq22:02:02

yeah, I'd prefer deftask-edn too defedntask looks weird

mobileink22:02:04

but why do we need it? i'm not saying no, just not sure why i would be interested. to me boot tasks are already "declarative".

qqq22:02:16

it looks like defendtask and I'm thiking "what am I defendig vs, is this tower defense for boot" ?

mobileink22:02:48

what's the use case that makes it prefereable?

mobileink22:02:41

not trying to beat you up, just sayin'.

richiardiandrea22:02:15

An example is here , I mainly need it for sharing conf and reuse, but is also avoids calling set-env many times manually and globally (actually it is a global call anyways, but one only)

richiardiandrea22:02:07

The conf is local and you are never going to have two tasks calling set-env twice with different stuff

mobileink22:02:23

example is where?

richiardiandrea22:02:27

I have used it with profit in that project

richiardiandrea22:02:51

Which has quite a complicated build pipeline

richiardiandrea22:02:28

It also easer setting java properties thanks to :props. One thing I would like to remove is the comp for tasks, it does no give any value

richiardiandrea22:02:50

And you cannot conj on :pipeline

mobileink22:02:44

so you're talking about a task that generates tasks?

mobileink22:02:18

you know there is a limit to the ability of the human mind to keep track of abstractions. esp. mine. 😉

richiardiandrea22:02:28

It is a macro that generates tasks

richiardiandrea22:02:44

Well, this is kind of an easy one I hope 😀

mobileink22:02:58

it sounds like an interesting idea, in any case.

richiardiandrea22:02:34

I found that a bit more structure was good for me, and I am collecting feedback in order to see if it can be for others 🙂

qqq22:02:18

a naive cynic might view this as re-writing lein in boot, but in my opinion, whenever people exploit the data/code duality, neat things happen

richiardiandrea22:02:26

@qqq totally agree, I like the declarative approach and I like to have the choice, so why not exploit the more flexibility in boot and kind of ease things up a bit

richiardiandrea22:02:09

Maybe we can win lein users as well (lol)

mobileink22:02:25

since deftask is already a macro that generates tasks, defedntask (or whatever) seems ill-advised.

richiardiandrea22:02:47

Jokes aside, as long as it is useful, for me it is allowed

qqq22:02:51

@richiardiandrea : I think a nice thing about your approach (vs lein) is that route A = trying to do impure stuff in lein route B = in boot, saying "this section is declarative" routeB is much easier because you just force it to be all data, whereas routeA -- I still have no idea how to o that

qqq22:02:31

however, unless you rename it deftask-edn, I'm probably not using it 🙂

qqq22:02:38

defedntask just looks too weird

richiardiandrea22:02:49

A way to make things pure is to pass data in and let the framework do that side effect

richiardiandrea22:02:20

So it is already 2 votes, enough against my only vote...I will change it

mobileink22:02:33

fwiw, i do not know what "declarative" means. Clojure fn defns are purely declarative.

qqq22:02:19

there are many related definitions of declarative; to me, in clojure, the I use the most if: pure-data, things consisting of lists, vectors, maps, keywords, strings, and numbers

mobileink22:02:47

deftask-with-edn or (with-edn deftask ...) would be clearer, imho.

qqq22:02:03

deftask-with-edn looks too long

qqq22:02:05

I like deftask-edn

richiardiandrea22:02:06

Uhmmm ...Declarative yes, pure...depends on what you do within it, in general of course everything is data because we are playing with a lisp 😀

richiardiandrea22:02:01

You know I like (with-edn ...) but wouldn't it be too cryptic?

mobileink22:02:46

well, fwiw, the whole "pure" thing is total hogwash. there are no "pure" languages of practical use; they are all sinful, tainted by IO at the least.

richiardiandrea22:02:34

That is why you make them pure with things like Io monads

mobileink22:02:12

@richiardiandrea could be too cryptic but on the other hand it is a common idiom.

qqq22:02:21

mobileink: theres Haskell

mobileink22:02:40

over-rated.

richiardiandrea22:02:40

This doesn't mean we should not try to abstract over this impurity to make things easier for the final user

richiardiandrea22:02:22

Like Haskell did with the Io monad...Does not make it pure, but it improves user experience (in theory)

mobileink22:02:08

haskell monads do not solve the problem. they just move it. the hard fact is you cannot do io in a functional language, period, end of story.

richiardiandrea22:02:39

Agree, but in theory things are more readable and manageable for developers that way, which apparently saves money, which apparently is a good thing

flyboarder23:02:16

I also agree with renaming it took too many attempts to read the function name 😛

richiardiandrea23:02:42

lol I will rename it then

richiardiandrea23:02:56

overwhelming majority

flyboarder23:02:02

i dont know that I really see the use for it tho, it's almost as much typing as just writing a task?? what is your use case?

richiardiandrea23:02:06

with the caveat that the :pipeline key needs to be made a sequence probably

flyboarder23:02:12

thats a really clean lookin file