This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-10
Channels
- # announcements (1)
- # babashka (44)
- # beginners (188)
- # calva (37)
- # chlorine-clover (28)
- # cider (12)
- # clj-kondo (40)
- # clojars (1)
- # clojure (323)
- # clojure-austin (7)
- # clojure-europe (20)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-spec (7)
- # clojure-uk (37)
- # clojuredesign-podcast (1)
- # clojurescript (30)
- # cryogen (2)
- # cursive (30)
- # data-science (1)
- # datomic (26)
- # emacs (1)
- # events (1)
- # figwheel-main (13)
- # fulcro (89)
- # garden (1)
- # graalvm (20)
- # graphql (8)
- # jobs (1)
- # jobs-discuss (1)
- # joker (6)
- # kaocha (125)
- # lambdaisland (1)
- # meander (42)
- # off-topic (18)
- # pathom (3)
- # pedestal (6)
- # shadow-cljs (55)
- # spacemacs (21)
- # sql (18)
- # tools-deps (8)
- # uncomplicate (2)
- # vim (1)
- # yada (3)
well, either pin the version of update frequently. aren't those two contradicting? ๐
yes, I was thinking of having something in the repo that says BABASHA_VERSION=v0.0.75
and when I update it to 0.0.76
everybody gets the latest version
so 1) not have a binary in the repo but only the version string, and 2) having a bash script that checks, do I have this version, if not download it
borkdude@MBP2019 /tmp $ export BABASHKA_VERSION=0.0.75
borkdude@MBP2019 /tmp $ curl -sL -o bb.zip
borkdude@MBP2019 /tmp $ unzip bb.zip
Archive: bb.zip
inflating: bb
borkdude@MBP2019 /tmp $ ./bb --version
babashka v0.0.75
@mkvlr You could so something like this:
#!/usr/bin/env bb
(require '[clojure.java.shell :refer [sh]]
'[clojure.string :as str]
'[babashka.curl :as curl])
(def current-version (str/trim (:out (sh "bb" "--version"))))
(def desired-version (System/getenv "BABASHKA_VERSION"))
(if (str/ends-with? current-version desired-version)
(println (format "Babashka version %s already installed." desired-version))
(do (println (format "Downloading babashka version %s..." desired-version))
(curl/get (str/replace "" "$BABASHKA_VERSION" desired-version)
{:raw-args ["-o" "bb.zip" "-L"]})
(sh "unzip" "bb.zip")))
you can download bb just the way you want, there is no preferred way. just download the binary, place it on the path and run.
#!/bin/bash
# this scripts downlaods babashka when needed and runs it
name=babashka
version="0.0.75"
install_dir="$(pwd)/.store/$name-$version"
if ! [[ -f "$install_dir/bb" ]]; then
case "$(uname -s)" in
Linux*) platform=linux;;
Darwin*) platform=macos;;
esac
echo "$name $version not found, installing to $install_dir..."
download_url=""
mkdir -p $install_dir
echo -e "Downloading $download_url."
curl -o bb.zip -sL "$download_url"
unzip -qqo "bb.zip" -d $install_dir
rm "bb.zip"
fi
exec ./.store/$name-$version/bb "$@"
I have to say, once you write babashka scripts, one never wants to go back to bash ๐
I've noticed that a large number of people using it are not even Clojure people, at least judging by their projects on github. Lots of Go and Python. This I think is a really good thing
@porkostomus cool. where did you see this?
Just by snooping on folks who have starred 4bb
Well to be fair, 4clojure is a complete webapp and this is just a script I made to run the problems from the command-line, but yes ๐ค
(very small sample size, but hey ๐)
I had to verify if there was an issue with Github Actions so I used babashka as an example https://github.com/jeroenvandijk/babashka/runs/498935151?check_suite_focus=true Everything builds ๐
Here is a pull request https://github.com/borkdude/babashka/pull/291 Feel free to ignore ๐
@jeroenvandijk Thanks. I already had an issue and a branch for Github actions: https://github.com/borkdude/babashka/issues/279 But I'll use yours to study how you did things and borrow a thing or two!