ffizer 0.10.1

ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.
Documentation

ffizer

Crates.io Crates.io

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status Build Status codecov

Crates.io GitHub All Releases

ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.

keywords: file generator, project template, project scaffolding, quickstart, project initializer, project skeleton

Motivations

Main features

  • project generator as a standalone executable (no shared/system dependencies (so no python + pip + ...))
  • a simple and generic project template (no specialisation to one ecosystem)
  • template as simple as possible, like a
    • copy or clone with file/folder renames without overwrite
    • few search and replace into file
  • template hosted as a local folder on the file system
  • template hosted as a git repository on any host (not only public github)
    • at root of the repository
    • in subfolder of the repository
    • in any revision (branch, tag, commit)
  • template composed of other template
    • composite template are regular standalone template
    • composite template can be apply at root folder
  • a fast enough project generator

Sub features

  • dry mode (usefull to test)
  • chain commands (eg: 'git init') (like a post-hook)
    • raw command
  • composite template include under conditions
  • file / folder ignored under conditions (ignores'item in ffizer.yaml are defined as handlerbar expression)
  • handlebars helpers
    • transform strings (toUpperCase, toLowerCase, Capitelize,...)
    • render content of GET url
    • render content from https://gitignore.io
    • suggestions welcomes ;-)
  • ability to update / diff / overwrite existing file

Limitations

Some of the following limitations could change in the future (depends on gain/loss):

  • no conditionals file or folder creation
  • no framework X dedicated features
  • no plugin and not extensible (without change the code)
  • handlebars is the only template language supported (support for other is welcome)

Usages

Install

curl https://raw.githubusercontent.com/ffizer/ffizer/master/scripts/getLatest.sh | sh

via homebrew

brew tap ffizer/ffizer
brew install ffizer-bin
ffizer upgrade

via github releases

Download the binary for your platform from github releases, then unarchive it and place it your PATH.

via cargo

cargo install ffizer

Run

➜  ffizer --help

ffizer 0.10.0
https://github.com/ffizer/ffizer
ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.

USAGE:
    ffizer [FLAGS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
    -v, --verbose    Verbose mode (-v, -vv (very verbose / level debug), -vvv) print on stderr

SUBCOMMANDS:
    apply      Apply a template into a target directory
    help       Prints this message or the help of the given subcommand(s)
    upgrade    Self upgrade ffizer executable

Self upgrade the executable

  ffizer upgrade --help

ffizer-upgrade 0.10.0
https://github.com/ffizer/ffizer
Self upgrade ffizer executable

USAGE:
    ffizer upgrade

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

Apply a template

  ffizer apply --help

ffizer-apply 0.10.0
https://github.com/ffizer/ffizer
Apply a template into a target directory

USAGE:
    ffizer apply [FLAGS] [OPTIONS] --destination <dst_folder> --source <uri>

FLAGS:
    -h, --help                      Prints help information
        --offline                   in offline, only local templates or cached templates are used
    -V, --version                   Prints version information
        --x-always_default_value    should not ask for valiables values, always use defautl value or empty
                                    (experimental)

OPTIONS:
        --confirm <confirm>               ask confirmation 'never' or 'always' [default: never]
    -d, --destination <dst_folder>        destination folder (created if doesn't exist)
        --rev <rev>                       git revision of the template [default: master]
        --source-subfolder <subfolder>    path of the folder under the source uri to use for template
    -s, --source <uri>                    uri / path of the template
  • use a local folder as template

    ffizer apply --source $HOME/my_templates/tmpl0 --destination my_project
    
  • use a remote git repository as template

    ffizer apply --source https://github.com/ffizer/template_sample.git --destination my_project
    

    output

    Configure variables
    
    project_name: my_project
    
    
    Plan to execute
    
      - mkdir "my_project/"
      - mkdir "my_project/dir_1"
      - copyraw "my_project/dir_1/file_1_1.txt"
      - mkdir "my_project/dir_2_my_project"
      - copyraw "my_project/dir_2_my_project/file_1_2.txt"
      - copyraw "my_project/file_1.txt"
      - copyrender "my_project/file_2.txt"
      - keep "my_project/file_2.txt"
      - copyrender "my_project/file_3.txt"
      - copyraw "my_project/file_4_my_project.txt"
      - copyrender "my_project/file_5_my_project.txt"
      - copyraw "my_project/file_6.hbs"
    

Authoring a template

see Template Authoring - ffizer WIP

Templates

Build

cargo install cargo-make --force
cargo make ci-flow

Alternatives

Generic

  • Cookiecutter, lot of templates, require python + pip + install dependencies on system (automatic)
  • Cookiecutter — Similar projects
  • sethyuan/fgen: A file generator library to be used to generate project structures, file templates and/or snippets. Templates are based on mustache. require nodejs
  • project_init in rust, use mustache for templating but I have some issues with it (project template creation not obvious, github only) I could contributes but I have incompatible requirements.
  • skeleton, good idea but no template file, more like a script.
  • porteurbars, very similar but I discovered it too late.

Specialized

specialized to a platform, build tool,...