Fork me on GitHub
#babashka
<
2021-06-09
>
borkdude08:06:53

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 Band14:06:30

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?

borkdude14:06:16

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

jvtrigueros15:06:09

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.

borkdude15:06:50

@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

jvtrigueros15:06:09

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!

jvtrigueros16:06:09

Worked beautifully!

danieroux16:06:47

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

borkdude16:06:20

Looks like a bug...

borkdude17:06:53

Feel free to post an issue

borkdude17:06:08

I found the issue

danieroux18:06:07

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

borkdude18:06:11

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

borkdude18:06:46

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

borkdude10:06:37

@U9E8C7QRJ Released 0.4.5 with the fix now

danieroux11:06:06

Thank you ๐Ÿ˜Š

danieroux16:06:56

Am I missing something obvious?

mathpunk23:06:08

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

3
โœ… 5
๐ŸŽ‰ 3
2
mathpunk23:06:16

$ 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]
            [ :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

mathpunk23:06:10

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

mathpunk23:06:46

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

thegeez23:06:30

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

thegeez23:06:10

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

mathpunk23:06:38

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

mathpunk23:06:44

and i never remember why lol

mathpunk23:06:57

YEP, thanks