This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-21
Channels
- # admin-announcements (2)
- # aws-lambda (2)
- # beginners (26)
- # boot (179)
- # cider (36)
- # cljs-dev (118)
- # cljsrn (23)
- # clojure (150)
- # clojure-android (1)
- # clojure-austin (7)
- # clojure-austria (3)
- # clojure-canada (1)
- # clojure-dev (7)
- # clojure-dusseldorf (4)
- # clojure-germany (3)
- # clojure-greece (34)
- # clojure-nl (4)
- # clojure-quebec (9)
- # clojure-russia (30)
- # clojure-spec (38)
- # clojure-uk (3)
- # clojurescript (46)
- # clr (1)
- # core-async (2)
- # css (2)
- # cursive (17)
- # datomic (12)
- # devcards (8)
- # dirac (1)
- # docker (2)
- # hoplon (216)
- # jobs (2)
- # kekkonen (1)
- # lein-figwheel (18)
- # leiningen (2)
- # luminus (1)
- # mount (4)
- # off-topic (2)
- # om (15)
- # onyx (1)
- # parinfer (1)
- # pedestal (2)
- # planck (26)
- # reagent (98)
- # spacemacs (6)
- # specter (19)
- # spirituality-ethics (54)
- # untangled (22)
- # vim (24)
- # yada (4)
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
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
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
@arijun do you have anything which might be bound to that port already?
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
but earlier today I was able to get it to work without specifying that stuff, using just boot repl
, I believe
@arijun: glad its working 🙂
@jannis: I don't think testing specs requires anything special? Just normal clojure.test runner
@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)
?
Oh, I wasn't aware of such function
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.
Not currently included
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.
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 ?
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!
@upgradingdave: Glad to hear. I'm still using LESS myself so sass4clj still has some small issue I haven't had time to fix.
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?
https://github.com/timothypratley/reanimated/blob/master/build.boot is the file I'm using, I guess something is not quite right.
@nha: your tests should write to a temp dir instead, then you can add them to the fileset if you wish
@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
@nha could be /tmp, but could also be a dir obtained from boot via (boot.core/tmp-dir!)
well you can make a function that runs the tests and accpets a directory path as argument
(deftask runtests
[]
(let [test-output (tmp-dir!)]
(with-pre-wrap [fs]
(run-the-tests (.getPath test-output))
(-> fs (add-resource test-output) commit!))))
Yes I see what you mean 🙂 the add-resource would be optional in my case but yes that's a solution 😄
this way you get a new clean tempdir for each build, with possible caching for incremental builds
@nha: If the tests don't depend on Boot, I would use system temp dir
(Files/createTempDirectory)
It will create a dir in /tmp
or similar path
Ah nice. I was looking into (System/getProperty "java.io.tmpdir")
but that is probably where I am going right now.
Those dirs are not automatically deleted, but you can easily do that yourself if it is needed
@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.
@stuarthalloway: yes the -e/--exclusions/:exclusions option should do it, is it not working?
let me try that
boot -d org.clojars.micha/boot-cp -e org.clojure/clojure -d org.clojure/test.check:0.9.0 with-cp -wf deps-path
@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
boot -d org.clojars.micha/boot-cp \
-d org.clojure/test.check:0.9.0 \
with-cp -e org.clojure/clojure -wf deps-path
golden, thanks!
btw it would be a good addition to boot itself as well 😉
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”]]
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”.
I don’t see why maven should be required to iteratively test anything, ever
which is not so much to answer your question as to express frustration with the status quo
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
the language is not the problem at all
so I want the isolation of pods with a classpath I control
;; 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"}
^^^ where is the bottom? I want an empty pod that I can add Clojure to.
pods seem still to give me an inherited version of Clojure, not what I want
@stuarthalloway: you may be able to do (pod/make-pod {:dependencies '[[org.clojure/clojure "1.9.x"]]})
nope, I don’t want maven coordinates 🙂
I have Clojure source code in a directory
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
ah, you may be able to talk to the shim api directly, but that is a bit more painful
(->> (into-array java.io.File [url-of-clojure-jar])
(boot.App/newShim nil nil)
(#'pod/init-pod! nil))
good starting point, though. Thanks.
@stuarthalloway: you can use the lowest level methods of the boot.App
class
@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
@micha awesome
I will try to state the use case rather than the approach
when working on Clojure I will typically have the following things
1. I am working in some project that is not Clojure, that has ordinary boot (or other) build settings
2. I want to pick up compiled Java classes from the target/classes directory of Clojure
3. I want to pick up Clojure src from the src/clj directory of Clojure
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
right, note the separation of 2 (compiled Java) and 3 (not compiled Clojure)
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
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
I think that is right, just no place to hang that (yet)
the bonus credit problem (5) after the other four would be flowing that through boot enough that you could change your mind per pod
but I am saying that mostly because it seems like you should be able to, not because I need that atm
i was thinking perhaps that the BOOT_CLOJURE_VERSION env var couldbe co-opted for that purpose
could do, but need to point at >1 place, so list or URLs instead of one jar
I think you would be better off to name this idea in a separate envar, but I will happily consume whatever
is there another point at which this can be intercepted when making a pod?
micha: would that override any clojure in :dependencies as well? Or would that just be the clojure version for making the base pod?
like if it sees that clojure's version is not a legit version number it would do the modified thing
so then it would work for all libs, not just Clojure?
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
you have more data shape options to play with
:dependencies '[[org.clojure/clojure {:urls []}]]
that makes more work for the env to deps translator, but once you have a map you have wide-open mechanism
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
but clojure itself is different because boot needs to handle that before you can even compute
@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?
pods for sure — I want the isolation
if the path to pods is having core be able to flow through to pods, that is fine for me
actually having core flow through is probably good, since I will do the initial work in a REPL before moving to pods
@micha terrific! thank you
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”?also if it's an interpreted script, like your shell script, you can slurp that and pipe it to bash
wonderful. i really need to get more familiar with java… probalby half my questions stem not from boot/clojure misunderstanding, but java 😕
@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"
@micha got it, thanks
you can also add :directories
to the map there, instead of adding the path to the jar file
(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" {})))
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" {})))
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
(Not sure if I had already written these same things somewhere else...)
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
@berrysoup: you want to read a properties file from a jar, right?
how should I use boot.core/cleanup
?
as in, what arguments
well for reading pom properties from jar: https://github.com/boot-clj/boot/blob/master/boot/pod/src/boot/pod.clj#L124-L133
my use case is to clean up a deref
ed future
at the repl
@anmonteiro: for example
(deftask foop
[]
(let [server (start-server :port 8080)]
(cleanup (.stop server))
(with-pre-wrap [fs]
...
@anmonteiro: it's a macro that will evaluate the body expressions
@micha: I might be looking in the wrong place. the task I’m running already registers a cleanup handler
but the server keeps running after I deref the future and C-c
weird
@micha: might be a bug in some task. It seems other tasks in the pipeline have stopped
@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