This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-29
Channels
- # adventofcode (4)
- # beginners (113)
- # boot (165)
- # cider (192)
- # cljsrn (82)
- # clojure (148)
- # clojure-austin (6)
- # clojure-russia (22)
- # clojure-spec (45)
- # clojure-uk (19)
- # clojurescript (153)
- # core-async (5)
- # cursive (7)
- # datomic (2)
- # defnpodcast (2)
- # emacs (1)
- # hoplon (617)
- # instaparse (10)
- # lein-figwheel (19)
- # luminus (2)
- # off-topic (12)
- # om (3)
- # onyx (36)
- # pedestal (1)
- # protorepl (43)
- # re-frame (8)
- # ring (7)
- # specter (17)
- # testing (2)
- # untangled (117)
- # yada (12)
How do I pass verbose
to boot in the repl? Not (boot “-v” “build”)
nor (boot :verbose true (build))
works for me.
@vikeri rebind *verbose*
I think
util/*verbosity*
actually
(with-binding [util/*verbosity* 1] (boot ...))
it should be a number 🙂
ah it's an atom yes, confusingly
Added the explanation here: https://github.com/boot-clj/boot/wiki/Boot-Troubleshooting#general-troubleshooting-tips
Hey guys I’m going to repost this here since I think it’s more of a boot question than clojure:
I’m stuck on a way to return a symbol from a fn… if that’s even the right strategy. The pandeiro/boot-http lib for http-proxying accepts a :handler ‘my.app/some-ring-handler
argument (a symbol). If I wanted to do something like
...
(boot-http/serve :handler (make-proxy “/my-api/” “”)
...
I would need to return a symbol for serve
. How does one generate a function inside a function, and instead of returning the generated function, return a symbol for that function? Is this totally incorrect?I think it might be better to back up. what is the point of calling make-proxy
in your build.boot
file?
for example
...
(serve :dir "target"
:port 9000
:handler (make-proxy {:uris-to-proxy "/v1"
:proxy-target “}))
I would expect the :handler to accept either a var, or a symbol, or a function, but it seems to only take a symbol… and I’m wondering if there’s a way to pass args through in that case
hmm. the simple option would be to make a var (i.e. (def proxy1 ...
) for each proxy target and then reference those vars. And I would put those vars into the same ns that your main ring handler is in
I'm not positive about how boot-http works, but it may take a symbol because of using a pod internally, so it wouldn't be able to ship a var or a function to where it needs to be
there is an experimental macro since 2.6.0 btw, that lets you ship almost anything to a pod
I see … that’s a bummer but I did get to learn about clojure sym/var lookup and binding steps 🙂
(def p (make-pod boot.pod/env))
(def x 100)
(defn doit [y] (+ x y))
(with-pod p (def z 200))
(with-pod p (~doit z))
also it hooks into implementation details of clojure so there needs to be some way to choose the correct implementation for the version of clojure in use
@lwhorton I don't think with-pod
really help your specific issue. It's more going to be helpful if you wrote your own tasks and ship arbitrary stuff into a pod
So, I hestitate to mention this because it's kind of a bad practice in general... but @lwhorton you could also write make-proxy
so that it def
s a new global var and then returns that var.
@micha so can with-pod
avoid ad-hoc serialization of stuff like Exceptions?
@richiardiandrea yes, except for ex-infos
ok lol the only case I needed 🙂
Something like this @lwhorton:
(defn make-proxy [args]
(def proxy (-> actual.ns.of.var/routes (wrap-proxy args)))
`proxy)
one approach i was using is if the clojure type has a constructor that takes a java object
I will add a note here: https://github.com/boot-clj/boot/issues/553
@micha Deraen implemented a neat solution using proxy
, I don't know if you have seen it
@lwhorton yeah, good instincts 🙂 I would definitely prefer to make a var per proxy needed
@richiardiandrea do you have a link handy?
fetching it
@micha https://github.com/adzerk-oss/boot-cljs/blob/master/src/adzerk/boot_cljs/util.clj#L76
not complete but working for inter-pod ex-info passing
@lwhorton i think your best bet is to make a namespace that is on the pod's classpath with your handler fn in there
maybe I will reopen that issue just to keep track of it
both boot-cljs
and the future boot-reload
need this so it might be worth implementing
the interesting thing is that java objects that are loaded from a shared parent classloader (like Throwables) don't necessarily need to be serialized
so it would be possible to wrap the ex-info Throwable as the cause of a new ex-info in the caller pod
I think this already happens, if I read the code right...
and I tried without Deraen's trick (so pure ex-info stuff) but it fails
the error was that no reader tag was found (I guess for #error
?)
is parent classloader same as the "root pod"?
or is that the classloader used by Boot binary?
so it doesn't contain Clojure classes?
Hmm, Clojure version is same for every pod... but Clojure contains some global state which must not be shared?
uhm, so when we pass stuff between pod we are basically executing code in Java land only...makes sense then
Clojure version can be different in pod right?
Oh. Though I guess it usually is the same.
oh nice 😄
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ExceptionInfo.java
got it
so we need a custom exception with the data stuff serialized to Java objects basically
uhm I don't think so..
oh it's monkey patching again, I have never used it in cljs 😉
Don’t know if something is corrupted but every boot command I try results in
Downloading ...
Exception in thread "main" java.io.FileNotFoundException:
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at java.net.URL.openStream(URL.java:1038)
at Boot.download(Boot.java:173)
at Boot.install(Boot.java:224)
at Boot.main(Boot.java:243)
@micha That explains it:
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_VERSION=show
BOOT_CLOJURE_VERSION=1.7.0
hi, when i write a namespace with gen-class, and run boot with boot aot repl
, and try to import the class declared in the gen-class, it fails with ClassNotFound but the same thing works if i try to load in a lein repl:
@micha hello micha, i can see the class file created in the target
directory, so it should be, let me run it and see
@juhoteperi is there a way for boot-reload
to know the compiler options when there is no .cljs.edn
file and boot-cljs
has not be triggered yet (aka, before the call to (next-task fileset)
?
no if boot-cljs
has yet to run
yeah I am exactly banging my head against this case
figwheel creates the init script based on compiler opts
old boot-reload cleverly does not 😉
i am trying to subclass a class from jnr-fuse library, and i have the gen-class on the namespace. it can be imported well as well, but when i try to instantiate the class, it fails with classNotFound on something else (some class from the library). weird thing is i can instantiate the superclass i am overriding just fine in the repl
@juhoteperi @micha there is also another problem with the current approach: there can be only one on-jsload
per boot-reload
execution, as opposed to one on-jsload
per build - see here https://github.com/adzerk-oss/boot-reload/blob/master/src/adzerk/boot_reload.clj#L128
but ok that is more like the way boot-reload
differs from figwheel in general
@micha is there a way to get around the issue? or actually figuring out what is going on there.. its weird that i can instantiate the class i am subclassing but it throws exception for the generated class. for example, i am subclassing the ru.serce.jnrfuse.FuseStubFS
class which uses jnr-ffr library, when i do (def a (FuseStubFS.))
after the import, i get no error, but when i do (def b (MyExtendingClass. ))
it throws error (even with nothing added, just subclassing it).
`java.lang.ClassNotFoundException: jnr.ffi.provider.jffi.NativeClosureProxy
java.lang.NoClassDefFoundError: jnr/ffi/provider/jffi/NativeClosureProxy
java.lang.RuntimeException: java.lang.NoClassDefFoundError: jnr/ffi/provider/jffi/NativeClosureProxy`
the above can be solve by having a more complex option like: j on-jsload ID=SYM {str sym} "The callbacks to call when JS files are reloaded. (optional)"