Got slingshot working: https://github.com/babashka/babashka/blob/master/doc/projects.md#slingshot Also added its test suite to CI. Only one test is failing due to a difference how to records are implemented in bb, but it seems to be a corner case that is hopefully not used a lot (catching by record names). With some effort that may also be fixable. cc @scgilardi
Hi. I'm trying to find an example on how to print UTC datetime strings in ISO-8601 format. I can't find any reference to Java datetime libraries in babashka book. Can some provide any reference please?
@ory.band The java.time
package is available in bb
Here is an example: https://github.com/babashka/babashka/blob/master/examples/pst.clj
I'm trying out babashka tasks, and I'm looking to re-use a babashka script that I was arleady using before tasks.
I'd like to create a task that calls this script, what's the preferred method for doing this?
* (shell "bb script.clj")
* (load-file "script.clj")
* other?
I've seen both of those approaches work. At first, I thought I should be require
'ing this script but idk how I would go about that.
@jvtrigueros load-file
is somewhat cheaper than invoking bb another time, but both should work. You could also add your script to the classpath e.g. by moving it to script/script.clj
and then adding "script"
to :paths
in your bb.edn
. Beware of side effects in your scripts in that case
I'll give that a shot! I'm currently using load-file, but using it as a library is what I'd prefer. Thank you!
Worked beautifully!
$ clojure -J-Dorg.eclipse.jetty.LEVEL=INFO
Clojure 1.10.3
user=> (System/getProperty "org.eclipse.jetty.LEVEL")
"INFO"
user=>
$ bb clojure -J-Dorg.eclipse.jetty.LEVEL=INFO
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
@danie Released 0.4.5 with the fix now
Thank you ๐
Am I missing something obvious?
Looks like a bug...
Feel free to post an issue
I found the issue
thanks!
Step away from keyboard, come back to answers, thanks @borkdude ๐
Pushed a fix. https://github.com/borkdude/deps.clj/issues/46 Which OS are you using? I can provide you with a new binary until the new release
Or check yourself in #babashka-circleci-builds (should be there in a few minutes)
I'm wrapping up my first real project, and the only thing left is that I'm invoking my main function incorrectly. (Details in ๐งต)
$ pwd
/Users/tomhenderson/lg/logicgate/docker-new/scripts/e2e/dd-junit
$ tree -L 3
.
โโโ bb.edn
โโโ repl
โย ย โโโ individual_failures.clj
โย ย โโโ playground.clj
โโโ src
โโโ dd-junit
โโโ core.clj
โโโ datafy.clj
โโโ statsd_client.clj
$ cat bb.edn
{:paths ["src/dd-junit", "repl"]}
$ cat src/dd-junit/core.clj
(ns dd-junit.core
(:require [dd-junit.statsd-client :as statsd]
[dd-junit.datafy :as datafy]
[<http://clojure.java.io|clojure.java.io> :as io]))
...
(defn -main [& args]
(let [junit-path (first args)
user-tags (rest args)]
(doseq [item (prepare-messages junit-path user-tags)]
(println item)
(statsd/send-msg item))))
$ bb -m dd-junit.core
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Could not find namespace: dd-junit.core.
Location: 1:10
----- Stack trace --------------------------------------------------------------
- <expr>:1:10
Individually, the 3 namespaces I'm using all evaluate w/o error
(earlier i had just "src", "repl" in :path, but the effect was the same)
perhaps the folder needs to be named src/dd_junit instead of src/dd-junit (underscore vs. dash)
and then :paths as "src" and "repl" like you had before
omg i bet that's it, it's always it
and i never remember why lol
YEP, thanks