tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
vemv 2020-12-27T11:52:30.132400Z

Curious, can one configure clj to run some code as soon as a REPL is fired up? Basically an equivalent to Lein's :init option

2020-12-27T11:54:57.132900Z

clj -M -e '(some-code)' -r

vemv 2020-12-27T11:58:47.134800Z

Nice! Thanks to your answer I checked out https://github.com/practicalli/clojure-deps-edn/blob/65a48e1547d289a3d647d9f32bf3d2cc7fe8d5d3/deps.edn#L479 I wish though that those humongous strings could be expressed as nicely formatted sexprs instead

2020-12-27T11:59:52.135400Z

you can make a function for that somewhere in sourcepath

vemv 2020-12-27T12:00:50.135500Z

wdym?

2020-12-27T12:03:54.135700Z

in one of my projects I have dev/src/dev/utils.clj file with (ns dev.utils) I also add :extra-paths ["dev/src"] to one of my alias for dev environment in that namespace you can create a function and then from console run it using requiring-resolve

vemv 2020-12-27T12:06:29.135900Z

Ah nice! Similarly, my -e could be a single require and I do all the work in a proper .clj file That way I'd skip the last step you describe

2020-12-27T12:07:29.136100Z

clj -A:dev -M -e '((requiring-resolve 'dev/init))' -r that’s how it could look like in cli

👍 1
2020-12-27T12:08:23.136400Z

and you can also use -i path to specify namespace to load as init

🙌 1
alexmiller 2020-12-27T14:51:00.137200Z

Or use -i instead of -e

alexmiller 2020-12-27T14:51:37.138100Z

Oh sorry, slack didn’t show me the last message there :)

Santiago 2020-12-27T15:05:27.139400Z

How can I access my project’s version at runtime? I’m using deps.edn

vlaaad 2020-12-27T15:09:38.139500Z

This can be expressed as a 5 lines of code in a file that is executed by clj

vlaaad 2020-12-27T15:10:07.139700Z

Ah, it was already mentioned in later discussion

borkdude 2020-12-27T16:17:19.140200Z

@slack.jcpsantiago does deps.edn have version numbers?

Santiago 2020-12-27T16:20:03.142700Z

@borkdude Mine straight from clj-new doesn’t and it seems it’s not supposed to? There is a version in pom.xml <version>0.1.0-SNAPSHOT</version> , so I could read this file. I was looking for something that would work like environ and would read this automatically

practicalli-john 2020-12-27T23:02:17.146600Z

@slack.jcpsantiago if using environ the set an Environment variable or create a .properties file for a Java system property

borkdude 2020-12-27T23:02:51.147200Z

I just inspected clojure.basis to see if my jvm-opts propagated correctly when composing aliases. It did. Neat.

borkdude 2020-12-27T23:03:32.147900Z

Btw, I stumbled upon this blog https://insideclojure.org/2020/07/28/clj-exec/ but it seems the arguments have been renamed from :fn and :args to :exec-fn and :exec-args?

borkdude 2020-12-27T23:03:43.148300Z

Maybe update the blog or is it immutable?

practicalli-john 2020-12-27T23:09:07.149900Z

That name change was covered in https://insideclojure.org/2020/09/04/clj-exec/

seancorfield 2020-12-27T23:18:16.151100Z

That blog is a great example of the history of Clojure features and how they evolve during prerelease work. Changing past posts would remove that evolution.

alexmiller 2020-12-27T23:24:13.152Z

“Don’t believe everything you read on the internet” - Lincoln

2020-12-27T23:31:24.152900Z

It would make sense to add a footnote to an older blog post with a reference to a later update, if one was so inclined.

alexmiller 2020-12-27T23:32:29.153300Z

Well, I’m on vacation :)

2020-12-27T23:33:58.154600Z

Sorry, I should have mentioned that I'm not trying to nudge you or anyone to do that. I do agree that leaving older posts unchanged (except perhaps by addition of such forward-reference footnotes) makes a lot of sense, for anyone wanting to see the history.