Skip to content

johnwalker/yakshave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yakshave

This project was created under a very strong coffee high. I have to do other things. I still think the idea is cute, but also short-sighted – Java 9 is going to make it easier for Clojure to start more quickly. If you want to maintain it let me know and I’ll point it to your fork :)

What is a yakshave?

Yakshave is a tool written in Clojurescript (Nodejs) for managing and generating 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:

$ npm install yakshave -g

The latest version is 0.1.3.

You can also fork it and run:

$ lein cljsbuild once prod
$ npm install -g

Why should I yakshave?

It’s a lot faster - in the initial release:

$ time ys new compojure example
yakshave new compojure example  0.18s user 0.01s system 101% cpu 0.191 total

For small templates, yakshave performs extremely well.

Aliasing yakshave to ys for finger performance is recommended.

# in .bashrc / .zshrc
alias ys='yakshave'

Why shouldn’t I yakshave?

It’s not battle-tested. There are probably a lot of bugs, too. Many lein templates aren’t yet compatible with yakshave. You would have to install nodejs.

Complete list of supported tasks

yakshave new template-name? project-name

Usage

new - Generating projects

Yakshave templates – just like leiningen – are hosted in maven repositories. It is very easy for a leiningen template to be a yakshave template, and vice versa. The difference between the two is that yakshave templates use edn, while leiningen templates are fully programmatic, as they are written in Clojure. Since yakshave is brand new, many lein templates will not work yet. If you’re the author of a template and want some help setting it up for yakshave, please open an issue!

One very important difference is that yakshave doesn’t fetch templates yet.

yakshave new foobar
yakshave new app foobar

Creating yakshave compatible templates

If you squint, yakshave templates look a lot like leiningen ones. Here the app template in yakshave:

{: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]}}

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:

{: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]}}

The valid keys are

:identity
:unprefix
:year
:sanitize-ns
:sanitize
:multi-segment
:name-to-path
:group-name
:project-name

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:

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:

Discussion

License

Copyright © 2014 John Walker and contributors

Distributed under the Eclipse Public License version 1.0, the same as Clojure.

About

A much faster lein new

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published