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
First time I realize that clj could become the npm of Clojure.
Couldn't you pull leiningen down from it in a similar fashion? And have a lein alias?
Well, clj-new will use Leiningen as a library if you ask it to create you a new project from a Leiningen template:
clj -A:new figwheel my.fig.project
It depends on [leiningen-core “2.7.1”] to render figwheel/lein-template (a lot of Leiningen templates seem to reach into the innards of Leiningen for various things). That doesn’t get you the lein shell script, however (which you can’t get as a dependency), but you can do a lot of things just with leiningen-core. For another example of using Leiningen itself as a library, see http://seancorfield.github.io/blog/2017/11/17/boot-localrepo/ where I show how to start a Boot REPL with (the whole of) Leiningen as a dependency and a Leiningen plugin, and then run lein commands from the REPL (still no shell script!).
If you ask clj-new to create a project from a Boot template, it will can do that out-of-the-box (since it is basically a fork of boot/new without any of the Boot dependencies):
clj -A:new simple-yada-template simple.yada
(that will cause boot/new 0.5.2 to be downloaded, but only as a transitive dependency of simple-yada-template/boot-template).
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
clj --install alias-name alias-url
clj -A:alias-name args ...
{:default-alias-name alias-map-to-add-as-an-alias}
clj --uninstall alias-name
clj --update alias-name
clj --install alias-name
clj --install -g clj-new
clj --install -g clj-new https://github.com/seancorfield/clj-new.git
Alan
clj -Sdeps '{:deps {seancorfield/clj-new {:git/url "https://github.com/seancorfield/clj-new" :sha "492bb2e7ad7373a8b5958124a86cddc4c7a123d5"}}}' -m clj-new.create ...
I had the one-liner in an earlier version of the README but decided it was unreadable (a single long line is hard to read when it scrolls so much).
Maybe I’ll put it back somewhere in there…
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
clj -Sdeps '{:deps {seancorfield/clj-new {:git/url "https://github.com/seancorfield/clj-new" :sha "492bb2e7ad7373a8b5958124a86cddc4c7a123d5"}}}' -m clj-new.create ...
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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
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+unsubscribe@googlegroups.com.
I had the one-liner in an earlier version of the README but decided it was unreadable (a single long line is hard to read when it scrolls so much).
Maybe I’ll put it back somewhere in there…
Alright, added command-line usage back into the README! Talk about “peer pressure” 😊
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
Alright, added command-line usage back into the README! Talk about “peer pressure” 😊
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood