This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-31
Channels
- # architecture (5)
- # beginners (35)
- # boot (150)
- # cider (1)
- # clara (7)
- # cljs-dev (131)
- # cljsrn (10)
- # clojure (76)
- # clojure-austin (3)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-chicago (2)
- # clojure-dusseldorf (1)
- # clojure-italy (30)
- # clojure-nl (2)
- # clojure-russia (40)
- # clojure-serbia (2)
- # clojure-spec (25)
- # clojure-uk (13)
- # clojured (2)
- # clojurescript (106)
- # core-async (29)
- # datascript (65)
- # datomic (38)
- # emacs (8)
- # funcool (8)
- # hoplon (6)
- # jobs (3)
- # klipse (93)
- # luminus (16)
- # lumo (4)
- # off-topic (2)
- # om (11)
- # onyx (13)
- # pedestal (4)
- # protorepl (3)
- # re-frame (40)
- # reagent (31)
- # ring (6)
- # ring-swagger (4)
- # slack-help (5)
- # spacemacs (13)
- # untangled (17)
- # vim (2)
@geoffs https://github.com/boot-clj/boot/commit/afd0a1a3e8b827560e8e761c450488ea55d6cd6c
right, i've seen some of the discussion around that. luckily I don't need to pass anything except a port number š
It seems like all this would be useful info to have in the task author's wiki page. I might edit that in later if that's alright
it's not crazy, it's just easy to overlook things with all the nested arguments going on
and so if you pass positional arguments through from a wrapper deftask to the inner deftask they'll still be strings...
yeah. We're on the same page. I'm just doing this:
(deftask smoke-test []
(comp
(build)
(testing)
(apply run :namespace 'project.dev-main *args*)
(wait)))
I'm a little surprised that I need the wait
in there, because I thought my main function in project.dev-main
would block...
thanks again! I'll try to find some time soon to pull all this info into the wiki š
boot.user=> (deftask foop []
#_=> (with-pass-thru _
#_=> (prn {:opts *opts* :args *args*})))
#'boot.user/foop
boot.user=> (boot (foop [1 2 3]))
boot.user=> java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.CharSequence
boot.user=> (boot (foop "--" [1 2 3]))
{:opts {}, :args ([1 2 3])}
nil
This should be quite general way to pass exceptions task pods to main pod: https://github.com/boot-clj/boot-cljs/commit/af670d3acff6990b7ba256d7ae0d12b82b744948 @micha @richiardiandrea
Though I best test what happens if I send Less4JError or something from pod to main pod, when the class is not available in main classloader
java.io.NotSerializableException: com.github.sommeri.less4j.core.problems.GeneralProblem
clojure.lang.Compiler$CompilerException: java.io.NotSerializableException: com.github.sommeri.less4j.core.problems.GeneralProblem, compiling:(adzerk/boot_cljs/util.clj:71:5)
Oh no šOh dang
Can they be passed among pods?
Exceptions yes, all Throwables are Serializable, but custom exceptions can refer other objects that are not necessarily serializable
Clojure datastructures should also be Serializable, at least all I tested
also File etc. basic Java classes
So @juhoteperi is it a good for porting it to boot-figwheeu
? Is it only in Snapshot
Yeah, should work fine for Cljs use-case
Hmm, but Figreload doesn't really need to serialize&deserialize the exceptions?
Only to create Figwheel compatible map from the exception
@richiardiandrea I think the Figreload serialize-exception
is probably fine as is, the use-case there is different to boot-cljs
@juhoteperi i thought you changed also the way to save them in the meta
I see now that you did not š
Ah no, the latest change shouldn't change them from the yesterdays version, and even that shouldn't have changed it much
@juhoteperi would you be OK in recursively change the :file
key in the exception
Either that or I need to ask Bruce š
You can do that quite easily in Figreload side also
For some reason the :file is absolute
https://github.com/boot-clj/boot-figreload/blob/master/src/powerlaces/boot_figreload/util.clj#L31
Take the :file
from first ex-data and overwrite :file
inside recursive calls with that
But isn't a bit inconsistent that one file is relative and all the others absolute ?
It would have been easy to do in Boot-cljs with the previous implementation, but currently I don't walk the cause stack through at all but only pass all the exceptions as is
Hmm not really
The absolute paths are from the original Cljs exceptions
Only the top-most exception from Boot-cljs has the relativized path
Mmm also probably it will be solved on the compiler side, I saw the discussion on #cljs-dev
Ah OK so if that is the reason, I could throw the first away
If you create one on top of the compiler ones I mean
Sure, you can do that
But the I guess you'll see the absolute path
But that would not solve anything lol
(defn serialize-exception'
[e file]
{:class (-> e type .getName)
:message (.getMessage e)
:data (cond-> (safe-data (ex-data e))
file (assoc :file file))
:cause (when-let [cause (.getCause e)]
(serialize-exception cause (or file (:file (ex-data e)))))})
(defn serialize-exception
[e]
(serialize-exception' e nil))
K cool I will go for a custom walk (which I already doing anyways)
^ I think something like that would work. Probably can be done even simpler.
perhaps check to only assoc :file
if ex-data is not nil
Yeah just maybe I would override only if relative is included on the absolute
Yeah and the nil check as well
@juhoteperi last question for you š figwheel detects when deps.js is changing I think and send a big eval command when it does, would it be something useful to add on our side? I find it quite useful if we will be watching node_modules
at some point
Probably. I haven't yet tried to do real work with new features so I don't know how the workflow is and what happens without that.
If foreign-lib JS in fileset changes, boot-reload would reload that, I think.
Because boot-reload watches for changed JS files.
Oh OK, I don't remember having seen that, I will double check again, maybe it is easier than I thought then
im wondering if its possible to connect to a datomic database created in one boot task from another. currently i am having trouble doing this, and keep getting an error:
actual: clojure.lang.ExceptionInfo: :db.error/db-not-found Could not find db-fixture in catalog
(deftask build-test-system
[]
(comp
(environ :env test-env)
(sass :output-style :compressed)
(sift :move {#"app.css" "public/app.css"})
(cljs :optimizations :advanced
:compiler-options {:devcards true
:externs ["src/client/externs/app.ext.js"]
:closure-defines {"goog.DEBUG" false}}
:ids #{"public/combined"})
(run :main-namespace "arc.core" :arguments [#'prod-system])))
(deftask test-all []
(comp
(build-test-system) ;; Where we compile
(test) ;; Where the failure is, we try to connect to the db in an integration test
(test-cljs :keep-errors? true)
(compare-screenshots :solano true)
(report-errors!)))
basically we compile and call run in the build-test-system
task, and that starts an in memory database.
then in the test
we run some integration tests, that want to connect to the database using d/connect
the uri i pass in looks correct, its just not finding the database even though it still exists
@kenbier if test
is from boot-test
I believe that runs your tests inside a pod, so itās running in a totally different invocation of clojure. Not sure how datomic memory databases work, but I bet thatās why itās not working.
To me that seems like youāre really mixing concerns though. If you need to start your prod-system for the tests, then do that in the tests.
if i were to do that, i would have make a task that starts my prod-system and then run the tests on the same fileset?
or i suppose i could try starting the prod-system in one of the test files themselves, that might be even simpler than trying to make a new task out of boot-test/test
that also starts my system.
ill try that for now, thanks @geoffs.
to start your system in a separate task youād probably have to reimplement the internals of boot-test to some degree, I donāt think thereās a way to just run some code inside the pod that it is going to run your tests in.
geoffs: so your suggestion helped, just starting my system in the first test worked š
though i did find: https://github.com/adzerk-oss/boot-test/blob/1.2.0/src/adzerk/boot_test.clj#L164
i couldnāt get it to work though. i have a simple function with no args that i want to pass in as a startup, but it complains it cant find it when it comes time to evaluate it
You probably want to do it something like:
:startup '[(do (require āarc.core) (arc.core/prod-system)])
assuming that arc.core/prod-system
is a function that takes no arguments and starts the system.
If youāre using component and thatās actually a component map I would write a little helper function that just does all the startup stuff.
I have a boot task where Iām transforming my index.html file from the fileset and committing it as a resource https://github.com/AdamFrey/boot-asset-fingerprint/blob/master/src/afrey/boot_asset_fingerprint.clj#L38-L54. My file is transformed correctly in the target directory when I run my task, but the untransformed file is served from boot-http. Does anyone have an thought of why thatās happening?
@adamfrey Is your serve
task after asset-fingerprint
what happens if you make a task to debug print the contents of the file from the classpath?
I found a fix. In this line: https://github.com/AdamFrey/boot-asset-fingerprint/blob/master/src/afrey/boot_asset_fingerprint.clj#L10 I was finding my source files with core/output-files
but I needed to be using core/input-files
.
@micha when I call this task right before my serve
task it prints the transformed file, but I still get the old version from curling the server
(deftask check []
(with-pass-thru [_]
(prn (slurp (io/resource "index.html")))))
@adamfrey What serve
options are you using?
Hmm, it should be trying to serve files from classpath root by default
I switched to your boot-alt-http and now my options are (serve :port 3000 :prefixes #{āā})
Looking at asset-fingerprint
, you empty the tmp-dir each time, but only write the changed files to tmp dir
So when you change any files, tmp-dir is emptied but no html files get written
Probably not. If you remove some html files from your source/resource-paths, the results from those will be left to tmp-dir, but usually that is not a problem.
Boot-cljs/less/sass just don't care about deleted files
anyone know of a good tutorial for boot/om-next ? all the om tutorial I find are lein based
qqq: i remember when it first came out i went through https://github.com/awkay/om-tutorial
^ @juhoteperi this is why I wanted to handle it at the source š now it is done anyways š