Fork me on GitHub
#boot
<
2016-06-21
>
arijun00:06:36

I'm trying to follow the modern-cljs and I think I must be doing something dumb because I can't get the repl to connect to the cljs-repl in the browser

arijun00:06:47

with trying to run boot repl -c as per https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-04.md#brepling-with-cljs I get java.lang.AssertionError: Assert failed: host and/or port not specified for REPL client

arijun00:06:43

and when I start the repl using boot repl, and then run (start-repl) I get java.lang.IllegalStateException: Can't change/establish root binding of: *cljs-repl-env* with set

arijun00:06:17

Any ideas?

flyboarder00:06:32

@arijun do you have anything which might be bound to that port already?

arijun00:06:02

no, but your comment made me realize I was doing something stupid, in fact--I was able to get it to work when I specified the port and ip using -p and -h

arijun00:06:31

but earlier today I was able to get it to work without specifying that stuff, using just boot repl, I believe

flyboarder02:06:06

@arijun: glad its working 🙂

jannis10:06:37

Hi! There is no boot task to run clojure.spec tests yet, I guess?

juhoteperi12:06:28

@jannis: I don't think testing specs requires anything special? Just normal clojure.test runner

jannis12:06:41

@juhoteperi: Are spec tests automatically included in running test? Don't you still have to have a test namespace or boot task somewhere that calls (clojure.spec.test/run-all-tests)?

juhoteperi12:06:50

Oh, I wasn't aware of such function

jannis12:06:25

If they aren't included then boot tasks to run this function in both Clojure and ClojureScript (`cljs.spec.test/run-all-tests` in that case, and it's a macro) would be cool.

jannis12:06:56

Potentially included in the existing test and test-cljs? Just thinking out loud.

juhoteperi12:06:49

Not currently included

jannis12:06:53

Would it be confusing to have them executed as part of test and test-cljs (e.g. violating "do one thing only and do it right")? Otherwise I may take some time to add spec testing to both tasks and send a PR.

nha12:06:39

Is there something like a watch task that allows not watching a subfolder ? I have tests writing files to test/resources and that triggers a re-test when doing boot watch test. Or is that the wrong approach ?

upgradingdave13:06:26

Hi @juhoteperi, I just recognized your name and just wanted to say big thanks for the boot sass4clj library. I was in a pinch this morning at work to compile some scss. The scss project suggested gulp and npm, but when I tried following their readme, I ran into all kinds of npm dependency issues, so I switched to boot and within 5 mins, I was up and running with boot sass! Thanks so much!

juhoteperi14:06:03

@upgradingdave: Glad to hear. I'm still using LESS myself so sass4clj still has some small issue I haven't had time to fix.

timothypratley14:06:42

Hi, according to https://github.com/boot-clj/boot/wiki/Repository-Credentials-and-Deploying if I leave out the username/password, boot should prompt me for pushing; but the only way I could get it to work was exporting env vars and using the env path. Any reason why it would not prompt me for credentials?

timothypratley14:06:23

https://github.com/timothypratley/reanimated/blob/master/build.boot is the file I'm using, I guess something is not quite right.

micha15:06:39

@nha: your tests should write to a temp dir instead, then you can add them to the fileset if you wish

micha15:06:31

@nha: writing generated files to directories that are in your project will cause problems because you're introducing statefulness and you will end up needing to manage that manually

micha15:06:35

like with a "clean" task

nha15:06:32

Right, just got bitten. By a temp dir you mean something like /tmp ? Makes sense.

nha15:06:04

Thanks for the reply, you are always helpful 😄

micha15:06:31

@nha could be /tmp, but could also be a dir obtained from boot via (boot.core/tmp-dir!)

micha15:06:41

then you can add the contents of that to the fileset

micha15:06:53

using /tmp again introduces statefulness

nha15:06:01

Right, I am not sure I should tie my tests to boot ?

micha15:06:22

well you can make a function that runs the tests and accpets a directory path as argument

micha15:06:31

so you can make a simple boot task around it then

micha15:06:32

like this

nha15:06:07

Ah I could make that I guess.

nha15:06:47

Right will tinker around 😄

micha15:06:55

(deftask runtests
  []
  (let [test-output (tmp-dir!)]
    (with-pre-wrap [fs]
      (run-the-tests (.getPath test-output))
      (-> fs (add-resource test-output) commit!))))

nha15:06:55

Yes I see what you mean 🙂 the add-resource would be optional in my case but yes that's a solution 😄

micha15:06:22

this way you get a new clean tempdir for each build, with possible caching for incremental builds

micha15:06:29

