Fork me on GitHub
#boot
<
2016-04-27
>
crimeminister13:04:07

There are days when I feel like web dev has been all downhill from there /blink

yenda15:04:55

I wanted to make a boot task like lein-run, in the wiki it says this should work but I get a ClassNotFound exception, does anyone use similar task successfuly ?

alandipert15:04:19

try this:

(deftask run []
  (with-pass-thru _
    (require 'scenario-runner.core)
    ((resolve 'scenario-runner.core/-main))))

alandipert15:04:48

alternatively you can (require 'scenario-runner.core) somewhere above your deftask

richiardiandrea15:04:26

A question: has somebody achieved the feat of having two repls, one from the bacnked, on for the frontend, in the same JVM with boot? I might have broken mine...

martinklepsch15:04:23

I think juxt’s edge at least tries to bring frontend + backend into one boot process while keeping them separate using pods. Not sure about REPLs but you should check @richiardiandrea

richiardiandrea15:04:04

I'll check... I was thinking I could run the two repl tasks in a future

richiardiandrea15:04:32

But I'll look there first

yenda15:04:55

alandipert: thank you it works a little bit better, now I have a nullPointerException I don't get when calling main from repl but it's another story

yenda15:04:11

maybe the wiki should specify that you need to require the namespace

alandipert15:04:20

probably, please do edit

alandipert15:04:32

to whatever would have made sense to you

alandipert15:04:50

much appreciated 👍

yenda15:04:51

ok I added the require statement

lwhorton16:04:57

i was wondering if I could get some help constructing a boot task? I want to run a dosh, but the temporary fileset paths is making it hard… for example, if my shell command wanted to include extra roots to search: do-something —include ../path/to/include —include ./resources, I’m not sure how to construct the task. I figure it something like this (str (.getParent in-file) “resources”), but then /Users/…/.boot/…/uuid/task/resources doesn’t exist.

richiardiandrea16:04:06

@martinklepsch: it looks like edge is actually able to launch two repls

richiardiandrea16:04:30

but cider does not connect to two at the same time 😄

richiardiandrea18:04:30

a question for boot-http: I see Problem accessing /. Reason: Not Found but with (show :fileset true) I see that my index.html is at the root of the fileset

richiardiandrea18:04:39

why is it not served?

alandipert18:04:31

@richiardiandrea: i don't think indexes are served by default? you may need a middleware/handler to doit

alandipert18:04:39

/index.html should work

alandipert18:04:51

basically somewhere on the server it needs to map / => /index.html

alandipert18:04:59

@lwhorton: perhaps you want to use the file's absolute path as an argument to the shell cmd?

alandipert18:04:44

@richiardiandrea: depends do you have wrap-resources middleware in your handler?

alandipert18:04:07

i can't remember if boot-http wraps with that by default, would be worth checking

richiardiandrea18:04:12

@alandipert: I think you don't need a handler (you can specify it, but by default I guess it serves from the classpath)

alandipert18:04:48

i would expect it to work then

richiardiandrea18:04:47

weird because if I point to the .js file I can see it

richiardiandrea18:04:03

so maybe you are right I am missing something to serve index.html

richiardiandrea18:04:49

so adding (serve -d "target") and (target) at the bottom did the trick

richiardiandrea18:04:15

but still, I should not probably need it, as per: https://github.com/pandeiro/boot-http#composability

lwhorton19:04:40

@alandipert: is there an api to get the “not temp path” from a tmp file/dir that you know of?

alandipert19:04:09

@lwhorton: you mean like the real file object for a tmp filed? that would be tmp-file

lwhorton19:04:30

i mean .. if boot reads in :soure and :resources and :assets into a tmp filesysem (essentially), and my task I want to run (css preprocessor) depends entirely on none-of-those temp paths but the real paths … it’s proving quite difficult to get it to run

alandipert19:04:54

i see what you mean

lwhorton19:04:13

considering something like @import ../other/style won’t work when it’s nested inside …/.boot/tmp/cache/blah/blah

lwhorton19:04:42

i spent about an hour considering re-writing the references inside the actual file to point to tmp files .. but that got messy very fast

alandipert19:04:47

i have a thing that recursively copies files from the fileset into a tmpdir

alandipert19:04:00

so that in a tmpdir, all the files are relative to eachother as they are in sources

alandipert19:04:20

does that sound like what you want?

lwhorton19:04:49

hmm.. so I could do a (c/by-ext [“.stly”] fs) and then copy the results somewhere… does it maintain paths/dirs, or is it flat?

lwhorton19:04:55

interesting, Ill take a look

alandipert19:04:28

yeah i think you could do (doseq [x (c/by-ext [".stly"] fs)] (copy x some-tmp-dir))

alandipert19:04:59

that would copy all the .stly files into some-tmp-dir, preserving paths

mattly19:04:09

is there a way from the boot repl to go and fetch new dependencies from changes to the build.boot file?

alandipert19:04:21

@mattly: (load-file "build.boot")

richiardiandrea19:04:42

do we have already boot templates?

richiardiandrea19:04:04

I am aware of boot-new and I am reading in the meantime

brianosaurus20:04:29

For some reason we can’t seem to set the environment for our auto-test task. Any ideas? We’re using

(deftask auto-test-clj []
  (comp
   (environ :env test-env)
   (watch)
   (javac)
   (test)))

richiardiandrea20:04:28

Looks good, maybe the content of test-env is not what boot-environ expects?

brianosaurus21:04:50

@richiardiandrea: test-env is a map. Thanks. Perhaps we’re doing something somewhere else that’s causing a problem (maybe?) … when we run our dev repl all is good so I’m rather confused. Anyway, thanks.

richiardiandrea21:04:48

I don't know about boot-environ but lein-environ generates a file you can look at..do you have an error or simply no values in your env?

brianosaurus21:04:09

env spits out a bunch of stuff but all of those things are from my shell’s env, ex of the env when printed from inside of the test: :lang "en_US.UTF-8", :term "xterm-256color”

richiardiandrea21:04:37

yes usually that's what you should get together with your test-env

lwhorton21:04:27

how do I go about adding a file to the fileset during a task? do I need to create a io/file “path/to/file”? my use case is I want to parse a css preprocessor and take any ”@import ‘path/to/file.css” that might exist in the css and add that referenced file into the fileset

micha21:04:29

@lwhorton: you can make a temp directory using boot.core/tmp-dir!

micha21:04:39

add files and subdirectories to that as you like

micha21:04:54

then you add that temp dir to the fileset with boot.core/add-resource

micha22:04:15

and you must call boot.core/commit! on the fileset after adding

micha22:04:34

then when you pass that fileset to the next task it will see the files you added

lwhorton22:04:15

okay, neato .. thanks @micha I’ll give that a go

micha22:04:44

you can create the temp dir in the outermost let binding of your task

micha22:04:07

so it will survive across multiple runs of the task (like with the watch task for example)

micha22:04:41

the zip task creates a temp dir, then populates it with files and adds it to the fileset

lwhorton22:04:36

i’ll try to study that repo some more .. my thought proces was 1) get all the .styl files 2) search the contents of styl files for @imports, add those imported to the fileset 3) copy the full fileset to a tmp dir in a way that preserves paths, 4) commit those styls

lwhorton22:04:55

the tricky part is preserving paths because a .styl might do something like @import ../../src/file.styl, but when boot executes via dosh the compiler, those paths dont exist (either excluded ‘cause they weren’t imported, or are flattened). I was hoping copying would solve it.

micha22:04:23

@lwhorton: you're going to be running some kind of css preprocessor on the files in your task?

lwhorton23:04:12

@micha: yea that’s the plan. I’m actually making some good headway adding all the included .styl files via @import path/to/file to the fileset. Now that they’re in the fileset I’m writing another task that compiles them out to .css inside /target/relative/dir

lwhorton23:04:17

it’s a little tricky to figure out where everything is running … for example - when running stylus, i’m getting failing cannot find @import ‘some/path/index.styl’ despite the file doing the importing being right inside /target and the some/path/index.styl being correctly located relative to that path