deps-new

dharrigan 2022-01-06T16:47:07.000200Z

Ah yes 🙂

dharrigan 2022-01-06T16:48:17.001700Z

I'm wondering, would it be an idea to have the templates as a jar? So that instead of having the templates cloned locally, it can fetch and apply? Or perhaps, the templates can also be a pointer to a repo to clone and apply?

seancorfield 2022-01-06T16:50:03.002400Z

You can't have templates in a JAR.

seancorfield 2022-01-06T16:51:02.004Z

tools.build requires files on a file system, not resources on the classpath

dharrigan 2022-01-06T16:51:19.004300Z

What I'm thinking about is sharing. If I go to the trouble of defining a new template, then it would be nice if the deps-new tool could find those templates for me via some mechanism and clone the repo

seancorfield 2022-01-06T16:51:33.004900Z

(for copying)

dharrigan 2022-01-06T16:51:34.005Z

to like .deps-new/templates/<foo bar> then use that as the basis

dharrigan 2022-01-06T16:52:36.006500Z

Right now, I have to do clj-template/clj-template {:local/root "/home/david/development/clojure/clj-template"}}, but would be nice if I could tell deps-new where to clone that repo out locally, then to apply all the goodness that it does

dharrigan 2022-01-06T16:53:24.007300Z

clj-template/clj-template {:git/repo ""} something like that

dharrigan 2022-01-06T16:53:40.007700Z

then the deps-new would clone that repo to a local folder, and continue onwards.

seancorfield 2022-01-06T16:57:40.008500Z

Read the deps-new source. It doesn't currently do anything with fetching dependencies, it doesn't unpack anything.

dharrigan 2022-01-06T16:58:02.009100Z

Right, that I understand, but perhaps as a feature request?

seancorfield 2022-01-06T16:58:50.009700Z

I don't want to deal with unpacking JARs and maintaining a "cache" tree and staleness and all the other complexity that goes with that.

seancorfield 2022-01-06T16:59:08.010200Z

By sticking to local or git deps, t.d.a and the CLI deal with all that for me.

seancorfield 2022-01-06T17:00:37.010600Z

This is the entire extent of dealing with the classpath at the moment:

(let [poss-dir (->file template-sym)
        edn-file (str poss-dir "/template.edn")
        paths    (str/split (System/getProperty "java.class.path")
                            (re-pattern (System/getProperty "path.separator")))]
    (some #(let [file (io/file (str % "/" edn-file))]
             (when (.exists file)
               [(.getCanonicalPath (io/file (str % "/" poss-dir)))
                (.getCanonicalPath file)]))
          paths)))

dharrigan 2022-01-06T17:00:49.010800Z

okaydokey

dharrigan 2022-01-06T17:14:28.011Z

Do'h

dharrigan 2022-01-06T17:14:32.011200Z

it actually does work already!

dharrigan 2022-01-06T17:14:46.011500Z

clj-template/clj-template {:git/url ""
                                                     :git/sha "96f0cde2d4b6eab8fb39d0b01cb1d37857660088"}}

dharrigan 2022-01-06T17:14:59.011700Z

neato

seancorfield 2022-01-06T17:25:12.011900Z

Yeah, I said git deps work.

seancorfield 2022-01-06T17:26:04.012400Z

The README does mention all of this (including the no JAR stuff): The COORDINATES could be something like {:local/root "/path/to/cool-lib"} for a template that exists on the local filesystem, or it could be based on :git/url/:git/sha etc for a template that exists in a git repository. Note: because deps-new is based on tools.build and uses its file copying functions, the template must ultimately live on the filesystem, so :local/root and git-based coordinates are supported, but Maven/Clojars coordinates are not.

dharrigan 2022-01-06T17:28:08.012600Z

👍