#project #generator #template #skeleton

bin+lib ffizer

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

29 releases (10 stable)

✓ Uses Rust 2018 edition

1.6.3 Dec 4, 2019
1.6.0 Nov 23, 2019
1.5.1 Oct 13, 2019
1.2.0 Jul 21, 2019
0.6.0 Nov 25, 2018

#20 in Command line utilities

Download history 160/week @ 2019-08-21 87/week @ 2019-08-28 115/week @ 2019-09-04 36/week @ 2019-09-11 182/week @ 2019-09-18 92/week @ 2019-09-25 53/week @ 2019-10-02 25/week @ 2019-10-09 133/week @ 2019-10-16 96/week @ 2019-10-23 67/week @ 2019-10-30 31/week @ 2019-11-06 62/week @ 2019-11-13 53/week @ 2019-11-20 97/week @ 2019-11-27

319 downloads per month

CC0 license

105KB
2K SLoC

ffizer

crates license crate version

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Actions Status test coverage

crates download GitHub All Releases

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

keywords: file generator, project template, project scaffolding, quick start, project bootstrap, project skeleton

asciicast: ffizer demo

Features

  • Create or update files and folder from one (or several) template(s).
  • A native executable (cli)
    • Install via download a standalone single file on system (no requirements like python, ruby, nodejs, java, ...).
    • Run as fast enough project generator.
    • Run with dry mode (useful to test).
    • Support self-upgrade.
  • A rust library
    • Can be included into other tool
  • Templates Authoring
    • Can be used for any file & folder generation (no specialization to one ecosystem).
    • Can start as simple as a folder to copy "as is".
    • Can use the [Handlebars] template syntax for file content, extended with functions:
      • To transform strings (toUpperCase, toLowerCase, Capitalize,...)
      • To retrieve content via http get (like .gitignore from gitignore.io, license from spdx)
      • ...
    • Can replace variables part in file and folder's name
    • Can be composed of other templates (applied as layer)
    • Can ignore file / folder under conditions
    • Can store the content at the root of the folder or under the sub-folder template
  • Templates Hosting
    • On a local folder
    • On a hosted git repository (public / private, github / bitbucket/ gitlab / ...)
      • At the root of the repository
      • In a sub-folder of the repository
      • In any revision (branch, tag, commit)

Suggestions are welcomes ;-)

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 snap

# experimental, feedback welcome
sudo snap install ffizer --edge

via github releases

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

via cargo

cargo install ffizer --force --features cli

Run

➜  ffizer --help

ffizer 1.6.0
https://github.com/ffizer/ffizer
ffizer is a files and folders initializer / generator.
It creates or updates any kind (or part) of project from template(s)

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)
    inspect    Inspect configuration, caches,... (wip)
    upgrade    Self upgrade ffizer executable

Self upgrade the executable

  ffizer upgrade

Apply a template (to create or update)

  ffizer apply --help

ffizer-apply 1.6.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
        --x-always_default_value    should not ask for valiables values, always use defautl value or empty
                                    (experimental)

OPTIONS:
        --confirm <confirm>               ask for plan confirmation [default: Never]  [possible values:
                                          Auto, Always, 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
        --update-mode <update-mode>       mode to update existing file [default: Ask]  [possible values:
                                          Ask, Keep, Override, UpdateAsRemote,
                                          CurrentAsLocal, ShowDiff, Merge]
    -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

Update CHANGELOG.md

cargo make update-changelog
git add CHANGELOG.md
git commit -m ':memo: (CHANGELOG) update'

Release a new version by bump patch (or minoror major)

cargo make publish -- patch --dry-run
cargo make publish -- patch

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,...

Dependencies

~21MB
~464K SLoC