These are nice ideas... Sort of like nmp. But you could implement this yourself as a lib and stick it behind a `clj -A:install ...` tool.
@dominicm (on clojurians.slack) has build an "injector" tool into pack, which you could reimplement into something that you're describing: https://github.com/juxt/pack.alpha/blob/master/src/mach/pack/alpha/inject.clj Who knows, maybe if some of these aliases get super popular and standardized, we can convince Alex to fold some of them into the tools over time :) V/r John John On Thu, Apr 19, 2018 at 3:18 AM, Didier <didi...@gmail.com> wrote: > Ah, awesome. > > I guess I'm starting to think, it would be great if clj supported > something like: > > clj --install alias-name alias-url > > So maybe in a repo, you could put a file of a given convention in the root > with a common name. Clj could pull it, it would contain a clj alias in it, > and clj would auto add it to your deps.edn file as an alias. You could add > a -g option to add it to your global deps.edn, if you wanted to "install" > it globally. > > Nothing else would happen. > > But then, you could run your newly "installed" clojure program by doing: > > clj -A:alias-name args ... > > If you omit the alias name, it could default to something specified in the > alias file. > > What that alias url resolves too, I'm not sure. I'm thinking a git url to > an alias-install.edn file which contains something like: > > {:default-alias-name alias-map-to-add-as-an-alias} > > > And similarly, you could add: > > clj --uninstall alias-name > > And it would remove the alias from your deps.edn, or if given -g, from > your global deps.edn config. > > Ideally, it would remember the alias-url in the deps.edn file, so you > could run: > > clj --update alias-name > > Maybe there could even be a kind of global url repo, with a list of > registered alias names, so one could do: > > clj --install alias-name > > And it would know where to pull the alias-install.edn file from based on > some global repo of distributed Clojure programs. > > I'd love this. Would seem like a pretty great way to deliver Clojure > programs, which does not require any bash script, adding anything to your > PATH, or having to edit a file. > > So for clj-new, ideally one could do: > > clj --install -g clj-new > > And clj would take care of adding the alias for it in my global deps.edn. > > But at the very least, without the alias registry, once could simply do: > > clj --install -g clj-new https://github.com/seancorfield/clj-new.git > > Which would auto-install the alias from a top level alias-install.edn file > inside the repo. > > Something of the sort. > > > > On Tuesday, 17 April 2018 20:06:16 UTC-7, Sean Corfield wrote: >> >> clj-new -- https://github.com/seancorfield/clj-new >> >> >> >> This will generate new projects for you, either based on `clj`, or from >> any existing Leiningen or Boot template (or, I hope in the future, >> `clj-template` projects!). >> >> >> >> You'll probably want to add clj-new as an alias in your >> ~/.clojure/deps.edn like this: >> >> >> >> {:aliases >> >> {:new {:extra-deps {seancorfield/clj-new >> >> {:git/url "https://github.com/seancorfield/clj-new" >> >> :sha "492bb2e7ad7373a8b5958124a86cddc4c7a123d5"}} >> >> :main-opts ["-m" "clj-new.create"]}} >> >> ...} >> >> >> >> Create a basic application: >> >> >> >> clj -A:new app myname/myapp >> >> cd myapp >> >> clj -m myname.myapp >> >> >> >> Run the tests: >> >> >> >> clj -A:test:runner >> >> >> >> Yes, the `deps.edn` generated from the `app` (and `lib`) built-in >> template includes aliases to include your `test` folder, add `test.check` >> as a dependency, and bring in and run Cognitect's `test-runner` >> >> >> >> The project name should either be a qualified Clojure symbol or a >> multi-segment name -- single segment project names are not allowed! >> >> >> >> For a qualified Clojure symbol, the first part is typically your GitHub >> account name or your organization's domain reversed, e.g., `com.acme`, and >> the second part is the "local" name for your project (and is used as the >> name of the folder in which the project is created). >> >> >> >> For a multi-segment project name, such as `foo.bar`, the folder that will >> be created would be called `foo.bar` and will contain `src/foo/bar.clj`. >> >> >> >> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN >> An Architect's View -- http://corfield.org/ >> >> "If you're not annoying somebody, you're not really alive." >> -- Margaret Atwood >> >> >> > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.