I'm trying to use bb tasks as Makefile replacement.
How to import environment variables?
like set -a ;; source .../myenv ;; ...
now I do
:tasks
{
dev (shell "bash -c 'set -ae ; source VARS ; source ${DEV_ENV} && clojure -M:dev:nrepl'")
}
is there more elegant way?
@maxp Hi! In babashka I use the following method: 1. I can set and control any value by means of config files in EDN-format. I don't need ENV vars in most cases. See example https://github.com/redstarssystems/rssyslib/blob/4de3fa36fcf6fa629f4340bbefacd4842bddc606/bb.edn#L14 2. When I need to set ENV vars for subprocess I do it like this https://github.com/redstarssystems/rssyslib/blob/4de3fa36fcf6fa629f4340bbefacd4842bddc606/bb.edn#L46 3. To read ENV vars I use cprop function from-env
cprop
in Babashka - it's so good! ^)
I prepare myself to switch from shell based scripts.
@mike1452 you don't have to use env
to pass environment variables to a child process, you can use (shell {:extra-env {"FOO" "BAR"}} ....)
It says it takes the same options as babashka.process/process :-)
That's what I need. is it documented?
Documented here: https://book.babashka.org/#_shell
Can something similar be achieved before launching something with (clojure ...)
? (setting env vars)
yes
exactly the same
Damn, I can't even find a single reason for complaining about BB
By the way, I did write very simple caching for BB on CircleCI, it's not particularly smart but it works and allow for upgrading version: https://gist.github.com/helins/59e3abfc96f7a641d608a314fb6b8665
what does the backslash before curl
and tar
mean?
Simply breaks the line, otherwise it was sometimes misbehaving in my terminal. But you could simplify it to something like this it seems: [ -f "bb.tar.gz" ] && tar -xzvf bb.tar.gz
I forgot pretty much everything I knew about Bash...
kind of the point of bb
Could not find any "extra-env" in the hole page :(