babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
Ben Sless 2021-04-18T11:53:52.255Z

Is there a way in babashka to ensure a minimal version is installed locally?

borkdude 2021-04-18T12:51:10.255700Z

@ben.sless there is an issue for this but not implemented yet

Ben Sless 2021-04-18T12:52:21.257200Z

I find I'm trying to implement it, one hangup I'm faced with is finding the bb executable's path

borkdude 2021-04-18T12:52:30.257300Z

There is a system property you can check though: babashka.version

borkdude 2021-04-18T12:53:27.258300Z

I wonder what should happen on a lower version, throw? Only a warning? How does lein handle this?

Ben Sless 2021-04-18T12:53:56.259200Z

It can by definition only be a forward-compatible feature, no?

Ben Sless 2021-04-18T12:54:07.259600Z

Just add a new command

borkdude 2021-04-18T12:55:03.260700Z

The bb executable path: I asked about this in the GraalVM slack and someone said Graal had some API for it. I havenโ€™t found it though

Ben Sless 2021-04-18T12:56:08.261500Z

we can cheat by searching for the bb executable in path

borkdude 2021-04-18T12:56:42.262Z

The issue proposes a property in bb.edn like lein

borkdude 2021-04-18T12:57:22.262900Z

The bb exec path can be found using fs/which

borkdude 2021-04-18T12:57:32.263300Z

Afk now, back later tonight

Ben Sless 2021-04-18T12:58:25.263500Z

๐Ÿ‘

Ben Sless 2021-04-18T13:32:22.263600Z

Rough sketch for an upgrade task with optional minimal version requirement. Let me know how fragile you think this is when you can

borkdude 2021-04-18T15:20:55.265900Z

@ben.sless A few thoughts: The thing I had in mind is just the :min-bb-version in bb.edn: https://github.com/babashka/babashka/issues/663 like lein does it. Just print a warning to stderr when you don't have the right version. How to upgrade depends on how people installed babashka. You don't want to upgrade bb outside of the package manager if you installed it with a package manager I think? So how to upgrade is probably a custom script that you will have locally (like the one you have) or curl-bash the standard *nix/macos install script.

๐Ÿ‘ 1
borkdude 2021-04-18T15:22:02.267300Z

Another point is that bash is linux/macos specific and bb also supports Windows, so if we would have an upgrade command, it should not depend on a bash script. The binaries on Github are in predictable locations, so it's doable to all do that from Clojure.