boot will clean up the garbage automatically

micha15:06:37

and you don't need to worry about stale test output

nha15:06:57

Ow that's really nice

nha15:06:35

Will keep that in mind, thanks again !

micha15:06:48

good luck, lmk how it goes 🙂

juhoteperi15:06:01

@nha: If the tests don't depend on Boot, I would use system temp dir

juhoteperi15:06:30

(Files/createTempDirectory)

juhoteperi15:06:55

It will create a dir in /tmp or similar path

nha15:06:25

Ah nice. I was looking into (System/getProperty "java.io.tmpdir") but that is probably where I am going right now.

juhoteperi15:06:51

Those dirs are not automatically deleted, but you can easily do that yourself if it is needed

nha15:06:58

Hoping there is no limitation for these in circleci (no reason why it should be).

nha15:06:19

Well I will look at the boot way also for sure

stuarthalloway17:06:27

@micha I am trying to use https://github.com/micha/boot-cp to make a classpath that excludes Clojure. Does the -e flag do this? I can’t find the right syntax.

micha17:06:41

@stuarthalloway: yes the -e/--exclusions/:exclusions option should do it, is it not working?

micha17:06:07

boot with-cp -e org.clojure/clojure -e  ...

stuarthalloway17:06:19

let me try that

stuarthalloway17:06:36

boot -d org.clojars.micha/boot-cp -e org.clojure/clojure -d org.clojure/test.check:0.9.0 with-cp -wf deps-path

stuarthalloway17:06:06

@micha I was expecting that would make a deps-path file with just test.check in it, but it also has clojure 1.7.0

micha17:06:26

ah you want this:

micha17:06:31

boot -d org.clojars.micha/boot-cp \
  -d org.clojure/test.check:0.9.0 \
  with-cp -e org.clojure/clojure -wf deps-path

micha17:06:51

the -e is an option to the with-cp task, not to boot itself

micha17:06:22

the -d is an argument to boot itself, to have it add dependencies to the core env

stuarthalloway17:06:26

golden, thanks!

richiardiandrea17:06:45

btw it would be a good addition to boot itself as well 😉

lwhorton18:06:08

arg. what am I doing wrong here… if I’m building a boot task and want to iteratively test it with an example proj as I move along, is this the correct setup?:

/task/build.boot -> run a build-jar task to pom, jar, install (to local maven)
/task/example/build.boot -> :checkouts ‘[[task/the-task “0.0.1”]], :dependencies ‘[[task/the-task “0.0.1”]]

lwhorton18:06:49

the jar install to maven seems to be working, since I dont get a “no artifact found” error. the namespaces are screwed up somehow, though, because I keep getting “could not find __ on classpath”.

stuarthalloway18:06:28

I don’t see why maven should be required to iteratively test anything, ever

stuarthalloway18:06:52

which is not so much to answer your question as to express frustration with the status quo

lwhorton18:06:31

there are lots of prickly annoyances littered over the clj/cljs land.. but I still think the power of the language is worth the woes in the long haul

stuarthalloway18:06:50

the language is not the problem at all

stuarthalloway18:06:48

so I want the isolation of pods with a classpath I control

stuarthalloway18:06:54

;; try to get to the turtle at the bottom
(def p (pod/make-pod {}))
(pod/with-eval-in p *clojure-version*)
=> {:major 1, :minor 9, :incremental 0, :qualifier "alpha7"}

stuarthalloway18:06:19

^^^ where is the bottom? I want an empty pod that I can add Clojure to.

stuarthalloway18:06:55

pods seem still to give me an inherited version of Clojure, not what I want

lwhorton19:06:39

i haven’t even touched pods yet, so I’m not sure i can help any

tcrawley19:06:29

