Fork me on GitHub
#boot
<
2015-07-22
>
nblumoe10:07:36

A (hopefully) simple boot question: What is the idiomatic way to just install the projects dependencies? So the equivalent to lein deps basically. I need this in a build pipeline and so far I am just using boot. That works, but also prints the help text, which I would like to avoid.

martinklepsch10:07:14

@nblumoe: you can get a list of all available tasks using boot -h, looking at that list there seems to be no task specifically for that.

nblumoe10:07:39

that's the impression I got. however, seems like this almost cant be true

nblumoe10:07:18

I could use any task, but I am quite surprised, that there is not a simple task to just install the dependencies?!?!

martinklepsch10:07:59

@nblumoe: you want this to prefetch stuff for things like docker images I assume?

martinklepsch10:07:37

I understand that it’s somewhat surprising. Best I can offer right now is boot repl -e '(System/exit 0)’

martinklepsch10:07:12

Still prints some stuff though.

nblumoe10:07:08

yeah, well I can work around this easily of course or just live with the output from boot. I was just wondering if I am too stupid to find this task. simple_smile

nblumoe10:07:21

Now I am going to see if I can add such a task and will send a PR

martinklepsch10:07:18

@nblumoe: I think another way to do it would be just adding an empty task to your build.boot file and running it

nblumoe10:07:38

(deftask deps []) yeah, just did that

nblumoe10:07:12

Do you think such a task should exist in boot? Am I weird needing this? 😄

martinklepsch10:07:23

I haven’t needed it myself but given how simple the implementation is it’s probably worth adding to remove some Leiningen > Boot friction

nblumoe10:07:29

Ok, going to open an issue on github. Not sure yet how to get this into the built-in boot tasks cleanly

martinklepsch10:07:57

There’s a namespace boot.tasks.built-in or so simple_smile

martinklepsch10:07:14

Everything in there is referred by default

nblumoe10:07:47

however, seems a bit intimidating to be honest. wasn't planning to invest too much time into this. especially if someone else can add such a simple thing probably in 5 minutes or so

martinklepsch10:07:31

@nblumoe: sure, opening an issue is perfectly enough — maybe there also is a way I’m not aware off simple_smile

Petrus Theron11:07:41

I'm starting a new project with a frontend (cljs) and backend (clj) component. How should I separate these for boot so that I don't have the cljs dependencies in my clj project?

martinklepsch11:07:38

@petrus: you can either make them two different projects or you have a task that calls set-env! prior to cljs compilation, adding the required cljs deps

Petrus Theron11:07:25

OK, thanks. Two separate projects seems cleanest.

martinklepsch11:07:53

Yes, I also prefer that approach. It might add some friction though. Is backend API only?

Petrus Theron12:07:15

yes, @martinklepsch. Does boot have a boot new command to make a clj project from a template yet?

martinklepsch12:07:51

@petrus: for the frontend project I could offer Tenzing: https://github.com/martinklepsch/tenzing 😛

Petrus Theron12:07:00

thanks, I already use it simple_smile

martinklepsch12:07:22

Nice. Let me know if you have any feedback/suggestions

Petrus Theron12:07:58

Ah, since you're the author: I always end up adding a prod task and taking (speak) out of build because if fails on boxes without audio. I also add a lein-generate task to make a project.clj file for Cursive, but that's probably not something you want to clutter the project with.

micha12:07:59

petrus: speak fails with an exception on boxes without audio? or it just doesn't speak?

Petrus Theron12:07:25

e.g. on CircleCI. The build fails on boxes without audio hardware.

micha12:07:32

it should do the latter, not the former

micha12:07:45

so that's a bug in the speak task i would say

micha12:07:54

my feeling is that the "convenience" tasks like speak should just print a warning "can't make sound" or whatever but shouldn't stop the build

micha12:07:53

thanks for reporting the issue simple_smile

micha12:07:29

martinklepsch: i'm a little hesitant to add (deftask deps []) to boot because deps is too choice a name to throw away like that

micha12:07:09

the deps name should probbly be reserved for the user in cases where deps need to be resolved in some special way

martinklepsch12:07:13

@petrus: lein-generate is something I have in profile.boot

Petrus Theron12:07:30

ah, didn't know I could do that simple_smile

Petrus Theron12:07:40

where does profile.boot live? ~/.boot ?

martinklepsch12:07:50

Probably a good idea to add a cursive page to the editors section in the wiki

martinklepsch12:07:56

later everyone, gtg

micha12:07:24

later martinklepsch !

Petrus Theron13:07:22

I'm porting a Leiningen project to boot, and getting a really strange error when I try to run any boot task, even an empty task:

clojure.lang.ExceptionInfo: Wrong number of args (4) passed to: StringReader
    data: {:file "abnf.clj", :line 186}
clojure.lang.ArityException: Wrong number of args (4) passed to: StringReader

micha13:07:28

