babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-06-09T08:42:53.484600Z

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

Ory Band 2021-06-09T14:11:30.487800Z

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?

borkdude 2021-06-09T14:13:16.488200Z

@ory.band The java.time package is available in bb

borkdude 2021-06-09T14:15:22.488400Z

Here is an example: https://github.com/babashka/babashka/blob/master/examples/pst.clj

2021-06-09T15:16:09.491100Z

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.

borkdude 2021-06-09T15:17:50.492500Z

@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

2021-06-09T15:21:09.492700Z

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!

2021-06-09T16:02:09.492900Z

Worked beautifully!

danieroux 2021-06-09T16:44:47.493300Z

$ 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.

borkdude 2021-06-10T10:47:37.002600Z

@danie Released 0.4.5 with the fix now

danieroux 2021-06-10T11:04:06.002800Z

Thank you ๐Ÿ˜Š

danieroux 2021-06-09T16:44:56.493600Z

Am I missing something obvious?

borkdude 2021-06-09T16:58:20.493700Z

Looks like a bug...

borkdude 2021-06-09T17:04:53.493900Z

Feel free to post an issue

borkdude 2021-06-09T17:09:08.494200Z

I found the issue

Ory Band 2021-06-09T17:42:19.494800Z

thanks!

danieroux 2021-06-09T18:00:07.495400Z

Step away from keyboard, come back to answers, thanks @borkdude ๐Ÿ˜Š

borkdude 2021-06-09T18:16:11.495600Z

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

borkdude 2021-06-09T18:17:46.496Z

Or check yourself in #babashka-circleci-builds (should be there in a few minutes)

mathpunk 2021-06-09T23:09:08.497600Z

I'm wrapping up my first real project, and the only thing left is that I'm invoking my main function incorrectly. (Details in ๐Ÿงต)

1
1
๐ŸŽ‰ 1
โœ… 2
mathpunk 2021-06-09T23:09:16.497700Z

$ 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 [&amp; 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 --------------------------------------------------------------
 - &lt;expr&gt;:1:10

mathpunk 2021-06-09T23:11:10.497900Z

Individually, the 3 namespaces I'm using all evaluate w/o error

mathpunk 2021-06-09T23:11:46.498100Z

(earlier i had just "src", "repl" in :path, but the effect was the same)

2021-06-09T23:29:30.498300Z

perhaps the folder needs to be named src/dd_junit instead of src/dd-junit (underscore vs. dash)

2021-06-09T23:30:10.498500Z

and then :paths as "src" and "repl" like you had before

mathpunk 2021-06-09T23:38:38.498700Z

omg i bet that's it, it's always it

mathpunk 2021-06-09T23:38:44.498900Z

and i never remember why lol

mathpunk 2021-06-09T23:40:57.499100Z

YEP, thanks