@stuarthalloway: you may be able to do (pod/make-pod {:dependencies '[[org.clojure/clojure "1.9.x"]]})

stuarthalloway19:06:51

nope, I don’t want maven coordinates 🙂

stuarthalloway19:06:00

I have Clojure source code in a directory

tcrawley19:06:41

it looks like pods use a set of default deps if none are provided, and doesn't provide a way to add jars to the pod at creation time

tcrawley19:06:39

ah, you may be able to talk to the shim api directly, but that is a bit more painful

tcrawley19:06:00

(->> (into-array java.io.File [url-of-clojure-jar])
                  (boot.App/newShim nil nil)
                  (#'pod/init-pod! nil))

tcrawley19:06:17

that might do the trick (untested), but is not ideal

stuarthalloway19:06:23

good starting point, though. Thanks.

tcrawley19:06:28

my pleasure

micha19:06:49

@stuarthalloway: you can use the lowest level methods of the boot.App class

micha19:06:59

@stuarthalloway: supporting dev versions of clojure itself is kind of a special case, so if you have an idea of how you'd like your workflow to be i can make the necessary modification

micha19:06:39

pods will always need to have some version of clojure

stuarthalloway19:06:43

I will try to state the use case rather than the approach

stuarthalloway19:06:13

when working on Clojure I will typically have the following things

stuarthalloway19:06:02

1. I am working in some project that is not Clojure, that has ordinary boot (or other) build settings

stuarthalloway19:06:23

2. I want to pick up compiled Java classes from the target/classes directory of Clojure

stuarthalloway19:06:49

3. I want to pick up Clojure src from the src/clj directory of Clojure

stuarthalloway19:06:58

4. ideally impose all of this externally, so that I can reuse all the existing boot stuff in e.g. project 1, other than swapping in Clojure

micha19:06:43

how does the source version of clojure work? wouldn't you need to compile the java?

stuarthalloway19:06:10

right, note the separation of 2 (compiled Java) and 3 (not compiled Clojure)

micha19:06:51

i think that will require a change to shimdandy, is that right @tcrawley?

micha19:06:06

oh i guess not, it just loads RT from the classpath

stuarthalloway19:06:47

now jumping to a possible (but maybe not best) solution. If the boot environment options included a way to say “get Clojure from X", where X is a classpath allowing more than one entry, then mostly done

tcrawley19:06:16

at its heart, shimdandy is just a URLClassLoader, so you just need src/clj/ and target/classes in the array of URLs you feed it

stuarthalloway19:06:45

I think that is right, just no place to hang that (yet)

micha19:06:01

ok i think i'm tracking now

micha19:06:05

i have a proposal

stuarthalloway19:06:40

the bonus credit problem (5) after the other four would be flowing that through boot enough that you could change your mind per pod

stuarthalloway19:06:07

but I am saying that mostly because it seems like you should be able to, not because I need that atm

micha19:06:30

i was thinking perhaps that the BOOT_CLOJURE_VERSION env var couldbe co-opted for that purpose

micha19:06:16

like normally you'd do BOOT_CLOJURE_VERSION=1.8.0 or so

micha19:06:38

but maybe we could do BOOT_CLOJURE_VERSION=

stuarthalloway19:06:19

could do, but need to point at >1 place, so list or URLs instead of one jar

micha19:06:22

or BOOT_CLOJURE_VERSION=file:///some/directory/lib:file:///some/directory/src/clj

stuarthalloway19:06:54

I think you would be better off to name this idea in a separate envar, but I will happily consume whatever

stuarthalloway19:06:44

is there another point at which this can be intercepted when making a pod?

tcrawley19:06:53

micha: would that override any clojure in :dependencies as well? Or would that just be the clojure version for making the base pod?

micha19:06:12

i was thinking to use it everywhere

micha19:06:32

like if it sees that clojure's version is not a legit version number it would do the modified thing

micha19:06:53

so you could then do :dependencies '[[org.clojure/clojure "file://..."]...

micha19:06:03

or when you make a pod

micha19:06:18

i'd hack it into the dependency resolution machinery

stuarthalloway19:06:58

so then it would work for all libs, not just Clojure?

micha19:06:17

it could, but unsure if that's a good idea or not?

micha19:06:39

i was thinking just for clojure because we know what valid clojure versions look like, like you'd never make clojure version be a url

stuarthalloway19:06:03

you have more data shape options to play with

stuarthalloway19:06:38

:dependencies '[[org.clojure/clojure {:urls []}]]

stuarthalloway19:06:26

that makes more work for the env to deps translator, but once you have a map you have wide-open mechanism

micha19:06:58

how do you mean, about the map and open mechanism?

stuarthalloway19:06:01

re other libs than Clojure, I am surprised somebody has not already asked for such a mechanism to let them name code not in a repo

micha19:06:43

i guess normally you can add directories to the classpath as you wish

micha19:06:06

so there isn't a pressing need there for most use cases

micha19:06:19

but clojure itself is different because boot needs to handle that before you can even compute

micha19:06:12

@stuarthalloway: you want the core boot pod (the one your build.boot is evaluated in) to use the dev version of clojure, or you only need to be able to create pods that use the dev clojure?

stuarthalloway19:06:54

pods for sure — I want the isolation

stuarthalloway19:06:11

if the path to pods is having core be able to flow through to pods, that is fine for me

micha19:06:00

ah ok, i think i can get that working without needing to make a boot release

micha19:06:11

i'll make a repo with a demo and CC you

stuarthalloway19:06:37

actually having core flow through is probably good, since I will do the initial work in a REPL before moving to pods

stuarthalloway19:06:28

@micha terrific! thank you

lwhorton20:06:53

if I have a shell script as part of a boot task sitting side-by-side my-task/src/core.clj and my-task/src/script.sh, what is a guaranteed-safe way to execute that script? I can do something like …

(conch/proc (str cwd “/my-task/src/script.sh")
but this is terrible for the obvious reasons. I can’t find in the docs the canonical way to “get the boot fileset root”?

micha20:06:09

@lwhorton: you can do ( "script.sh")

micha20:06:20

that will return a URL, which you can use to get the path

micha20:06:06

also if it's an interpreted script, like your shell script, you can slurp that and pipe it to bash

micha20:06:26

then the shell script could even be in a jar or whatever and it'll still work

lwhorton20:06:17

wonderful. i really need to get more familiar with java… probalby half my questions stem not from boot/clojure misunderstanding, but java 😕

micha20:06:35

@stuarthalloway: here is a snippet to get custom clojure jar loaded into a new pod, as a temporary workaround pending a more complete solution:

(clojure-version)
"1.8.0"

(require '[boot.pod :as pod])
nil

(def p (->> {:exclusions '[org.clojure/clojure]
             :dependencies '[[boot/pod "2.6.0"]]}
            (pod/resolve-dependency-jars)
            (into [(java.io.File. "lib/clojure-1.6.0.jar")])
            (into-array java.io.File)
            (boot.App/newShim "devpod" {})))
#'boot.user/p

(pod/with-eval-in p (clojure-version))
"1.6.0"

micha20:06:50

you can also add :directories to the map there, instead of adding the path to the jar file

micha20:06:03

for the case where you have java classes/clj source

micha20:06:34

so in that case you'd do something like:

micha20:06:32

(def p (->> {:exclusions '[org.clojure/clojure]
             :directories #{"path/to/clojure/classes"
                            "path/to/clojure/source"}
             :dependencies '[[boot/pod "2.6.0"]]}
            (pod/resolve-dependency-jars)
            (into-array java.io.File)
            (boot.App/newShim "devpod" {})))

micha20:06:45

oops that was wrong ^^, what you want is this:

(def p (->> {:exclusions '[org.clojure/clojure]
             :dependencies '[[boot/pod "2.6.0"]]}
            (pod/resolve-dependency-jars)
            (into [(java.io.File. "path/to/classes")
                   (java.io.File. "path/to/source")])
            (into-array java.io.File)
            (boot.App/newShim "devpod" {})))

juhoteperi21:06:08

I wrote down a few ideas on serving the files in Boot development env as it is something I often comment about: https://github.com/adzerk-oss/boot-cljs/wiki/Serving-files

juhoteperi21:06:22

(Not sure if I had already written these same things somewhere else...)

berrysoup22:06:59

How to read pom.properties? I have io error: java.io.FileNotFoundException: /home/jacek/ClojureProjects/sesame-loader/target/triple-loader-standalone.jar!META-INF/maven/adalab/triple-loader/pom.properties

berrysoup22:06:52

what might be another dlimiter? hash-character?

micha22:06:24

@berrysoup: you want to read a properties file from a jar, right?

berrysoup22:06:23

yeah. For java I'd use ResourceLoader from Spring Framework. 😛

anmonteiro22:06:40

how should I use boot.core/cleanup?

anmonteiro22:06:43

as in, what arguments

anmonteiro22:06:59

my use case is to clean up a derefed future

micha22:06:28

@anmonteiro: for example

(deftask foop
  []
  (let [server (start-server :port 8080)]
    (cleanup (.stop server))
    (with-pre-wrap [fs]
      ...

micha22:06:07

@anmonteiro: it's a macro that will evaluate the body expressions

anmonteiro22:06:26

@micha: I might be looking in the wrong place. the task I’m running already registers a cleanup handler

anmonteiro22:06:40

but the server keeps running after I deref the future and C-c

micha22:06:19

hm that sounds odd

anmonteiro22:06:50

@micha: might be a bug in some task. It seems other tasks in the pipeline have stopped

berrysoup22:06:10

@micha: thanks. I forgot about JarFile class.

micha22:06:05

@berrysoup: you might be able to use some of the functions in the boot.pod namespace, there are a few that deal with pom.properties files

berrysoup22:06:43

@micha: I need it in normal runtime not during compilation.

micha22:06:01

yeah i mean you can copy paste some stuff 🙂