A Clojurescript manager for Leiningen projects
npm install yakshave* yakshave
#+BEGIN_QUOTE
Richter: Die monster. You don’t belong in this world!
Dracula: It was not by my hand I was once again given flesh. I was
brought here by humans who wished to be me tribute!
Richter: Tribute!? You steal men’s souls, and make them your slaves!
Dracula: Perhaps the same could be said of all religions…
Richter: Your words are as empty as your soul! Mankind ill needs a
savior such as you!
Dracula: What is a man? A miserable little pile of secrets. But
enough talk… Have at you!
#+END_QUOTE
** What is a yakshave?
Yakshave is a tool written in Clojurescript (Nodejs) for managing
and generating [[https://github.com/technomancy/leiningen][leiningen]] projects. It aims to handle the scripting
tasks that leiningen is currently used for and more.
Provided that you have nodejs, you can install yakshave with:
#+BEGIN_SRC sh
$ npm install yakshave -g
#+END_SRC
The latest version is 0.1.2.
You can also fork it and run:
#+BEGIN_SRC sh
$ lein cljsbuild once prod
$ npm install -g
#+END_SRC
** Why should I yakshave?
It's a lot faster - in the initial release:
#+BEGIN_SRC sh
$ time yakshave new foobar
Hmm. Like 6 times faster. But remember, those templates are buried
deep within the leiningen.jar.
#+BEGIN_SRC sh
$ time ys new compojure example !2804
yakshave new compojure example 0.18s user 0.01s system 101% cpu 0.191 total
$ time lein new compojure example2 !2841
lein new compojure example2 4.66s user 0.18s system 120% cpu 4.020 total
#+END_SRC
For small templates it's almost 26 times faster! Note that the
compojure template refers to this repository:
https://github.com/johnwalker/compojure-template
Aliasing yakshave to ys for finger performance is recommended.
#+BEGIN_SRC sh
One very important difference is that *yakshave doesn't fetch
templates yet.*
#+BEGIN_EXAMPLE
yakshave new foobar
yakshave new app foobar
#+END_EXAMPLE
** Creating yakshave compatible templates
If you squint, yakshave templates look a lot like leiningen
ones. Here is what the app template looks like when it's
described with yakshave:
#+BEGIN_SRC clojure
{:renderer "app"
:files [["project.clj" "project.clj"]
["README.md" "README.md"]
["doc/intro.md" "intro.md"]
[".gitignore" "gitignore"]
["src/{{nested-dirs}}.clj" "core.clj"]
["test/{{nested-dirs}}_test.clj" "test.clj"]
["LICENSE" "LICENSE"]
"resources"]
:data {:raw-name [:identity]
:name [:project-name]
:namespace [:sanitize-ns
:multi-segment]
:nested-dirs [:sanitize-ns
:multi-segment
:name-to-path]
:year [:year]}}
#+END_SRC
The vector is treated as thread-first on the name the user passes
to yakshave. If a string were passed instead, then that value
would merely be substituted. For example, in the "template" template:
#+BEGIN_SRC clojure
{:renderer "template"
:files [["README.md" "README.md"]
["project.clj" "project.clj"]
[".gitignore" "gitignore"]
["src/leiningen/new/{{sanitized}}.clj" "temp.clj"]
["resources/leiningen/new/{{sanitized}}/foo.clj" "foo.clj"]
["LICENSE" "LICENSE"]]
:data {:name [:identity]
:sanitized [:sanitize]
:placeholder "{{:sanitized}}"
:year [:year]}}
#+END_SRC
The valid keys are
#+BEGIN_SRC clojure
:year
:identity
:sanitize-ns
:sanitize
:multi-segment
:name-to-path
:group-name
:project-name
:unprefix
#+END_SRC
which correspond directly to the built-in leiningen ones. Two new
keys are :identity and :unprefix. You already know what :identity
does, and you don't care about :unprefix.
** List of yakshave compatible templates
The built-in leiningen templates:
+ app
+ default
+ template
+ plugin
The compojure fork: https://github.com/johnwalker/compojure-template
** Template wishlist
These are some high priority templates for yakshave
compatibility.
+ cljs-start
+ compojure
+ mies
+ mies-node
+ reloaded
** Contributing
Contributors are wanted very badly. There are many ways to help
out - porting lein-templates to yakshave, general refactoring,
writing documentation, blogging about yakshave and contributing
criticism are all great help.
Outside of yakshave itself, these are extremely critical:
+ [[https://github.com/xsc/rewrite-clj/issues/4][porting rewrite-clj to cljs]]
+ contributing to [[https://github.com/clojure/core.match][core.match]], [[https://github.com/clojure/clojurescript][clojurescript]], [[https://github.com/cthackers/adm-zip][adm-zip]] or [[https://github.com/janl/mustache.js][mustache.js]]
** Discussion
+ [[https://groups.google.com/forum/#!topic/clojure/2XjEn5aeoQM][Initial Google groups discussion]]
** License
Copyright © 2014 John Walker and contributors
Distributed under the Eclipse Public License version 1.0, the same
as Clojure.