Fork me on GitHub
#boot
<
2016-01-30
>
richiardiandrea00:01:28

I too the liberty of modifying the Fileset wiki and add the sample edn

seancorfield03:01:46

Boot new 0.3.0 — https://github.com/seancorfield/boot-new — streamlined dependencies, improved built-in templates, expanded readme!

mikeb04:01:25

Nice work Sean, this will definitely help me get started

dm307:01:46

Nice, Sean!

pesterhazy10:01:57

@seancorfield: thanks for boot new, looks really nice and helpful

laforge4914:01:44

Here's a note on using windows for development. My focus is mostly hoplon, but I figure some of this might have broader interest. First, my environment is windows 10, java 1.8 and lately, clojure 1.8.0. 1. Add BOOT_EMIT_TARGET=no to boot properties with no targe specified. Adding that one line to boot properties means no more mapped files by jetty. Windows will not delete a file that is open, unlike unx systems, so this is important when doing boot reload. https://github.com/hoplon/hoplon/issues/80 2. No unit testing with a headless jsvm like phantomJS. Likely the path separator issue. crisptrutski/boot-cljs-test#42 3. You can't use shared webworkers with boot reload. adzerk-oss/boot-reload#57 4. You can't use cljc files or cljc libraries with watch. boot-clj/boot#397 So, as a windows dev I am just managing. But I would not recommend it just yet!

laforge4914:01:22

There are 3 basic issues with windows: 1. File separator issues. 2. Deleting open files is not supported, even if they are mapped like Jetty does. 3. Windows will apparently not let you delete read-only files. I understand that a lot of other problems with using windows have been taken care of by moving to windows 10. But the above 3 remain.

juhoteperi14:01:37

Hmm, I don't quite understand the first issue. What do you mean "no more mapped files by jetty"?

juhoteperi14:01:22

Are you trying to serve files from file system instead of classpath?

laforge4914:01:17

Apparently jetty will use mapped files when it can. Not specifying target files apparently disables this. But please talk to @micha for specifics.

juhoteperi14:01:32

It adds window check before trying to show HUD.

juhoteperi14:01:46

Hmm, but maybe reload code will also try to use window?

micha14:01:11

i think maybe a macro for js interop?

micha14:01:18

that tests existence?

micha14:01:37

like (.? ...) coffeescript style

juhoteperi14:01:59

I don't think the check needs to be done in so mane places that it would need a macro 😄

micha14:01:06

or maybe cljs has this now

juhoteperi14:01:06

s/mane/many/

micha14:01:29

yeah but the macro is nice and clean i think

micha14:01:38

that's the one thing i like about coffeescript

micha14:01:52

i use the ?. guy all the time there

micha14:01:01

i think ?. should be part of cljs really

juhoteperi14:01:08

Ah, I think I know what you mean now.

juhoteperi14:01:27

Wouldn't probably solve this. Boot-reload code doesn't access window itself but calls some Closure code which does it.

micha14:01:42

oh, i see

micha14:01:18

does goog closure have a thing to mock the dom?

micha14:01:30

like maybe for testing in rhino or something

micha14:01:56

i guess that's not really something you can do from a library without being rude

micha14:01:13

@juhoteperi: how do you feel about changing boot to use path URIs internally instead of path strings, like in the fileset etc

micha14:01:34

that would be a non-breaking change for unix users, and a breaking change that fixes things for windows users

juhoteperi14:01:46

Yeah we should do something like that

micha14:01:28

it's crazy that on windows if foo\bar\baz.clj is a file on the classpath then you access it via (io/resources "foo/bar/baz.clj")

micha14:01:36

that's total nonsense

juhoteperi14:01:14

Might be good to start by listing API calls and tasks using paths. Besides by-path, sift comes to mind.

juhoteperi14:01:38

I think i've seen some sift regexes with patterns which match both separators

micha14:01:59

yeah i haven't merged that PR because it seems like a sketchy solution

juhoteperi14:01:05

