Fork me on GitHub
#babashka
<
2021-04-18
>
Ben Sless11:04:52

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

borkdude12:04:10

@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

borkdude12:04:30

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

borkdude12:04:27

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

borkdude12:04:03

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

borkdude12:04:42

The issue proposes a property in bb.edn like lein

borkdude12:04:22

The bb exec path can be found using fs/which

borkdude12:04:32

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

borkdude15:04:55

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

👍 3
borkdude15:04:02

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.