Fork me on GitHub
#babashka
<
2020-10-27
>
Schpaa15:10:19

Is there an easy method of using your own modules in baba? Say I just wanted to extract some functions, already written, and use them in several scripts…

Schpaa15:10:44

(like I would use include files in C, for instance)

borkdude15:10:34

@schpaencoder Sure. You can make libraries like you would with clj and then add them to your classpath with export BABASHKA_CLASSPATH=$(clojure -Spath ...) You can use github repositories as dependencies with clojure. Another option is to just add your utilities to the classpath with export BABASHKA_CLASSPATH=/home/foobar/babashka_libs for example

Schpaa15:10:43

Does the last option require me to create .jar-files or will plain source.clj do?

borkdude15:10:12

@schpaencoder It doesn't require you to make .jar files. You can use any directory on the classpath.

Schpaa15:10:24

Oh, what a relief!

borkdude15:10:49

It does follow the convention of clojure in that foo-bar.baz searches for /foo_bar/baz.clj

Schpaa15:10:19

thank you again, you just saved me some gray hair

Schpaa15:10:23

indeed, I can do this!

Schpaa15:10:13

I think that the BABASHKA_PRELOADS was the feature I really was looking for

borkdude15:10:16

yeah, you can also use that