Sceleton is a simple tool for scaffolding directories and files using user-inputted data.
Sceleton can be run using a variety of methods:
Coming soon!
Coming soon!
Coming soon!
Lastly, you can use Sceleton directly by taking a dependency on sceleton-core
and calling the runner manually:
import com.chrisbenincasa.tools.sceleton.SceletonOptions
import com.chrisbenincasa.tools.sceleton.core.SceletonRunner
val config =
SceletonOptions(
"user/github-repo",
new java.io.File("output"),
prefilledProps = Map("name" -> "test service")
)
new SceletonRunner(config).run() match {
case Success(_) =>
case Failure(ex) =>
}
Write templates using any of the supported templating languages. File names are also considered when applying templates.
When given a directory, Sceleton will search for the deepest directory that ends with the word sceleton
. This is treated as the scaffold root; nothing above
the root is transformed and only files/directories under the root are outputted to the target directory.
- Local filesystem
- Github (or any git repository)
- Mustache
There is support for textual transforms on templated values. Transforms can also be chained together.
Simple transform to lowercase:
{{ name;format="lower" }}
Chained transforms:
# transforms "Bob Smith" to "bob_smith"
{{ name;format="lower,underscore" }}
camel
- Converts a string to "camelCase"Camel
- Converts a string to "CamelCase/PascalCase"start
|start-case
- Capitalizes the first letter in each wordunderscore
|snake
|snake-case
- Converts a string to snake_case (replaces dots and spaces with underscores)hyphenate
|hyphen
- Replaces spaces with hypensnormalize
|norm
- Compound transform: runslower-case
and thenhyphenate
on a stringpackaged
|package-dir
- Replaces dots with slashes; useful for generating directory treesupper
|upper-case
- Converts an entire string to uppercaselower
|lower-case
- Converts an entire string to lowercasecap
|capitalize
- Capitalizes the first letter of a stringdecap
|decapitalize
- Un-capitalizes the first letter of a stringword
|word-only
- Removes all non-word characters in a stringrandom
|generate-random
- Generates a random alphanumeric string of length 10
Variables for a scaffold are defined in a file entitled default.properties
in the template root. This file uses the standard format for a properties file. The special key description
can be used to print a message to the user during scaffold time.
Example:
description=Scaffold a new microservice!
name=
organization=com.chrisbenincasa.services
- Run options
- SBT Plugin
- Docker container for running with no required Java setup
- Standalone app (Assembly JAR)
- Scaffold options
- Change mustache delimiter
- Change transform delimiter
- Support pluggable renderer (engines other than Mustache)
- Support pluggable transforms (would only be available for code-based executions, e.g. SBT, direct)