Fork me on GitHub
#boot
<
2017-06-22
>
donyorm00:06:44

So I'm trying to get a luminus project to run in boot (https://github.com/DonyorM/luminus-boot) and I'm having some issues. It seems that when I run with boot, the VM just shuts down, but it works fine with lein. Does anyone know why that would be?

mobileink21:06:10

donyorm: luminus-boot: "To start a web server for the application, run: lein run" wtf?

donyorm22:06:40

This is a work in progress, I haven't updated everything, including the documentation

mobileink22:06:34

donyorm: np. but if you 're doing boot you might want to remove refs to lein asap just to avoid confusion.

donyorm00:06:13

That branch isn't remotely finished. It's mainly there for people who want to help me transfer the template to boot. When I finish it, I'll work through all those little details, but for now I'm getting the main programming down.

richiardiandrea00:06:21

@donyorm it smells like the main thread finishes and there are not non-daemon threads to keep it on

donyorm00:06:00

but it works under lein?

richiardiandrea00:06:24

For a quick check try to put a @(promise) line after your call or directly into the -main

richiardiandrea00:06:04

Lein is different from boot I guess

richiardiandrea00:06:47

But don't take my word...it is just a guess

donyorm01:06:42

well that seemed to work. I got luminus running under boot with that last part. Thanks for your help @richiardiandrea. I'm going to try and make some templates to get this to work

richiardiandrea01:06:56

No problem! That has always been an issue with web servers that don't block the main thread

donyorm01:06:38

yeah, it's weird that lein doesn't have the issue though

donyorm01:06:04

Boot doesn't do AOT by default, right? You have to use the task specifically, correct?

seancorfield01:06:39

You almost never need AOT. Just sayin’

seancorfield01:06:04

We don’t do any AOT at World Singles. We build uberjars without AOT, then use clojure.main as the entry point and pass the namespace whose -main we want to run (e.g., java -jar uberjars/api-1.0.0.jar -m api.main).

donyorm01:06:17

I know. I just wanted to make sure boot wasn't doing it by default, since I'm transferring from lein and want to remove every possible point of difference

seancorfield01:06:47

Cool. Yeah, we switched from lein to boot about 18 months ago. Very happy with that switch.

seancorfield01:06:13

We’ve managed to convert a lot more of our build/test/deploy pipeline into boot (from ant and shell scripts) too.

jose10:06:25

hi, I need some help with boot-cljs. I have a clojurescript macro which generates a css file and writes it to disk. My problem is that the boot-cljs task is not adding the css file to the fileset. Is there a way to tell to boot-cljs that I want to add the css file to the fileset?

naomarik10:06:10

@jlle add the dir to the :resource-paths?

lmergen11:06:24

if i have a jar that’s not distributed through maven/clojars (i.e. a jar i manually downloaded somewhere), what would be the appropriate way to include it in my project ? right now i’ve done a mvn install:install-file, but i was wondering whether i could put this jar in a lib/ directory and have boot automatically add it to the classpath

dm312:06:26

assuming you have a local maven repo proxy (nexus/artifactory/…) - I’d put it there

dm312:06:46

otherwise - into lib/

lmergen14:06:55

@dm3 thanks ,i’ll look into those proxies!

lwhorton15:06:37

if I wanted to invoke a deftask from within a task with arguments, how might I do that? is there any example someone can point me to? I want to do something like:

(deftask foo [a arg VAL str "an arg"]
  (c/with-pre-wrap [fs]
    ... do some task-ey stuff
    (let [v (another-task/do-task :task-arg arg]
      ... do something with v
      (-> fs commit!))
But this obviously wont work

lwhorton15:06:12

or is it more idiomatic to have 1 task write something to a temp file in the fs, then another task read that data?

alandipert15:06:01

@lwhorton v there is a function that takes a function that returns a fileset as an argument, and returns a function that, when called with a fileset, returns a fileset

alandipert15:06:24

so you can call it with a fileset like ((v identity) fs) and get a fileset back

alandipert15:06:55

also lol at the complexity of that first sentence

alandipert15:06:05

here’s another example. a task that just calls aot task with no arguments on a fileset:

(defn aot-wrapper [] 
  (fn [next]
    (fn [fs]
      (next (((aot) identity) fs)))))

alandipert15:06:40

(boot (aot-wrapper)) =~ (boot (aot))

lwhorton19:06:46

aha, I see .. so refer to the “interceptor” chain instead of using the pre-wrap helpers

lwhorton19:06:01

which will allow me to get lower level control and use things like (fn [next]) when I actually want to invoke it: thanks @alandipert

cjhowe22:06:56

when should i use boot over leiningen? if my build process has a certain level of complexity?

seancorfield22:06:30

I think that’s probably a good starting point to think about that choice.

seancorfield22:06:54

Boot has a lot of things built-in that would be plugins in Leiningen (lein-ancient, for example, is built-in).

seancorfield22:06:34

Mostly it’s about extensibility and configuration: Leiningen has project.clj which is a declarative map of settings; Boot has “Clojure code”.

cjhowe22:06:34

do you think it'd necessarily be bad to just always use boot? tbh when i use leiningen i tend to spend a lot of time setting it up, and i'm hoping boot has less of those problems

seancorfield22:06:12

I don’t use Leiningen for anything now, unless I’m playing with someone else’s FOSS project that just happens to rely on Leiningen.

cjhowe22:06:46

oh, i guess i should mention that i'm trying to work with clojurescript, i initially was interested in boot because of a blog post about using boot with clojurescript

cjhowe22:06:20

thanks for the links! reading now

cjhowe22:06:28

@seancorfield do you think boot has more of the common plugins compared to leiningen since you wrote that post?

lwhorton23:06:28

I’ve used boot for ~6 mo now primarily for cljs. It’s had everything I’ve needed, and for what wasn’t there it’s relatively easy to add your own tasks.

lwhorton23:06:57

The pieces I ended up adding were 1) a way to version js files for cache-busting, 2) generating an index.html file with those versions, 3) writing a manifest (git sha, git tag, branch, etc.) to a json file 4) compiling my stylus

lwhorton23:06:35

As someone who writes a fair bit of web apps, most of these need to be custom for each customer anyways, so its not like you can avoid writing them if you do it in leiningen vs. boot

cjhowe23:06:43

cool, i guess i'll just use boot! sounds like i would need it for bigger projects at some point anyways