this is the instaparse bug

micha13:07:56

try adding a :dependency on [org.clojure/clojure "1.7.0"] to your project

micha13:07:18

and BOOT_CLOJURE_VERSION=1.7.0 boot --update

micha13:07:29

that should fix it

Petrus Theron13:07:46

these are my dependencies:

'[[org.clojure/clojure "1.7.0"]
                  [ring "1.4.0"]
                  [compojure "1.4.0"]
                  [http-kit "2.1.19"]]

Petrus Theron13:07:57

ah, I'm missing boot.properties

micha13:07:27

instaparse is sniffing the classpath for the presence of a certain inner java class to determine the version of clojure

Petrus Theron13:07:31

yay! works. this has bit me several times now 😕

micha13:07:37

instead of just using *clojure-version*

micha13:07:44

i have no idea why they do that

Petrus Theron13:07:05

Hm, now I have a different bug, although I'm not sure if it's boot-related, but running my boot dev task exits immediately. The boot dev task looks like this:

(deftask dev
  "Start internal httpkit server for development."
  []
  (with-post-wrap fileset (server/run (dev-handler))))
which should run this http-kit server:
(defn run [handler & [port]]
  (defonce ^:private server
    (let [port (Integer. (or port 3011))]
      (print "Starting web server on port " port ".\n")
      (run-server handler {:port port})))
  server)
Is there something in boot that could be billing this task when it started?

micha13:07:34

boot tasks shouldn't block the pipeline

micha13:07:55

so they will all normally return and start any long-running processes in another pod or thread

micha13:07:12

boot has the wait task you can use to explicitly block

micha13:07:18

boot dev wait

micha13:07:33

this allows you to still compose dev with other tasks when you want to

micha13:07:41

like boot watch dev for example

micha13:07:55

or boot dev pom install etc

Petrus Theron13:07:15

when I run boot dev wait it just waits - nothing seems to happen. Server doesn't start.

Petrus Theron13:07:35

sorry I'm still a boot n00b

micha13:07:42

the with-post-wrap macro expects the body to evaluate to a fileset

micha13:07:15

(with-post-wrap fileset (server/run (dev-handler)) fileset)

Petrus Theron13:07:19

no change 😕 still waits. Can I drop the with-post-wrap, or will I lose reloading?

micha13:07:36

you want with-pre-wrap simple_smile

micha13:07:43

i didn't notice that

micha13:07:09

post wrap evaluates your code after the pipeline runs, which isn't what you want there

micha13:07:23

because it never gets there with the wait in line

Petrus Theron13:07:26

Woot! It works. Thank you, @micha!

micha13:07:46

with-pre-wrap evaluates the body and then passes the result to the next task

Petrus Theron13:07:00

Now if I could just get it to auto-reload changes in my .clj files

micha13:07:09

with-post-wrap passes the fileset to the next task, then evaluates the body with the fileset bound to the result of that

micha13:07:53

like in ring request middleware vs response middleware

micha13:07:57

does that make sense?

micha13:07:17

like how your middleware might be operating on the request or the response

micha13:07:29

pre or post handler middleware

micha13:07:01

you can use the ring-reload middleware to get .clj reloading in your application

Petrus Theron13:07:56

got reloading working YES

meow13:07:55

I'm getting a weird error on a boot project:

WARNING: ->t8090 already refers to: cljs.core/->t8090 being replaced by: cljs.core.async/->t8090 at line 141 file:/C:/Us
ers/Patrick/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/cor
e/async.cljs
WARNING: Wrong number of args (3) passed to cljs.core/t8090 at line 141 file:/C:/Users/Patrick/.m2/repository/org/clojur
e/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async.cljs
Any clues what might be causing this?

meow13:07:47

On a different project I get the same warning but involving pprint instead of core.async.

aengelberg16:07:09

@micha @petrus I think the instaparse classpath problem was fixed in version 1.4.1: https://github.com/Engelberg/instaparse/blob/master/src/instaparse/cfg.clj#L161

micha17:07:26

@aengelberg: great news, thanks! that would fix the issue

meow17:07:01

@micha: have you ever seen anything like my ->t8090 error using boot?

aengelberg17:07:04

Cool. Since it's depended on transitively by Compojure, @petrus might want to override it in project.clj

micha17:07:45

@meow: i haven't seen that one before

micha17:07:03

i know that the versions of cljs and core.async are tightly coupled

micha17:07:19

so for a given version of one you can only use specific versions of the other

micha17:07:40

and the errors you get are cryptic when you have a version mismatch, error like what you see there

meow17:07:33

@micha: ok, that gives me at least a clue, thanks.

alandipert17:07:10

i'll throw in that it looks like the dynamically-generated constructor for a dynamically-generated record

alandipert17:07:27

like something that would be an implication of (defrecord ~(gensym "t") [...]) somewhere

micha17:07:43

yeah the line in core.async in question is doing reify