Fork me on GitHub
#boot
<
2016-03-04
>
audaxion00:03:20

has anyone boot-ized the luminus project yet? looking for a good full stack template similar to Tenzing

seancorfield01:03:09

To save me going and figuring out the answer: does TravisCI support Boot?

seancorfield01:03:56

(I mean "out of the box" like it does for Leiningen)

alandipert01:03:24

Not that I know of

seancorfield01:03:16

I guess you could install boot.sh as the install step of TravisCI?

currentoor04:03:47

Anyone here update a cljsjs package?

currentoor05:03:50

What is an .inc.js file for?

smw05:03:25

@currentoor: I think inc and min.inc.js are the library code itself

smw05:03:41

ext.js are google clojure compiler externs

smw05:03:01

np, hope that helps

juhoteperi06:03:12

The extensions are a convention used in cljsjs packages. They are used by deps-cljs task when packaging cljsjs libs.

inhortte16:03:18

Hello. I'm relatively new to boot and am just trying to create a (pure clojure - no cljs) project that uses 'watch' and recompiles when I change a file in my source-paths.

inhortte16:03:50

I have these tasks: (deftask bundle [] (comp (speak) (aot) (pom) (uber) (jar))) (deftask dev [] (comp (watch) (repl) (bundle)))

inhortte16:03:34

When I change a file, I get Could not locate james/imbibe__init.class or james/imbibe.clj on classpath. (after i edit imbibe.clj)

inhortte16:03:11

Killing boot and executing 'boot dev' once again takes forever to restart (building the uber?). What is the best way to do this?

micha16:03:26

@inhortte: i would avoid aot as much as possible

micha16:03:35

clojure isn't really designed for it

micha16:03:46

so you will see confusing errors

inhortte16:03:46

So I should just get rid of (aot)? (I'm still learning boot and possibly don't even know what aot actually does...)

micha16:03:10

aot compiles clojure namespaces to .class files

micha16:03:23

the only time you need that is when you make an uberjar and need to have a main class

inhortte16:03:25

I have removed (aot) from the 'bundle' task and now I get the following error: Error: Could not find or load main class james.core when running java -cp target/project.jar james.core http://localhost:3554/new-index.html

micha16:03:48

right so you will need aot there, but to avoid problems you can make a minimal shim

micha16:03:49

like this

inhortte16:03:49

How do I execute the program?

micha16:03:03

suppose your program entry point is james.core/-main

micha16:03:33

what you can do is craeate a new namespace, james.main

micha16:03:33

with the following contents

micha16:03:13

(ns james.main
  (:gen-class))
  
