babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-02-07T09:12:15.369400Z

I think it might be better to remove the follow-links behavior in delete-tree as this seems uncommon. Not even rm -rf supports it.

borkdude 2021-02-07T09:14:14.369900Z

Or I don't know. I'll ask a second opinion on this. There might be use cases, but it seems dangerous

lread 2021-02-07T13:03:03.375500Z

fwiw, I have a bb script that does recursive delete, and I have it check for symlinks first and fail if it finds any. This might have been before I realized a delete only deletes the link... just the same I was obviously feeling very cautious about the danger accidentally over-deleting something.

borkdude 2021-02-07T13:06:17.375700Z

right. so same as rm -rf

borkdude 2021-02-07T13:06:25.375900Z

not including the option anymore

lread 2021-02-07T13:12:57.376400Z

cool, good thinking

borkdude 2021-02-07T13:35:55.376600Z

borkdude 2021-02-07T15:31:59.376800Z

borkdude 2021-02-07T15:39:48.377300Z

^ fun lein imitation script based on deps.edn

lvh 2021-02-07T16:27:09.377600Z

klein 😂

1👍
2021-02-07T20:13:00.380600Z

I am writing a script that is intending to process multiple project’s deps.edn, install the deps, and generate the classpath. Ideally I would to use babashka.deps or babashka.clojure but how would I isolate them? How would I run it in such a way where .cpcache and such are generated according to the project’s respective directory?

borkdude 2021-02-07T20:15:22.381800Z

@jayzawrotny You mean something like babashka.deps/add-deps but call it multiple times and get only the resulting classpath for each file?

2021-02-07T20:15:38.382Z

Correct

2021-02-07T20:16:48.383500Z

Now that I think about it I don’t think babashka.deps or babashka.clojure is the best tool for the job on this one. Perhaps I’m better off shelling out to bb --clojure to process those deps as a separate process in their respective project directories?

borkdude 2021-02-07T20:16:51.383600Z

Calling add-deps does what it says: it only adds deps to the classpath, it doesn't replace the previous classpath. However, you can hack around this by storing the previous classpath and use str/replace to remove it from the next one. This is relying on the impl detail that the classpath is only concatenated currently and there is no de-duplication whatsoever.

borkdude 2021-02-07T20:17:52.384500Z

yeah, you can shell out using babashka.process or clojure.java.shell and set the :dir argument to start the processes from a different dir

borkdude 2021-02-07T20:18:34.385Z

I think that would be the most reliable

2021-02-07T20:18:54.385400Z

And if I combine that with the --clojure flag it should work on windows?

borkdude 2021-02-07T20:19:01.385600Z

yes, it should

borkdude 2021-02-07T20:19:19.386100Z

this is one of the reasons I included this, since clojure on Windows is a bit messy with powershell and shelling out and such

2021-02-07T20:19:53.386600Z

Good idea!

2021-02-07T20:20:32.387200Z

The fs package came at a perfect time too, I didn’t even think about how platform specific my path separators were 😅

borkdude 2021-02-07T20:22:40.387400Z

:)