I think it would be best to say that they are always matched against URI's with "/"

micha14:01:06

the default exclusions PR

micha14:01:31

yeah i was thinking that boot would just use "/" everywhere

micha14:01:47

regardless of which operating system you're on

micha14:01:25

perhaps subclass java.io.File

micha14:01:13

i'm pretty sure that File("foo/bar.clj") works on windows

juhoteperi14:01:35

Yeah I think so too.

juhoteperi14:01:53

Probably the only problems are with functions that take string parameters? (or regex)

juhoteperi14:01:05

And compare or match against other strings

micha14:01:39

plus some things that are very unintuitive that fail because of weird path mismatch

micha14:01:21

the problem really shows up when we assume a relationship between file paths and uris

micha14:01:33

like in boot-cljs and boot-reload and things like that

micha14:01:25

and even trickier because the backslash uris might actually work in ie, but i'm pretty sure won't work in chrome or ff

micha14:01:24

so maybe subclass java.io.File such that it always uses "/" instead of "\"

laforge4914:01:48

So that takes care of #3

juhoteperi14:01:57

@laforge49: Did you already test it?

laforge4914:01:55

not yet. Just realized it was fixed. Missed it somehow.

juhoteperi14:01:12

Well, maybe because I just pushed it 3 minutes ago 😄

juhoteperi15:01:09

@laforge49: I'm going to do boot-reload release today, I tested that the change fixes web workers for me, but would be great if you can also check that it works for you.

laforge4915:01:49

Sorry. Busy the rest of the morning. Easy enough for me to test, but will need to wait until later. But why not do a snapshot for now? I really don't think that there is that pressing a demand for this.

alandipert15:01:22

it would be cool if -d could be used with show

alandipert15:01:44

e.g. boot -d foo/bar show -p to quickly inspect a hting's deps without a project

benedek22:01:20