(defn -main [& args]
  (require 'james.core)
  (apply (resolve 'james.core/-main) args))

micha16:03:25

then you do this in your build.boot:

micha16:03:53

(task-options!
  aot {:namespace #{'james.main}}
  jar {:main 'james.main})

micha16:03:14

that will restrict the aot (ahead-of-time) compilation to that one namespace

inhortte16:03:20

(thank you very much, by the way)

inhortte16:03:34

I'm about to try it...

micha16:03:35

then you can do boot aot uber jar target

micha16:03:54

and you will have an uberjar in target/project.jar

micha16:03:14

then you can do java -jar target/project.jar

inhortte16:03:22

Need I remove (:gen-class) from james.core?

micha16:03:51

you don't need the pom task either

micha16:03:53

since you're building an appliction and not a library that will be deployed to maven

micha16:03:58

if you want to end up with just the jar file in the target dir you can do this, too

micha16:03:27

boot aot uber jar sift --include '\.jar$' target

inhortte16:03:53

> java -cp target/project.jar james.main http://localhost:3554/new-index.html Exception in thread "main" java.io.FileNotFoundException: Could not locate james/core__init.class or james/core.clj on classpath.

micha16:03:37

do java -jar target/project.jar

micha16:03:41

not java -cp

micha16:03:13

hm actually that isn't the problem

micha16:03:27

the problem is that your clj source files are in :source-paths probably

inhortte16:03:30

yeah.. i just tried java -jar.

micha16:03:35

they should be in :resource-paths

micha16:03:45

so they will be included in the jar

inhortte16:03:53

what is the purpose of :source-paths?

micha16:03:57

that's the difference between :source-paths and :resource-paths

micha16:03:21

both are on the build classpath, but :sourec-paths isn't included in packaging, like the target dir or jar files etc

inhortte16:03:16

Ok... I'll consult the page for that.

inhortte16:03:26

And with sift...

inhortte16:03:45

in the boot file, (comp (speak) (aot) (uber) (jar) (sift :include #"\.jar$") (target))

inhortte16:03:49

... um... no.

micha16:03:00

you can do (doc sift) in the repl

micha16:03:19

to see the kwargs it accepts and what type the options expect

micha16:03:54

for example you will see for the :include option

micha16:03:59

:include       #{regex}     The set of regexes that paths must match.

micha16:03:12

that means it's expecting a set of regexes

micha16:03:26

so you want (sift :include #{#"\.jar$"})

inhortte16:03:23

perfect. again... thanks.

micha16:03:29

also you can see api docs online here, if that is easier for you

inhortte16:03:59

I put it in task-options! in the task definition.

micha16:03:24

yeah task-options! simply replaces the var with a curried version

inhortte16:03:48

the watch is working, as well.

micha16:03:22

changing aot compiled namespaces without restarting the jvm is problematic

micha16:03:32

so using the minimal shim means you don't have to change that

micha16:03:55

loading clj namespaces is fine because the classes it generates are basically anonymous

inhortte16:03:06

the created jar is fine for production, as well, or do you suggest other means?

micha16:03:10

when you recompile a clojure namespace you'er not overwriting any existing classes

micha16:03:19

yeah that's what i do in production as well

inhortte16:03:56

Off topic - Just wondering with a nickname like 'micha', are you in the slavic world somewhere?

inhortte16:03:07

Anyhow. It's working fantastically. Thanks for your help.

micha16:03:56

that's my name simple_smile

micha16:03:09

i'm in the usa but i'm named after my grandfather who was from belarus

micha16:03:17

@inhortte: if you get a moment and want to update the wiki with a note about aot and watch that would be most appreciated, but no pressure simple_smile

inhortte16:03:42

the boot wiki?

micha16:03:17

it's sort of a collection of tips and tricks in addition to the normal documentation

dominicm16:03:56

Anybody know how boot-http is supposed to work with webjars?

inhortte16:03:02

Where in the wiki would it be appropriate to put?

micha16:03:06

i keep forgetting to monitor stack overflow, which would probably be the most googlable way to make these little tricks available

micha16:03:43

@inhortte: wherever you think it belongs will be fine, i'm sure

inhortte16:03:15

Ok, @micha, I shall look over it later this evening.

micha16:03:39

thanks @inhortte

inhortte16:03:53

no problem.

inhortte21:03:32

@micha: Let me know what you think and if I should add / subtract / obliterate anything: https://github.com/boot-clj/boot/wiki/Watch-and-Code-Reloading

micha21:03:56

@inhortte: very nice!

micha21:03:34

perhaps rename the article to be something related to working around limitations of the watch task and aot combination?

micha21:03:09

like the shim is to allow you to avoid aot compilation of namespaces you'll be changing

micha21:03:27

i imagine a lot of people run into this tricky situation

richiardiandrea21:03:52

@inhortte: awesome!

inhortte21:03:07

Gracias @richiardiandrea

seancorfield22:03:28

Not that anyone will care but I switched FW/1 (a lightweight MVC framework) over to Boot, including making its template a Boot-specific one. It was a Leiningen template before.

seancorfield22:03:24

Partly because we’re starting to use FW/1 at work. We’ve been using the CFML version of FW/1 for years. We’re just, finally, starting to write end-to-end Clojure web apps and therefore using the Clojure version of FW/1!

dominicm22:03:22

But that isn't clojurey! Framework?!

dominicm22:03:21

@seancorfield: I'm interested to see how that framework plays out.

dominicm22:03:40

I think #C0702A7SB is interesting. But I'm a juxter, so I'm biased 😛

seancorfield23:03:10

@dominicm: Yeah, one of the things I want to do with FW/1 is make it a bit more idiomatic at some point. Right now it’s Ring + Selmer + convention-based routing so I want to make that part a separate library and then turn the rest into something more like Ring Middleware.