Skip to content

arturopala/make-it-g8

Repository files navigation

Tool to convert your project into a giter8 template

Build Maven Central GitHub GitHub code size in bytes

Motivation

Creating new giter8 template isn't hard, see here, but sometimes it can be cumbersome and error-prone. You may also want to automate template creation after changes made to the project without manually replacing package paths, file names and text chunks with the placeholders.

What does it mean to create g8 template?

The giter8 template is an ordinary project folder where files or paths may contain variable placeholders, e.g. $name$. Place it on GitHub and use with the g8 command line tool or sbt new command to spring your own project.

Advantages of using make-it-g8

  • creates template wrapped nicely in an SBT project
  • supports parametrization by multiple replacement keys
  • derives automatically common key variants: camel, snake, hyphen, package, packaged, etc.
  • adds a script to generate an example project and test it
  • adds a script to update the template after changes made to the example project (covers full create-change-validate-update cycle)
  • generates README with the template usage guide and an example project files tree picture

Prerequisites

Usage

Run the tool locally in an interactive mode

Using coursier:

cs launch com.github.arturopala:make-it-g8_2.12:1.11.0 -- --interactive

or using script:

wget https://raw.githubusercontent.com/arturopala/make-it-g8/master/make-it-g8.sh
chmod u+x make-it-g8.sh
./make-it-g8.sh --interactive

Run the tool locally in a scripted mode

Using coursier:

cs launch com.github.arturopala:make-it-g8_2.12:1.11.0 -- --source {PATH} [--target {PATH}] [--name {STRING}] [--package {STRING}] [--description {STRINGURLENCODED}] [-K key=patternUrlEncoded]

or using script:

wget https://raw.githubusercontent.com/arturopala/make-it-g8/master/make-it-g8.sh
chmod u+x make-it-g8.sh
./make-it-g8.sh --source {PATH} [--target {PATH}] [--name {STRING}] [--package {STRING}] [--description {STRINGURLENCODED}] [-K key=patternUrlEncoded]

Options:

-s, --source  <arg>                        Source code path, absolute or
                                            relative
-p, --package  <arg>                       Source code base package name

-c, --clear                                Clear target folder
    --noclear                              Do not clear whole target folder,
                                            only src/main/g8 subfolder
-x, --custom-readme-header-path  <path>    Custom README.md header path
-d, --description  <arg>                   Template description
-f, --force                                Force overwriting target folder
    --noforce
-i, --interactive                          Interactive mode
    --nointeractive
-Kplaceholder=text [placeholder=text]...   Text chunks to parametrize
-n, --name  <arg>                          Template name
-r, --readme                               Create readme
    --noreadme                             Do not create/update readme
-t, --target  <arg>                        Template target path, absolute or
                                            relative
-h, --help                                 Show help message
-v, --version                              Show version of this program

Use as a library

make-it-g8 is hosted in The Maven Central repository

libraryDependencies += "com.github.arturopala" %% "make-it-g8" % "1.11.0"      

Example template created with make-it-g8

Development

Test

sbt test

Run locally

sbt run

sbt "run --interactive"

sbt run -Dmakeitg8.interactive=true