Grow your project tree from acorn!
Acorn is a simple file tree template engine inspired by lazybones project.
The Acorn lets you create archetypes for any kind of project or file structures.
Note
|
Since 0.3.0 Acorn requires Java 17+ |
The Acorn has two version: Groovy (Java) library and CLI for it.
-
Install via lmm :
lmm i kato.acorn
-
Download and unpack from GitHub Release page
; acorn --help
Usage: acorn [-hV] -d=PATH -s=PATH [-p=KEY=VALUE]...
-d, --dest=PATH Destination directory. Will be created if absent
-h, --help Show this help message and exit.
-p, --param=KEY=VALUE Params to render template
-s, --src=PATH Template source directory
-V, --version Print version information and exit.
Replace placeholders with given data in files with extension .tmpl
Dear ${user}. You have ${count} thing${count > 1 ? 's' : ''} in your cart. Total price is \$${totalPrice}
With next params user=Joe
, count=2
, totalPrice=42
the file above will be resolved into file w/o .tmpl
extension
Dear Joe. You have 2 things in your cart. Total price is $42 (1)
-
- to escape the
$
sign use\
You can use groovy for scripting inside file templates because they are GStringTemplateEngine
Dear <%= user%>. You have <% out << count %> thing<%
if (count > 1) {
out << 's'
}
%> in your cart.
Total price is \$${totalPrice}
This template will be rendered the same as previous one but uses full-fledged programming language in it
Placeholders can be used in plain file and template names
./src └── ${nameVar}-file.txt └── ${nameVar}.txt.tmpl
You can generate nested hierarchy by templating folder names
./src ├── ${emptyValue} │ └── file-in-root.txt ├── ${folderVar} │ └── nested-file.txt └── ${nameVar}-file.txt params: [nameVar: 'named', folderVar: 'one/two/three', emptyValue: ''] ./dest ├── file-in-root.txt ├── named-file.txt └── one └── two └── three └── nested-file.txt
-
configure
~/.gradle/gradle.properties
and importAinrif General GPG
. -
call
gw clean build publishToSonatype closeAndReleaseSonatypeStagingRepository
to release lib. -
tag release commit with version
git tag <version from build.gradle> && git push --tags
-
create new release with binary in GitHub manually