This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-03
Channels
- # announcements (1)
- # babashka (31)
- # babashka-sci-dev (53)
- # beginners (33)
- # calva (54)
- # cider (15)
- # clj-kondo (9)
- # clojure (115)
- # clojure-dev (19)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (78)
- # clojurescript (10)
- # clr (9)
- # community-development (9)
- # core-async (24)
- # cursive (18)
- # datomic (59)
- # emacs (43)
- # figwheel-main (2)
- # fulcro (4)
- # graphql (4)
- # malli (7)
- # meander (12)
- # nbb (14)
- # off-topic (22)
- # polylith (8)
- # re-frame (5)
- # reitit (3)
- # releases (1)
- # shadow-cljs (36)
- # sql (1)
- # tools-build (23)
- # xtdb (13)
Does anyone have a shell oneliner for installing both babashka
and bbin
that works on Linux? Something like https://rustup.rs/. bbup
?
Context: I want to lower the effort required to share bb scripts with colleagues who donβt use Clojure each day. I would love to have a README with something like
# My tool
## setup
curl | ...
bbin install io.github.teodorlu/mytool
for bbin, see docs here: https://github.com/babashka/bbin/blob/main/docs/installation.md#manual-linux-and-macos
I notice the versions should be updated in the bbin install instructions (cc @U0CLCL6T0)
good point, with brew you even have to only install bbin
since that depends on babashka
I threw something together: https://bbup.teod.eu/ It doesn't add the bbin folder to PATH yet. I want to do that defensively -- only modifiy bashrc and zshrc files if it's not on PATH together.
When copying the url manually:
curl --proto '=https' --tlsv1.2 -sSf | sh
/usr/bin/sh: 18: Syntax error: "(" unexpected
I guess it should be piped into | bash
instead of sh
. Also the extension suggests .sh
while the script actually uses bash syntax
[email protected]:/# uname -a
Linux 03ec0c99f8cb 5.10.76-linuxkit #1 SMP PREEMPT Mon Nov 8 11:22:26 UTC 2021 armv7l armv7l armv7l GNU/Linux
As you've noticed, it doesn't quite work yet.
1. I obviously should add a message that this doesn't quite work yet to the HTML
2. I'd like to make it work under "posix sh" - so we don't need to rely on bash being installed on newer macs. I'm not 100 % sure about the subtle differences between posix sh and bash, but I think it should be doable.
3. Right now I'm not using the javascript "which platform am I using" for anything - I always download and run install.sh
(https://github.com/teodorlu/bbup.teod.eu/blob/master/install.sh).
4. Not sure why you're getting an amd binary on arm linux, I'd like to avoid that.
5. Testing from Docker is a great suggestion - I've been "testing" so far with bash install.sh --dry-run
, but Docker is great for testing what actually happens.
6. "When copying the url via the UI you get a Rust url, I almost accidentally installed rust". Yeah, sorry about that! It surprised me as well. The javascript code ignored the HTML content, and had hard-coded the script from a javascript constant instead. (https://github.com/teodorlu/bbup.teod.eu/commit/7867b10f1b14de0a139076abeb66fce36859a944)
Thanks for testing!! π
@U04V15CAJ I've fixed the errors I found, and the scripts seem to be working when I'm testing with Docker. To test (again):
curl --proto '=https' --tlsv1.2 -sSf | sh
I also made a minmal dockerfile:
$ git clone [email protected]:teodorlu/bbup.teod.eu.git
[...]
$ cd
$ docker build -f ex4.dockerfile -t tmp . && docker run --rm -it tmp
[...]
# curl --proto '=https' --tlsv1.2 -sSf | sh
Downloading to /tmp/tmp.sradVD3GDy
Successfully installed bb in /usr/local/bin
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 26760 100 26760 0 0 86845 0 --:--:-- --:--:-- --:--:-- 86601
bbup has detected that you are running bash
Adding
export PATH="$HOME/.babashka/bbin/bin:$PATH"
to /root/.bashrc ...Done!
Please run
source /root/.bashrc
or restart your shell to run Babashka or bbin.
after installing:
[[email protected] /]# bb -e '(inc 10)'
11
[[email protected] /]# source /root/.bashrc
[[email protected] /]# bbin install io.github.borkdude/carve
[...]
[[email protected] /]# carve --help
Downloading pod clj-kondo/clj-kondo (2023.01.20)
Successfully installed pod clj-kondo/clj-kondo (2023.01.20)
Carve: remove unused Clojure vars.
--report Set to true to report and not transform code
--interactive Interactive mode: ask what to do with an unused var
--silent When truthy, does not write to stdout. Implies :interactive false.
--report-format The report format: :text, :edn or :ignore
--ignore-vars A list of vars to ignore
--paths A list of paths to analyze (files and dirs)
--out-dir Emit transformed code to out-dir instead of overwriting
--aggressive Run carve multiple times to detect transitive unused vars
--clj-kondo/config A map of clj-kondo config opts that are passed on to clj-kondo
--opts The options as an EDN literal
--api-namespaces A list of namespaces to ignore
--dry-run Dry run
--help Display help
--carve-ignore-file The file with ignored vars
I'm looking into making a library compatible and this library has a data_readers.clj
file. So far I haven't made babashka pick up on this automatically as this incurs a little bit of startup time (to scan the classpath for those files).
I'm considering doing this lazily, when an (unknown) data reader is used for the first time...
Data readers are quite tool-breaking, for sure (or tools aren't yet invested in being data readers compatible!). Not sure about all possible tradeoffs, but laziness might be great.
Got something working: https://twitter.com/borkdude/status/1621594481605615618