babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
cheel 2021-02-22T03:43:32.018600Z

An example on talking to a babashka-pod with common-lisp. Just tried it out for chills https://github.com/rorokimdim/stash/tree/master/scripting-examples/common-lisp

🤓 2
borkdude 2021-02-22T08:46:05.020Z

@dorabThanks for sponsoring on Github. Would you like an invite to the private sponsors channel?

Eamonn Sullivan 2021-02-22T10:00:41.023900Z

How do you sponsor on Github? I've never done that, though I probably should...

borkdude 2021-02-23T08:53:54.045300Z

Thanks for your kind donation on Kofi!

Eamonn Sullivan 2021-02-23T08:56:57.046200Z

Well, it's not much, but there's so many different packages that I use every day. I made several one-off $/£/€ donations this morning and set a reminder to do the same next year. I'll make it a Lent thing!

borkdude 2021-02-23T09:03:00.046400Z

Nice! :)

Eamonn Sullivan 2021-02-22T10:01:34.024400Z

Oh, I see the opencollective link now...

borkdude 2021-02-22T10:02:14.024700Z

@eamonn.sullivan You can go to https://github.com/sponsors/borkdude and then it should be self-explanatory I hope

borkdude 2021-02-22T10:02:30.024900Z

Thanks for considering

👍 2
borkdude 2021-02-22T10:04:02.025700Z

As a sponsor you will get priority in bug reports and also access to the private sponsors channel, but the main thing is to ensure continuity of this project.

borkdude 2021-02-22T12:26:26.026200Z

@pfeodrippe Thanks for sponsoring! Would you like to have access to the private sponsors channel?

pfeodrippe 2021-02-22T12:40:03.026300Z

Hi @borkdude o/ Yes, of course :) Thanks

Mikko Harju 2021-02-22T14:18:22.028100Z

What's the best way to achieve . ${MY_CNF_SCRIPT} in babashka? Basically that file includes just a bunch of bash variables that can be then subsequently used later in the script. I'd like to reuse that file and just get the vars to babashka env

Mikko Harju 2021-02-22T14:19:02.028200Z

I have a legacy project that has extensive bash tooling and I'm extending that setup with a couple of separate scripts that use babashka instead of Bash

grazfather 2021-02-22T14:34:08.028400Z

source is a builtin, it’s special that it ‘survives’ the ‘subprocess’, Have you tried making a script that itself does source, and then source that bb script?

grazfather 2021-02-22T14:34:49.028600Z

actually, I think just setting the env in your babashka and then sourcing that script might work

Mikko Harju 2021-02-22T14:36:41.028800Z

Yeah, that is what I imagined what I'll have to do – I thought there could be some nifty way to get the variables set by the script to be incorporated directly withing a babashka script. Thanks!

grazfather 2021-02-22T15:02:30.029Z

I don’t think so: The invoker must explicitly be setup to ‘adopt’ the changed env vars, and that’s what source does. Let me know if a simple source <http://bla.bb|bla.bb> where bla does setenv works, I am curious (and at work and cannot check)

borkdude 2021-02-22T15:41:26.032100Z

I do have a nifty hack here: produce some bash with babashka and source that ;) https://stackoverflow.com/a/64804398/6264

✅ 1
grazfather 2021-02-22T15:42:38.032400Z

Ah, sneaky. You just output a script 🙂 Probably nicer to use process substitution? e.g.

source &lt;(bb -o ...

borkdude 2021-02-22T15:42:50.032600Z

sure

Mikko Harju 2021-02-22T18:28:39.033800Z

Nice, thanks!

borkdude 2021-02-22T19:16:19.034200Z

Adam is working on some babashka scripts here, while streaming: https://www.twitch.tv/adam_james_tv

🚀 3
🙂 1
grazfather 2021-02-22T19:17:54.034600Z

Oh nice, I actually asked him to do something like that

dorab 2021-02-22T20:49:45.035300Z

Sure. Thanks.

borkdude 2021-02-22T21:31:04.035700Z

Is Adam from the stream in this channel?

borkdude 2021-02-22T21:31:22.036100Z

I have a solution for his spec problem ;)

grazfather 2021-02-22T21:32:55.036700Z

I don’t know, but I told him that I found his stream via your post so he’s at least aware of this slack

grazfather 2021-02-22T21:33:12.037Z

@adam.james?

grazfather 2021-02-22T21:33:43.037800Z

Never trust a man with two first names

borkdude 2021-02-22T21:35:15.039400Z

Ah right. So what you can do:

/tmp $ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {borkdude/spartan.spec {:git/url "<https://github.com/borkdude/spartan.spec>" :sha "e5c9f40ebcc64b27b3e3e83ad2a285ccc0997097"}}}')
/tmp $ cat spartan.clj
(require '[spartan.spec])

(alias 's 'clojure.spec.alpha)

(s/valid? int? 1)

/tmp $ bb -f spartan.clj --uberscript spartan.uber.clj
/tmp $ bb spartan.uber.clj
true
Using alias will avoid uberscript loading in the source from the "real" spec. And since spartan.spec create the clojure.spec.alpha namespace already, this is a good solution. I will change the spartan.spec README as well.

borkdude 2021-02-23T08:46:16.043Z

Yeah, it's a partial drop-in since not everything in spec is implemented (generators and instrumentation). But the way it creates the clojure.spec.alpha namespace is non-standard which confuses the uberscript

borkdude 2021-02-22T21:43:46.040100Z

If you are using uberscripts solely for the purpose of being able to run them from anywhere, an alternative might be to just add the script "project" directory to the path

borkdude 2021-02-23T09:06:01.046600Z

I love it :)

borkdude 2021-02-22T21:44:58.041200Z

Another alternative is to create "uberjars" from them and wrap it in a tiny bash wrapper if you don't want to type bb foo.jar

👍 1
adam-james 2021-02-22T23:38:23.041300Z

Hey, I resemble that remark 😉