all ye boot ppl. we are planning to get rid of the annoying thing that you have to define cider-nrepl dependency manually for cider (and hopefully clj-refactor as well). when you jack-in in with cider we can easily modify how lein is run like this: lein update-in :plugins conj "[cider/cider-nrepl \"0.11.0-SNAPSHOT\"]" — repl i am aware of boot.repl/*default-dependencies* and boot.repl/*default-middleware* atoms and also the -d switch but is there a cli way of injecting nrepl middleware plugins at boot start up?

micha22:01:54

there is the -i/--init option to the repl task

micha22:01:13

hm that's probably not going to be able to add middleware though

benedek22:01:11

would it be possible to have a switch which can be used to modify boot.repl/*default-middleware* perhaps?

micha22:01:14

honestly i don't really understand the nrepl middleware architecture

micha22:01:29

so i don't think that api in boot was designed well

micha22:01:54

the issues around this have been accumulating lately

micha22:01:16

like i was going to see how to get the syntax highlighting middleware to work

micha22:01:26

but i kind of gave up after a while

micha22:01:53

you can make a task that does what you describe, i think

benedek22:01:21

oh but you have -m

benedek22:01:27

i think this is what we need

micha22:01:45

(deftask prepare-repl
  []
  (swap! boot.repl/*default-middleware* ...)
  identity)

benedek22:01:08

says: -m, --middleware SYM Conj SYM onto the REPL middleware vector.

micha22:01:08

sorry i forgot about that

micha22:01:17

yep that should do it

benedek22:01:48

do you have any example of using this? how do i define version?

micha22:01:58

you'd do that with the -d option

micha22:01:07

that's how you'd pull in the dependency

benedek22:01:16

ah right, here you just define the middleware

micha22:01:28

boot -d asdf/qwer:1.2.3 repl -m asdf.qwer/middleware ...

benedek22:01:38

thx for the help! will give this a try shortly

micha22:01:47

sweet, let me know how it goes

micha22:01:04

and also if you have any advice for the general repl api design that would be welcome, too

benedek22:01:24

(title is actually misleading already)

micha22:01:57

the -d dependencies will override anything in build.boot

micha22:01:10

so that might be good for what you want to do

benedek22:01:05

sounds good. nrepl middlewares: they are really difficult to get your head around. but will have a look.

juhoteperi22:01:24

Hmh, even cooler would be if tools.nrepl would allow adding new middleware on runtime. Then it would be possible to automatically add middleware to nrepl started from command line.

juhoteperi22:01:52

But would probably be also too magical and cause problems

benedek22:01:06

yup you can add dependencies at runtime. but I doubt that would work with a middleware

benedek22:01:23

although there may be a way to register it runtime, no idea

benedek22:01:34

but I don’t see a big problem adding them at start up. it seems both leiningen and boot already have the machinery for it and i don’t see any big blunders with it either… perhaps missing something...

juhoteperi22:01:34

Looks like nrepl server just needs a handler function and the function could do anything

juhoteperi22:01:50

Like Boot could set up a handler function which checks a atom for a middleware and uses those

juhoteperi22:01:37

But yeah, probably just better to set them up on start up. I was just thinking if there was a way which would work when manually starting the repl.

benedek22:01:03

yeah deffo an interesting question if you can inject middlewares at runtime

juhoteperi22:01:56

Though I'm not sure how people use Boot with Cider jack-in because often Boot projects have a single dev task which does other things besides starting nrepl server

micha22:01:17

with vim fireplace i always like to start my own boot repl

micha22:01:37

so i can set it up how i want, since i use environment variables to configure things usually

micha22:01:04

fireplace knows how to connect to my running repl automatically just fine

juhoteperi22:01:41

Yeah and it's the same with Cider and Cursive

micha22:01:03

i also like having a terminal repl in tmux i can jump over to when i want to

micha22:01:17

sometimes i want to do stuff in there that's not as convenient to do in vim

juhoteperi22:01:32

Well Cider in Emacs has repl buffer

micha22:01:20

i'm using neovim, so i could probably do it in there

juhoteperi22:01:27

Yeah it works quite nice

micha22:01:30

but i'm too lazy to change my ways lol

benedek22:01:03

hm.. see your point I guess. so would be nice to add middlewares to already running repls when you are connecting to an already running one

juhoteperi22:01:03

But I still prefer using just normal terminal, in case I for some reason want to restart vim

juhoteperi22:01:23

@benedek: Could also be dangerous, if you connect to nrepl running production app

juhoteperi22:01:39

Though I don't usually connect to those with editor...

micha22:01:10

oh yeah, my vim gets all confused if i do git stuff outside of vim, and i have to restart it or deal with all the "this file changed" nonsense

juhoteperi22:01:23

Huh, I don't have such problems

benedek22:01:25

@juhoteperi: indeed. I many times do, shhhh 😉

benedek22:01:11

there is nothing like redefining a defn in a running prod app 👿

benedek22:01:40

(hopefully my boss does not use boot (so not present in the room), sorry! 😉 )

micha22:01:40

it's a little present for the person who reboots the server

benedek22:01:59

come on. lets call it hotfix

micha22:01:01

i told you not to reboot that guy, now look what you've done

micha22:01:13

i hope you have cider installed

micha22:01:21

we need to define some functions

juhoteperi22:01:15

Heh, usually there is no problem as long as you remember to also commit stuff to git, and add notice that it has been applied to prod using repl 😄

benedek22:01:40

yeah something along those lines simple_smile

benedek22:01:38

btw I posted a summary of your points about the value of adding middlewares to an already running REPL to the above quoted issue

micha22:01:48

debugging the initial deployment can sometimes be much easier if you have a repl going in the production app, for sure

micha22:01:13

like something isn't talking to something, having a repl to play around in is great

benedek22:01:52

yeah we have a microservice where i work now which in case of an error stops listening to the event stream it works with but keeps running so we can REPL in and investigate with all the in memory state intact

benedek22:01:57

that is pretty nice actually