This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-20
Channels
- # aleph (11)
- # announcements (3)
- # babashka (35)
- # babashka-sci-dev (28)
- # beginners (29)
- # calva (51)
- # cider (33)
- # clj-kondo (26)
- # clj-on-windows (1)
- # clojure (40)
- # clojure-austin (1)
- # clojure-europe (47)
- # clojure-nl (9)
- # clojure-norway (7)
- # clojure-uk (5)
- # clojurescript (69)
- # conjure (30)
- # cursive (7)
- # data-science (9)
- # datomic (2)
- # etaoin (10)
- # events (2)
- # fulcro (1)
- # graalvm (1)
- # gratitude (6)
- # helix (16)
- # honeysql (20)
- # hyperfiddle (14)
- # inf-clojure (2)
- # jobs (1)
- # jobs-discuss (12)
- # kaocha (9)
- # leiningen (2)
- # lsp (4)
- # malli (8)
- # music (9)
- # off-topic (12)
- # pathom (10)
- # portal (14)
- # practicalli (15)
- # re-frame (27)
- # reitit (7)
- # remote-jobs (4)
- # sci (37)
- # shadow-cljs (16)
- # sql (8)
- # tools-deps (6)
- # vim (6)
- # xtdb (21)
What would be an ideal way to do some git wrangling with babashka? Is jgit available?
I usually shell out (even from Clojure)
Yep, we run it via clojure.java.shell
and we use git very extensively (although we don't use babashka)
I've been thinking about if it was useful to use a proper git library instead of shelling out to avoid overhead of sub-process execution but my guess is that when this matters, the command line git client is probably gonna be more performant than the library anyway.
the clojure CLI (tools jar) used a git library before, but this turned out to be problematic and did not reflect what people got when they executed git on the command line.
an ideia is just to wrap the shell out in some helper functions to feel like an API
yup, Im just thinking the part of parsing the response, for commands to pull logs and etc
since https://github.com/clojure/tools.gitlibs migrated to shelling out, it works with babashka from source as well
Thanks all. Just shelled out 😄
I used git log --format="{:author \"%an\"}"
etc to have git return me a nicely formatted object that I can then simply read-string
with
i just did something similar a few weeks ago here: https://github.com/russmatney/clawe/blob/master/src/ralphie/git.clj#L334-L392 - i love the format-string -> edn/read-string pattern for reading from command line tools into babashka, it's quite nice
@borkdude https://github.com/babashka/fs/blob/68b42dd1b6ee22cbcca6e6a807cfb079b608f033/src/babashka/fs.cljc#L778-L779, so I’m https://github.com/clj-commons/etaoin/blob/1e0c80fc55abc3a357651a89791958a88237e6ac/script/tools_versions.clj#L116.
thanks! should we add ps1 to the list by default maybe? @U013JFLRFS8?
yeah mebbe… I was looking to report on the location of lein
on my system, it is lein.cmd
(a scoop shim) on others it is lein.bat
and still others lein.ps1
.
I was as surprised as you are. But it is available and what setup-clojure GitHub Action installs.
Can a dep add tasks when it's added to bb.edn? Like, just by including it in bb.edn I get new tasks it defines w/o explicitly listing them? a "task library" of sorts
@cap10morgan That you can't, but you can of course make a library with functions and use that from tasks
Hmm, yep. I was playing around with the idea of generating tasks for the fns in your build.clj file. And then applying babashka smarts like not running some if source files weren't newer like make.
Right, I've done something like that here: https://github.com/clj-easy/graal-build-time/blob/b91cd78a977fdf81758705668f44b0d2ddad4bdc/bb.edn#L26
I guess you could build something like a project.edn
which declaratively describes what your build input, output (jar, etc) is and some bb library which does the most common things, including checking if stuff is up to date and then calling tools.build. That's kind of what James's build project is doing too.
For completeness sake I will also mention the (experimental!) tools.bbuild: https://github.com/babashka/tools.bbuild