Fork me on GitHub
Ben Sless11:04:52

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


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

Ben Sless12:04:21

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


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


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

Ben Sless12:04:56

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

Ben Sless12:04:07

Just add a new command


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 Sless12:04:08

we can cheat by searching for the bb executable in path


The issue proposes a property in bb.edn like lein


The bb exec path can be found using fs/which


Afk now, back later tonight

Ben Sless13:04:22

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


@ben.sless A few thoughts: The thing I had in mind is just the :min-bb-version in bb.edn: 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.

👍 3

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.