This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-22
Channels
- # announcements (10)
- # babashka (40)
- # beginners (192)
- # calva (9)
- # cider (2)
- # clj-kondo (9)
- # clojure (69)
- # clojure-dev (15)
- # clojure-europe (29)
- # clojure-gamedev (6)
- # clojure-italy (2)
- # clojure-nl (41)
- # clojure-spec (49)
- # clojure-uk (11)
- # clojurescript (68)
- # conjure (1)
- # cryogen (20)
- # cursive (37)
- # data-oriented-programming (10)
- # data-science (4)
- # datahike (7)
- # datomic (8)
- # depstar (14)
- # emacs (7)
- # events (2)
- # figwheel-main (1)
- # fulcro (81)
- # honeysql (22)
- # hugsql (5)
- # juxt (3)
- # leiningen (8)
- # lsp (314)
- # malli (20)
- # meander (15)
- # membrane (20)
- # mid-cities-meetup (11)
- # practicalli (2)
- # reagent (2)
- # remote-jobs (2)
- # ring-swagger (1)
- # rum (3)
- # sci (21)
- # shadow-cljs (52)
- # startup-in-a-month (1)
- # testing (9)
- # tools-deps (41)
- # vim (8)
- # xtdb (4)
An example on talking to a babashka-pod with common-lisp. Just tried it out for chills https://github.com/rorokimdim/stash/tree/master/scripting-examples/common-lisp
@dorabThanks for sponsoring on Github. Would you like an invite to the private sponsors channel?
How do you sponsor on Github? I've never done that, though I probably should...
Well, it's not much, but there's so many different packages that I use every day. I made several one-off $/£/€ donations this morning and set a reminder to do the same next year. I'll make it a Lent thing!
Oh, I see the opencollective link now...
@eamonn.sullivan You can go to https://github.com/sponsors/borkdude and then it should be self-explanatory I hope
As a sponsor you will get priority in bug reports and also access to the private sponsors channel, but the main thing is to ensure continuity of this project.
@pfeodrippe Thanks for sponsoring! Would you like to have access to the private sponsors channel?
Hi @U04V15CAJ o/ Yes, of course :) Thanks
What's the best way to achieve . ${MY_CNF_SCRIPT}
in babashka? Basically that file includes just a bunch of bash variables that can be then subsequently used later in the script. I'd like to reuse that file and just get the vars to babashka env
I have a legacy project that has extensive bash tooling and I'm extending that setup with a couple of separate scripts that use babashka instead of Bash
source is a builtin, it’s special that it ‘survives’ the ‘subprocess’, Have you tried making a script that itself does source
, and then source that bb script?
actually, I think just setting the env in your babashka and then sourcing that script might work
Yeah, that is what I imagined what I'll have to do – I thought there could be some nifty way to get the variables set by the script to be incorporated directly withing a babashka script. Thanks!
I don’t think so: The invoker must explicitly be setup to ‘adopt’ the changed env vars, and that’s what source
does.
Let me know if a simple source
where bla does setenv works, I am curious (and at work and cannot check)
I do have a nifty hack here: produce some bash with babashka and source that ;) https://stackoverflow.com/a/64804398/6264
Ah, sneaky. You just output a script 🙂 Probably nicer to use process substitution? e.g.
source <(bb -o ...
Nice, thanks!
Adam is working on some babashka scripts here, while streaming: https://www.twitch.tv/adam_james_tv
Oh nice, I actually asked him to do something like that
I don’t know, but I told him that I found his stream via your post so he’s at least aware of this slack
Never trust a man with two first names
Hey, I resemble that remark 😉
Ah right. So what you can do:
/tmp $ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {borkdude/spartan.spec {:git/url "" :sha "e5c9f40ebcc64b27b3e3e83ad2a285ccc0997097"}}}')
/tmp $ cat spartan.clj
(require '[spartan.spec])
(alias 's 'clojure.spec.alpha)
(s/valid? int? 1)
/tmp $ bb -f spartan.clj --uberscript spartan.uber.clj
/tmp $ bb spartan.uber.clj
true
Using alias
will avoid uberscript loading in the source from the "real" spec. And since spartan.spec create the clojure.spec.alpha namespace already, this is a good solution. I will change the spartan.spec README as well.Thanks for this example. I am able to get your code working, however, it doesn't work when I also pull in my svg library. As soon as I require svg-clj (where the real use of spec occurs), uberscript will pull in clojure spec's code.
If I modify my ns
(ns svg-clj.main
(:require [clojure.string :as st]
#_[clojure.spec.alpha :as s] ;; eliminate spec requirement here
[clojure.pprint :as pp]
[clojure.data.xml :as xml]
#?(:clj
[hiccup.core :refer [html]])
#?(:cljs
[cljs.reader :refer [read-string]])))
Then your approach works. I was thinking of spartan as a complete 'drop in' replacement, but I may have to use a reader conditional in my library to get it to work with an uberscriptYeah, it's a partial drop-in since not everything in spec is implemented (generators and instrumentation). But the way it creates the clojure.spec.alpha namespace is non-standard which confuses the uberscript
If you are using uberscripts solely for the purpose of being able to run them from anywhere, an alternative might be to just add the script "project" directory to the path
These are good suggestions. The uberscript approach was the first one I tried and succeeded with. I still plan to try uberjars as well. It's the next on the list. I'm still very much in the 'exploratory' phase of scripting :)